Skip to content

Commit a6f7835

Browse files
stuartsummersrodrigovivi
authored andcommitted
drm/xe: Fix missing workqueue destroy in xe_gt_pagefault
On driver reload we never free up the memory for the pagefault and access counter workqueues. Add those destroy calls here. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Stuart Summers <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/c9a951505271dc3a7aee76de7656679f69c11518.1723862633.git.stuart.summers@intel.com (cherry picked from commit 7586fc5) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent a06a7b3 commit a6f7835

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/gpu/drm/xe/xe_gt_pagefault.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,18 @@ static void pf_queue_work_func(struct work_struct *w)
382382

383383
static void acc_queue_work_func(struct work_struct *w);
384384

385+
static void pagefault_fini(void *arg)
386+
{
387+
struct xe_gt *gt = arg;
388+
struct xe_device *xe = gt_to_xe(gt);
389+
390+
if (!xe->info.has_usm)
391+
return;
392+
393+
destroy_workqueue(gt->usm.acc_wq);
394+
destroy_workqueue(gt->usm.pf_wq);
395+
}
396+
385397
int xe_gt_pagefault_init(struct xe_gt *gt)
386398
{
387399
struct xe_device *xe = gt_to_xe(gt);
@@ -409,10 +421,12 @@ int xe_gt_pagefault_init(struct xe_gt *gt)
409421
gt->usm.acc_wq = alloc_workqueue("xe_gt_access_counter_work_queue",
410422
WQ_UNBOUND | WQ_HIGHPRI,
411423
NUM_ACC_QUEUE);
412-
if (!gt->usm.acc_wq)
424+
if (!gt->usm.acc_wq) {
425+
destroy_workqueue(gt->usm.pf_wq);
413426
return -ENOMEM;
427+
}
414428

415-
return 0;
429+
return devm_add_action_or_reset(xe->drm.dev, pagefault_fini, gt);
416430
}
417431

418432
void xe_gt_pagefault_reset(struct xe_gt *gt)

0 commit comments

Comments
 (0)