Skip to content

Commit 2f30dec

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: add per DSA wq workqueue for processing cr faults
Add a workqueue for user submitted completion record fault processing. The workqueue creation and destruction lifetime will be tied to the user sub-driver since it will only be used when the wq is a user type. Tested-by: Tony Zhu <tony.zhu@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Co-developed-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Link: https://lore.kernel.org/r/20230407203143.2189681-7-fenghua.yu@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 5fbe650 commit 2f30dec

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/dma/idxd/cdev.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
330330
}
331331

332332
mutex_lock(&wq->wq_lock);
333+
334+
wq->wq = create_workqueue(dev_name(wq_confdev(wq)));
335+
if (!wq->wq) {
336+
rc = -ENOMEM;
337+
goto wq_err;
338+
}
339+
333340
wq->type = IDXD_WQT_USER;
334341
rc = drv_enable_wq(wq);
335342
if (rc < 0)
@@ -348,7 +355,9 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
348355
err_cdev:
349356
drv_disable_wq(wq);
350357
err:
358+
destroy_workqueue(wq->wq);
351359
wq->type = IDXD_WQT_NONE;
360+
wq_err:
352361
mutex_unlock(&wq->wq_lock);
353362
return rc;
354363
}
@@ -361,6 +370,8 @@ static void idxd_user_drv_remove(struct idxd_dev *idxd_dev)
361370
idxd_wq_del_cdev(wq);
362371
drv_disable_wq(wq);
363372
wq->type = IDXD_WQT_NONE;
373+
destroy_workqueue(wq->wq);
374+
wq->wq = NULL;
364375
mutex_unlock(&wq->wq_lock);
365376
}
366377

drivers/dma/idxd/idxd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ struct idxd_wq {
185185
struct idxd_dev idxd_dev;
186186
struct idxd_cdev *idxd_cdev;
187187
struct wait_queue_head err_queue;
188+
struct workqueue_struct *wq;
188189
struct idxd_device *idxd;
189190
int id;
190191
struct idxd_irq_entry ie;

0 commit comments

Comments
 (0)