[RFC PATCH 03/12] drm/xe: Use WQ_MEM_WARN_ON_RECLAIM on all workqueues in the reclaim path

Matthew Brost
2026-03-16T04:33:15Z

Mark all workqueues in the reclaim path with WQ_MEM_WARN_ON_RECLAIM to
ensure that reclaim rules are properly enforced via lockdep on these
workqueues.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_device.c | 3 ++-
drivers/gpu/drm/xe/xe_ggtt.c | 3 ++-
drivers/gpu/drm/xe/xe_gt.c | 3 ++-
drivers/gpu/drm/xe/xe_guc_ct.c | 3 ++-
drivers/gpu/drm/xe/xe_tlb_inval.c | 3 ++-
5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index e77a3a3db73d..00b966744d25 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -507,7 +507,8 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
return ERR_PTR(err);

xe->preempt_fence_wq = alloc_ordered_workqueue("xe-preempt-fence-wq",
- WQ_MEM_RECLAIM);
+ WQ_MEM_RECLAIM |
+ WQ_MEM_WARN_ON_RECLAIM);
xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0);
xe->unordered_wq = alloc_workqueue("xe-unordered-wq", WQ_PERCPU, 0);
xe->destroy_wq = alloc_workqueue("xe-destroy-wq", WQ_PERCPU, 0);
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 21071b64b09d..017f679ba13f 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -434,7 +434,8 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
else
ggtt->pt_ops = &xelp_pt_ops;

- ggtt->wq = alloc_workqueue("xe-ggtt-wq", WQ_MEM_RECLAIM | WQ_PERCPU, 0);
+ ggtt->wq = alloc_workqueue("xe-ggtt-wq", WQ_MEM_RECLAIM | WQ_PERCPU |
+ WQ_MEM_WARN_ON_RECLAIM, 0);
if (!ggtt->wq)
return -ENOMEM;

diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index bae895fa066a..79f4128fe325 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -84,7 +84,8 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile)
ordered_wq = tile->primary_gt->ordered_wq;
else
ordered_wq = drmm_alloc_ordered_workqueue(drm, "gt-ordered-wq",
- WQ_MEM_RECLAIM);
+ WQ_MEM_RECLAIM |
+ WQ_MEM_WARN_ON_RECLAIM);
if (IS_ERR(ordered_wq))
return ERR_CAST(ordered_wq);

diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index 3b1c03743f83..7ec34ac00f59 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -325,7 +325,8 @@ int xe_guc_ct_init_noalloc(struct xe_guc_ct *ct)

primelockdep(ct);

- ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", WQ_MEM_RECLAIM);
+ ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", WQ_MEM_RECLAIM |
+ WQ_MEM_WARN_ON_RECLAIM);
if (!ct->g2h_wq)
return -ENOMEM;

diff --git a/drivers/gpu/drm/xe/xe_tlb_inval.c b/drivers/gpu/drm/xe/xe_tlb_inval.c
index 10dcd4abb00f..10dff2d8cf45 100644
--- a/drivers/gpu/drm/xe/xe_tlb_inval.c
+++ b/drivers/gpu/drm/xe/xe_tlb_inval.c
@@ -154,7 +154,8 @@ int xe_gt_tlb_inval_init_early(struct xe_gt *gt)

tlb_inval->job_wq = drmm_alloc_ordered_workqueue(&xe->drm,
"gt-tbl-inval-job-wq",
- WQ_MEM_RECLAIM);
+ WQ_MEM_RECLAIM |
+ WQ_MEM_WARN_ON_RECLAIM);
if (IS_ERR(tlb_inval->job_wq))
return PTR_ERR(tlb_inval->job_wq);

--
2.34.1