Commit eda79642 authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Use the real cpu max frequency for ring scaling

The policy's max frequency is not equal to the CPU's max frequency. The
ring frequency is derived from the CPU frequency, and not the policy
frequency.

One example of how this may differ through sysfs. If the sysfs max
frequency is modified, that will be used for the max ring frequency
calculation.
(/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq). As far as I
know, no current governor uses anything but max as the default, but in
theory, they could. Similarly distributions might set policy as part of
their init process.

It's ideal to use the real frequency because when we're currently scaled
up on the GPU. In this case we likely want to race to idle, and using a
less than max ring frequency is non-optimal for this situation.

AFAIK, this patch should have no impact on a majority of people.

This behavior hasn't been changed since it was first introduced:
commit 23b2f8bb
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Jun 28 13:04:16 2011 -0700

    drm/i915: load a ring frequency scaling table v3

CC: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0fc9f599
...@@ -3740,16 +3740,21 @@ void gen6_update_ring_freq(struct drm_device *dev) ...@@ -3740,16 +3740,21 @@ void gen6_update_ring_freq(struct drm_device *dev)
unsigned int gpu_freq; unsigned int gpu_freq;
unsigned int max_ia_freq, min_ring_freq; unsigned int max_ia_freq, min_ring_freq;
int scaling_factor = 180; int scaling_factor = 180;
struct cpufreq_policy *policy;
WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
max_ia_freq = cpufreq_quick_get_max(0); policy = cpufreq_cpu_get(0);
/* if (policy) {
* Default to measured freq if none found, PCU will ensure we don't go max_ia_freq = policy->cpuinfo.max_freq;
* over cpufreq_cpu_put(policy);
*/ } else {
if (!max_ia_freq) /*
* Default to measured freq if none found, PCU will ensure we
* don't go over
*/
max_ia_freq = tsc_khz; max_ia_freq = tsc_khz;
}
/* Convert from kHz to MHz */ /* Convert from kHz to MHz */
max_ia_freq /= 1000; max_ia_freq /= 1000;
......
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