Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Kick the rps worker when changing the boost frequency

The boost frequency is only applied from the RPS worker while someone is
waiting on a request and requested a boost. As such, when the user
wishes to change the frequency, we have to kick the worker in order to
re-evaluate whether to apply the boost frequency.

v2: Check num_waiters to decide if we should kick the worker to handle
boosting.

Fixes: 29ecd78d3b79 ("drm/i915: Define a separate variable and control for RPS waitboost frequency")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180308142648.4016-1-chris@chris-wilson.co.uk
(cherry picked from commit 59cd31f177b34deb834a5c97478502741be1cf2e)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Chris Wilson and committed by
Rodrigo Vivi
f1430f14 82813ba9

+8 -2
+8 -2
drivers/gpu/drm/i915/i915_sysfs.c
··· 304 304 { 305 305 struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev); 306 306 struct intel_rps *rps = &dev_priv->gt_pm.rps; 307 - u32 val; 307 + bool boost = false; 308 308 ssize_t ret; 309 + u32 val; 309 310 310 311 ret = kstrtou32(buf, 0, &val); 311 312 if (ret) ··· 318 317 return -EINVAL; 319 318 320 319 mutex_lock(&dev_priv->pcu_lock); 321 - rps->boost_freq = val; 320 + if (val != rps->boost_freq) { 321 + rps->boost_freq = val; 322 + boost = atomic_read(&rps->num_waiters); 323 + } 322 324 mutex_unlock(&dev_priv->pcu_lock); 325 + if (boost) 326 + schedule_work(&rps->work); 323 327 324 328 return count; 325 329 }