Commit 865fbc0f authored by Umesh Nerlige Ramappa's avatar Umesh Nerlige Ramappa Committed by Tvrtko Ursulin

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: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211120014201.26480-1-umesh.nerlige.ramappa@intel.com
parent 267c3363
...@@ -1251,12 +1251,15 @@ static void __update_guc_busyness_stats(struct intel_guc *guc) ...@@ -1251,12 +1251,15 @@ static void __update_guc_busyness_stats(struct intel_guc *guc)
struct intel_gt *gt = guc_to_gt(guc); struct intel_gt *gt = guc_to_gt(guc);
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
enum intel_engine_id id; enum intel_engine_id id;
unsigned long flags;
ktime_t unused; ktime_t unused;
spin_lock_irqsave(&guc->timestamp.lock, flags);
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
guc_update_pm_timestamp(guc, engine, &unused); guc_update_pm_timestamp(guc, engine, &unused);
guc_update_engine_gt_clks(engine); guc_update_engine_gt_clks(engine);
} }
spin_unlock_irqrestore(&guc->timestamp.lock, flags);
} }
static void guc_timestamp_ping(struct work_struct *wrk) static void guc_timestamp_ping(struct work_struct *wrk)
...@@ -1266,7 +1269,6 @@ 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_uc *uc = container_of(guc, typeof(*uc), guc);
struct intel_gt *gt = guc_to_gt(guc); struct intel_gt *gt = guc_to_gt(guc);
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
unsigned long flags;
int srcu, ret; int srcu, ret;
/* /*
...@@ -1277,13 +1279,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) ...@@ -1277,13 +1279,9 @@ static void guc_timestamp_ping(struct work_struct *wrk)
if (ret) if (ret)
return; return;
spin_lock_irqsave(&guc->timestamp.lock, flags);
with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref) with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
__update_guc_busyness_stats(guc); __update_guc_busyness_stats(guc);
spin_unlock_irqrestore(&guc->timestamp.lock, flags);
intel_gt_reset_unlock(gt, srcu); intel_gt_reset_unlock(gt, srcu);
mod_delayed_work(system_highpri_wq, &guc->timestamp.work, mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
...@@ -1322,16 +1320,12 @@ static void guc_init_engine_stats(struct intel_guc *guc) ...@@ -1322,16 +1320,12 @@ static void guc_init_engine_stats(struct intel_guc *guc)
void intel_guc_busyness_park(struct intel_gt *gt) void intel_guc_busyness_park(struct intel_gt *gt)
{ {
struct intel_guc *guc = &gt->uc.guc; struct intel_guc *guc = &gt->uc.guc;
unsigned long flags;
if (!guc_submission_initialized(guc)) if (!guc_submission_initialized(guc))
return; return;
cancel_delayed_work(&guc->timestamp.work); cancel_delayed_work(&guc->timestamp.work);
spin_lock_irqsave(&guc->timestamp.lock, flags);
__update_guc_busyness_stats(guc); __update_guc_busyness_stats(guc);
spin_unlock_irqrestore(&guc->timestamp.lock, flags);
} }
void intel_guc_busyness_unpark(struct intel_gt *gt) void intel_guc_busyness_unpark(struct intel_gt *gt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment