diff options
author | Umesh Nerlige Ramappa | 2021-11-19 17:42:01 -0800 |
---|---|---|
committer | Tvrtko Ursulin | 2021-11-22 09:16:32 +0000 |
commit | 865fbc0f8dc21e17dc3ad9f0f1ebf00a6696b2ca (patch) | |
tree | bf71bc3c71e16992bb70e5365154a1a40c2ef229 | |
parent | 267c336349db0e624d217f9762bcc1da414f4b0a (diff) |
drm/i915/pmu: Avoid with_intel_runtime_pm within spinlock
When guc timestamp ping worker runs it takes the spinlock and calls
with_intel_runtime_pm. Since with_intel_runtime_pm may sleep, move the
spinlock inside __update_guc_busyness_stats.
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211120014201.26480-1-umesh.nerlige.ramappa@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 12 |
1 files changed, 3 insertions, 9 deletions
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 77fbcd8730ee..a7108b38973e 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -1251,12 +1251,15 @@ static void __update_guc_busyness_stats(struct intel_guc *guc) struct intel_gt *gt = guc_to_gt(guc); struct intel_engine_cs *engine; enum intel_engine_id id; + unsigned long flags; ktime_t unused; + spin_lock_irqsave(&guc->timestamp.lock, flags); for_each_engine(engine, gt, id) { guc_update_pm_timestamp(guc, engine, &unused); guc_update_engine_gt_clks(engine); } + spin_unlock_irqrestore(&guc->timestamp.lock, flags); } static void guc_timestamp_ping(struct work_struct *wrk) @@ -1266,7 +1269,6 @@ static void guc_timestamp_ping(struct work_struct *wrk) struct intel_uc *uc = container_of(guc, typeof(*uc), guc); struct intel_gt *gt = guc_to_gt(guc); intel_wakeref_t wakeref; - unsigned long flags; int srcu, ret; /* @@ -1277,13 +1279,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) if (ret) return; - spin_lock_irqsave(&guc->timestamp.lock, flags); - with_intel_runtime_pm(>->i915->runtime_pm, wakeref) __update_guc_busyness_stats(guc); - spin_unlock_irqrestore(&guc->timestamp.lock, flags); - intel_gt_reset_unlock(gt, srcu); mod_delayed_work(system_highpri_wq, &guc->timestamp.work, @@ -1322,16 +1320,12 @@ static void guc_init_engine_stats(struct intel_guc *guc) void intel_guc_busyness_park(struct intel_gt *gt) { struct intel_guc *guc = >->uc.guc; - unsigned long flags; if (!guc_submission_initialized(guc)) return; cancel_delayed_work(&guc->timestamp.work); - - spin_lock_irqsave(&guc->timestamp.lock, flags); __update_guc_busyness_stats(guc); - spin_unlock_irqrestore(&guc->timestamp.lock, flags); } void intel_guc_busyness_unpark(struct intel_gt *gt) |