From: Vinod Koul Date: Wed, 5 Aug 2020 13:32:07 +0000 (+0530) Subject: Merge branch 'for-linus' into fixes X-Git-Tag: v5.9-rc1~96^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=0b5ad7b9522e6172342511fac6114fd8b7eb622a;p=linux-2.6-block.git Merge branch 'for-linus' into fixes Signed-off-by: Vinod Koul Conflicts: drivers/dma/idxd/sysfs.c --- 0b5ad7b9522e6172342511fac6114fd8b7eb622a diff --cc drivers/dma/idxd/cdev.c index cb376cf6a2d2,f9fc58966207..c3976156db2f --- a/drivers/dma/idxd/cdev.c +++ b/drivers/dma/idxd/cdev.c @@@ -115,10 -104,11 +115,13 @@@ static int idxd_cdev_release(struct ino dev_dbg(dev, "%s called\n", __func__); filep->private_data = NULL; + /* Wait for in-flight operations to complete. */ + idxd_wq_drain(wq); + kfree(ctx); + mutex_lock(&wq->wq_lock); idxd_wq_put(wq); + mutex_unlock(&wq->wq_lock); return 0; } diff --cc drivers/dma/idxd/idxd.h index 908c8d0ef3ab,5f50bb830ca4..e62b4799d189 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@@ -288,9 -290,9 +290,10 @@@ int idxd_wq_alloc_resources(struct idxd void idxd_wq_free_resources(struct idxd_wq *wq); int idxd_wq_enable(struct idxd_wq *wq); int idxd_wq_disable(struct idxd_wq *wq); + void idxd_wq_drain(struct idxd_wq *wq); int idxd_wq_map_portal(struct idxd_wq *wq); void idxd_wq_unmap_portal(struct idxd_wq *wq); +void idxd_wq_disable_cleanup(struct idxd_wq *wq); /* submission */ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc); diff --cc drivers/dma/idxd/irq.c index 8a35f58da689,f3c1d9ae8b56..b5142556cc4e --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@@ -158,11 -155,10 +155,11 @@@ irqreturn_t idxd_misc_thread(int vec, v "idxd halted, need %s.\n", gensts.reset_type == IDXD_DEVICE_RESET_FLR ? "FLR" : "system reset"); + spin_unlock_bh(&idxd->dev_lock); } - spin_unlock_bh(&idxd->dev_lock); } + out: idxd_unmask_msix_vector(idxd, irq_entry->id); return IRQ_HANDLED; } diff --cc drivers/dma/idxd/sysfs.c index 2e2c5082f322,6f0711a822a1..dcba60953217 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@@ -313,14 -303,7 +303,14 @@@ static int idxd_config_bus_remove(struc } idxd_unregister_dma_device(idxd); - spin_lock_irqsave(&idxd->dev_lock, flags); rc = idxd_device_disable(idxd); + for (i = 0; i < idxd->max_wqs; i++) { + struct idxd_wq *wq = &idxd->wqs[i]; + ++ mutex_lock(&wq->wq_lock); + idxd_wq_disable_cleanup(wq); ++ mutex_unlock(&wq->wq_lock); + } - spin_unlock_irqrestore(&idxd->dev_lock, flags); module_put(THIS_MODULE); if (rc < 0) dev_warn(dev, "Device disable failed\n");