Skip to content

Commit 936b73f

Browse files
vsbelgaumjnikula
authored andcommitted
drm/i915/slpc: Balance the inc/dec for num_waiters
As seen in some recent failures, SLPC num_waiters value is < 0. This happens because the inc/dec are not balanced. We should skip decrement for the same conditions as the increment. Currently, we do that for power saving profile mode. This patch also ensures that num_waiters is incremented in the case min_softlimit is at boost freq. It ensures that we don't reduce the frequency while this request is in flight. v2: Add Fixes tags Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13598 Fixes: f864a29 ("drm/i915/slpc: Optmize waitboost for SLPC") Fixes: 4a82ceb ("drm/i915/slpc: Add sysfs for SLPC power profiles") Cc: Sk Anirban <sk.anirban@intel.com> Reviewed-by: Sk Anirban <sk.anirban@intel.com> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Link: https://lore.kernel.org/r/20250428183555.3250021-1-vinay.belgaumkar@intel.com (cherry picked from commit d26e550) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 92a09c4 commit 936b73f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/gpu/drm/i915/gt/intel_rps.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,10 @@ void intel_rps_dec_waiters(struct intel_rps *rps)
10011001
if (rps_uses_slpc(rps)) {
10021002
slpc = rps_to_slpc(rps);
10031003

1004+
/* Don't decrement num_waiters for req where increment was skipped */
1005+
if (slpc->power_profile == SLPC_POWER_PROFILES_POWER_SAVING)
1006+
return;
1007+
10041008
intel_guc_slpc_dec_waiters(slpc);
10051009
} else {
10061010
atomic_dec(&rps->num_waiters);
@@ -1029,11 +1033,15 @@ void intel_rps_boost(struct i915_request *rq)
10291033
if (slpc->power_profile == SLPC_POWER_PROFILES_POWER_SAVING)
10301034
return;
10311035

1032-
if (slpc->min_freq_softlimit >= slpc->boost_freq)
1033-
return;
1034-
10351036
/* Return if old value is non zero */
10361037
if (!atomic_fetch_inc(&slpc->num_waiters)) {
1038+
/*
1039+
* Skip queuing boost work if frequency is already boosted,
1040+
* but still increment num_waiters.
1041+
*/
1042+
if (slpc->min_freq_softlimit >= slpc->boost_freq)
1043+
return;
1044+
10371045
GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",
10381046
rq->fence.context, rq->fence.seqno);
10391047
queue_work(rps_to_gt(rps)->i915->unordered_wq,

0 commit comments

Comments
 (0)