Skip to content

Commit a3753a3

Browse files
DispatchCodembrost05
authored andcommitted
drm/xe: Replace use of system_wq with tlb_inval->timeout_wq
This patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new alloc_workqueue flag: commit 128ea9f ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea ("workqueue: Add new WQ_PERCPU flag") The point of the refactoring is to eventually alter the default behavior of workqueues to become unbound by default so that their workload placement is optimized by the scheduler. Before that to happen, workqueue users must be converted to the better named new workqueues with no intended behaviour changes: system_wq -> system_percpu_wq system_unbound_wq -> system_dfl_wq This way the old obsolete workqueues (system_wq, system_unbound_wq) can be removed in the future. After a carefully evaluation, because this is the fence signaling path, we changed the code in order to use one of the Xe's workqueue. So, a new workqueue named 'timeout_wq' has been added to 'struct xe_tlb_inval' and has been initialized with 'gt->ordered_wq' changing the system_wq uses with tlb_inval->timeout_wq. Link: https://lore.kernel.org/all/20250221112003.1dSuoGyc@linutronix.de/ Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260112094406.82641-1-marco.crivellari@suse.com
1 parent 49a4983 commit a3753a3

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_tlb_inval.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void xe_tlb_inval_fence_timeout(struct work_struct *work)
9494
xe_tlb_inval_fence_signal(fence);
9595
}
9696
if (!list_empty(&tlb_inval->pending_fences))
97-
queue_delayed_work(system_wq, &tlb_inval->fence_tdr,
97+
queue_delayed_work(tlb_inval->timeout_wq, &tlb_inval->fence_tdr,
9898
timeout_delay);
9999
spin_unlock_irq(&tlb_inval->pending_lock);
100100
}
@@ -146,6 +146,10 @@ int xe_gt_tlb_inval_init_early(struct xe_gt *gt)
146146
if (IS_ERR(tlb_inval->job_wq))
147147
return PTR_ERR(tlb_inval->job_wq);
148148

149+
tlb_inval->timeout_wq = gt->ordered_wq;
150+
if (IS_ERR(tlb_inval->timeout_wq))
151+
return PTR_ERR(tlb_inval->timeout_wq);
152+
149153
/* XXX: Blindly setting up backend to GuC */
150154
xe_guc_tlb_inval_init_early(&gt->uc.guc, tlb_inval);
151155

@@ -240,7 +244,7 @@ static void xe_tlb_inval_fence_prep(struct xe_tlb_inval_fence *fence)
240244
list_add_tail(&fence->link, &tlb_inval->pending_fences);
241245

242246
if (list_is_singular(&tlb_inval->pending_fences))
243-
queue_delayed_work(system_wq, &tlb_inval->fence_tdr,
247+
queue_delayed_work(tlb_inval->timeout_wq, &tlb_inval->fence_tdr,
244248
tlb_inval->ops->timeout_delay(tlb_inval));
245249
spin_unlock_irq(&tlb_inval->pending_lock);
246250

@@ -399,7 +403,7 @@ void xe_tlb_inval_done_handler(struct xe_tlb_inval *tlb_inval, int seqno)
399403
}
400404

401405
if (!list_empty(&tlb_inval->pending_fences))
402-
mod_delayed_work(system_wq,
406+
mod_delayed_work(tlb_inval->timeout_wq,
403407
&tlb_inval->fence_tdr,
404408
tlb_inval->ops->timeout_delay(tlb_inval));
405409
else

drivers/gpu/drm/xe/xe_tlb_inval_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ struct xe_tlb_inval {
109109
struct workqueue_struct *job_wq;
110110
/** @tlb_inval.lock: protects TLB invalidation fences */
111111
spinlock_t lock;
112+
/** @timeout_wq: schedules TLB invalidation fence timeouts */
113+
struct workqueue_struct *timeout_wq;
112114
};
113115

114116
/**

0 commit comments

Comments
 (0)