All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH v5] drm/i915: Avoid circular locking dependency when flush delayed work on gt reset
@ 2023-08-11 18:20 ` Zhanjun Dong
  0 siblings, 0 replies; 37+ messages in thread
From: Zhanjun Dong @ 2023-08-11 18:20 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Daniel Vetter

This attempts to avoid circular locking dependency between flush delayed
work and intel_gt_reset.
When intel_gt_reset was called, task will hold a lock.
To cacel delayed work here, the _sync version will also acquire a lock,
which might trigger the possible cirular locking dependency warning.
When intel_gt_reset called, reset_in_progress flag will be set, add code
to check the flag, call async verion if reset is in progress.

Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index a0e3ef1c65d2..600388c849f7 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1359,7 +1359,16 @@ static void guc_enable_busyness_worker(struct intel_guc *guc)
 
 static void guc_cancel_busyness_worker(struct intel_guc *guc)
 {
-	cancel_delayed_work_sync(&guc->timestamp.work);
+	/*
+	 * When intel_gt_reset was called, task will hold a lock.
+	 * To cacel delayed work here, the _sync version will also acquire a lock, which might
+	 * trigger the possible cirular locking dependency warning.
+	 * Check the reset_in_progress flag, call async verion if reset is in progress.
+	 */
+	if (guc_to_gt(guc)->uc.reset_in_progress)
+		cancel_delayed_work(&guc->timestamp.work);
+	else
+		cancel_delayed_work_sync(&guc->timestamp.work);
 }
 
 static void __reset_guc_busyness_stats(struct intel_guc *guc)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-09-06 18:49 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 18:20 [Intel-gfx] [PATCH v5] drm/i915: Avoid circular locking dependency when flush delayed work on gt reset Zhanjun Dong
2023-08-11 18:20 ` Zhanjun Dong
2023-08-11 19:15 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Avoid circular locking dependency when flush delayed work on gt reset (rev5) Patchwork
2023-08-11 19:15 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-11 19:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-08-21 14:09 ` [Intel-gfx] [PATCH v5] drm/i915: Avoid circular locking dependency when flush delayed work on gt reset Andi Shyti
2023-08-21 14:09   ` Andi Shyti
2023-08-22 13:50 ` [Intel-gfx] " Daniel Vetter
2023-08-22 13:50   ` Daniel Vetter
2023-08-22 14:14   ` [Intel-gfx] " Dong, Zhanjun
2023-08-22 14:14     ` Dong, Zhanjun
2023-08-22 14:28     ` [Intel-gfx] " Daniel Vetter
2023-08-22 14:28       ` Daniel Vetter
2023-08-22 18:53 ` [Intel-gfx] " John Harrison
2023-08-22 18:53   ` John Harrison
2023-08-23 16:00   ` [Intel-gfx] " Daniel Vetter
2023-08-23 16:00     ` Daniel Vetter
2023-08-23 17:37     ` [Intel-gfx] " John Harrison
2023-08-23 17:37       ` John Harrison
2023-08-28 23:01       ` [Intel-gfx] " John Harrison
2023-09-06  6:50         ` Daniel Vetter
2023-09-06  6:50           ` Daniel Vetter
2023-09-06 18:40           ` John Harrison
2023-08-31 14:00       ` Andi Shyti
2023-08-31 14:00         ` Andi Shyti
2023-08-31 22:27         ` [Intel-gfx] " John Harrison
2023-08-31 22:27           ` John Harrison
2023-09-06  9:17           ` [Intel-gfx] " Andi Shyti
2023-09-06  9:17             ` Andi Shyti
2023-09-06 10:04             ` [Intel-gfx] " Jani Nikula
2023-09-06 10:04               ` Jani Nikula
2023-09-06 11:02               ` Daniel Vetter
2023-09-06 11:02                 ` Daniel Vetter
2023-09-06 18:49             ` John Harrison
2023-09-06 18:49               ` John Harrison
2023-08-29 10:11   ` [Intel-gfx] " Andi Shyti
2023-08-29 10:11     ` Andi Shyti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.