drm/i915: enable deepest RC6 state
Subsystems (2)
PATCH 1/2 drm/i915: enable deepest RC6 state
This should allow even more energy saving when GPU is not in use. According to the testing, this state results in around 0.1 - 0.4 W better power usage.
No issues or regressions observed so far, but additional testing is certainly welcome.
--- drivers/gpu/drm/i915/intel_display.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -7924,6 +7924,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)if (i915_enable_rc6) rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | + GEN6_RC_CTL_RC6pp_ENABLE |GEN6_RC_CTL_RC6_ENABLE ; I915_WRITE(GEN6_RC_CONTROL,
Signature · 1 line
1.7.7.4
PATCH 2/2 drm/i915: add debugfs interface to control rc6 and rps
This allows to enable/disable rps and rc6 from userspace. This is necessary for to have predictable results from hardware counters, and also to provide a finer granularity over power control from userspace.
As an additional trick, we also change the value of i915_enable_rc6 by using this value, to allow the module to know the latest status of rc6 requested by user.
--- drivers/gpu/drm/i915/i915_debugfs.c | 101 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 3 + 3 files changed, 105 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +101 -0
@@ -1340,6 +1340,79 @@ static const struct file_operations i915_wedged_fops = { };static int +i915_enable_rc6_open (struct inode *inode, +struct file *filp) +{ + filp->private_data = inode->i_private; +return 0 ; +} + +static ssize_t +i915_enable_rc6_read (struct file *filp, +char __user *ubuf, +size_t max, +loff_t *ppos) +{ +char buf[80 ]; +int len; + + len =snprintf (buf,sizeof (buf), +"%d\n" , i915_enable_rc6); + +if (len >sizeof (buf)) + len =sizeof (buf); + +return simple_read_from_buffer (ubuf, max, ppos, buf, len); +} + +static ssize_t +i915_enable_rc6_write (struct file *filp, +const char __user *ubuf, +size_t cnt, +loff_t *ppos) +{ +struct drm_device *dev = filp->private_data; +struct drm_i915_private *dev_priv = dev->dev_private; +char buf[20 ]; +int val =-1 ; + +if (cnt >0 ) { +if (cnt >sizeof (buf) -1 ) +return -EINVAL ; + +if (copy_from_user (buf, ubuf, cnt)) +return -EFAULT ; + buf[cnt] =0 ; + + val =simple_strtol (buf,NULL ,0 ); + } + +if (INTEL_INFO (dev)->gen <5 ) +return cnt; + +DRM_DEBUG_DRIVER ("Manually setting rps and rc6 status to %d\n" , val); + i915_enable_rc6 = val; + +if (val ==0 ) { +if (IS_IRONLAKE_M (dev)) +ironlake_disable_rc6 (dev); +else { +gen6_disable_rps (dev); +gen6_update_ring_freq (dev_priv); + } + }else { +if (IS_IRONLAKE_M (dev)) +ironlake_disable_rc6 (dev); +else { +gen6_enable_rps (dev_priv); +gen6_update_ring_freq (dev_priv); + } + } + +return cnt; +} + +static int i915_max_freq_open (struct inode *inode,struct file *filp) {
@@ -1401,6 +1474,14 @@ i915_max_freq_write(struct file *filp,return cnt; } +static const struct file_operations i915_enable_rc6_fops = { + .owner =THIS_MODULE , + .open = i915_enable_rc6_open, + .read = i915_enable_rc6_read, + .write = i915_enable_rc6_write, + .llseek = default_llseek, +}; +static const struct file_operations i915_max_freq_fops = { .owner =THIS_MODULE , .open = i915_max_freq_open,
@@ -1605,6 +1686,21 @@ static int i915_max_freq_create(struct dentry *root, struct drm_minor *minor)return drm_add_fake_info_node (minor, ent, &i915_max_freq_fops); } +static int i915_enable_rc6_create (struct dentry *root,struct drm_minor *minor) +{ +struct drm_device *dev = minor->dev; +struct dentry *ent; + + ent =debugfs_create_file ("i915_enable_rc6" , +S_IRUGO |S_IWUSR , + root, dev, + &i915_enable_rc6_fops); +if (IS_ERR (ent)) +return PTR_ERR (ent); + +return drm_add_fake_info_node (minor, ent, &i915_enable_rc6_fops); +} +static int i915_cache_sharing_create (struct dentry *root,struct drm_minor *minor) {struct drm_device *dev = minor->dev;
@@ -1676,6 +1772,9 @@ int i915_debugfs_init(struct drm_minor *minor) ret =i915_max_freq_create (minor->debugfs_root, minor);if (ret)return ret; + ret =i915_enable_rc6_create (minor->debugfs_root, minor); +if (ret) +return ret; ret =i915_cache_sharing_create (minor->debugfs_root, minor);if (ret)return ret;
@@ -1695,6 +1794,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor) 1, minor);drm_debugfs_remove_files ((struct drm_info_list *) &i915_max_freq_fops,1 , minor); +drm_debugfs_remove_files ((struct drm_info_list *) &i915_enable_rc6_fops, +1 , minor);drm_debugfs_remove_files ((struct drm_info_list *) &i915_cache_sharing_fops,1 , minor); }
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -8311,7 +8311,7 @@ static void ironlake_teardown_rc6(struct drm_device *dev) } } -static void ironlake_disable_rc6 (struct drm_device *dev) +void ironlake_disable_rc6 (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -353,6 +353,9 @@ extern void gen6_update_ring_freq(struct drm_i915_private *dev_priv);extern void gen6_disable_rps (struct drm_device *dev);extern void intel_init_emon (struct drm_device *dev); +extern void ironlake_enable_rc6 (struct drm_device *dev); +extern void ironlake_disable_rc6 (struct drm_device *dev); +extern int intel_pin_and_fence_fb_obj (struct drm_device *dev,struct drm_i915_gem_object *obj,struct intel_ring_buffer *pipelined);
Signature · 1 line
1.7.7.4
Re: [PATCH 2/2] drm/i915: add debugfs interface to control rc6 and rps
Quoted 3 lines · Eugeni Dodonov
This allows to enable/disable rps and rc6 from userspace. This is necessary for to have predictable results from hardware counters, and also to provide a finer granularity over power control from userspace.
Reading registers and counters is handled with i915_forcewake_user. So the question is what benefit does htis give over module reload. It looks far riskier...
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 2/2] drm/i915: add debugfs interface to control rc6 and rps
Quoted 8 lines · Chris Wilson
Quoted 3 lines · Eugeni Dodonov
This allows to enable/disable rps and rc6 from userspace. This is necessary for to have predictable results from hardware counters, and also to provide a finer granularity over power control from userspace.
Reading registers and counters is handled with
i915_forcewake_user. So the question is what benefit does htis give over module reload. It looks far riskier...
The observation architecture bspec says that we need to disable rc6, otherwise we'll get garbage in the gpu perf counters. But imo I think this should be handled in the kernel (we neeed to write tons of funny registers to set things up anyway), at least for the time-based perf counter sampling. For prototyping things with intel_reg_write disabling rc6 at module load time seems sufficient to me.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH 2/2] drm/i915: add debugfs interface to control rc6 and rps
Quoted 12 lines · Daniel Vetter
Quoted 1 line · Chris Wilson
On Tue, 29 Nov 2011 10:55:05 -0200, Eugeni Dodonov <
Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
This allows to enable/disable rps and rc6 from userspace. This is necessary for to have predictable results from hardware counters, and
also
Quoted 5 lines
Quoted 1 line
to provide a finer granularity over power control from userspace.
Reading registers and counters is handled with
i915_forcewake_user. So the question is what benefit does htis give over module reload. It looks far riskier...
Quoted 7 lines
The observation architecture bspec says that we need to disable rc6, otherwise we'll get garbage in the gpu perf counters. But imo I think this should be handled in the kernel (we neeed to write tons of funny registers to set things up anyway), at least for the time-based perf counter sampling. For prototyping things with
intel_reg_writedisabling rc6 at module load time seems sufficient to me.
The major idea behind this was to provide additional facilities for controlling power and performance-related details of the driver from userspace, without module reloading or reboot.
Currently, both the GPU turbo and rc6/fbc operations are mostly autonomous, there is not much we can influence on their behavior without a reboot or module reload. So my idea was to have a way to toggle - and in some future, ideally, fine-tune their behavior from userspace during the execution. For GPU turbo, we can control it to some point from userspace via i915_max_freq. And with this patch, we could also control the rps/rc6 behavior to some point as well.
For the perf counters, I thought on the following flow of execution with this patch:
1. prev_val=$(cat /sys/kernel/debug/dri/0/i915_enable_rc6)
2. echo 0 > /sys/kernel/debug/dri/0/i915_enable_rc6
3. do the perf counters aquisition and testing
4. echo $(prev_val) > /sys/kernel/debug/dri/0/i915_enable_rc6
Comments?
Signature · 2 lines
Eugeni Dodonov <http://eugeni.dodonov.net/>
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: add debugfs interface to control rc6 and rps
Quoted 8 lines · Eugeni Dodonov
For the perf counters, I thought on the following flow of execution with this patch:
1. prev_val=$(cat/sys/kernel/debug/dri/0/i915_enable_rc6)
2. echo 0 >/sys/kernel/debug/dri/0/i915_enable_rc6
3. do the perf counters aquisition and testing
4. echo $(prev_val) >/sys/kernel/debug/dri/0/i915_enable_rc6Comments?
debugfs should never be ABI. Development and debug testing is one thing, but if we are serious about this, we need to start building an acceptable user interface elsewhere in /sys.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 6 lines · Eugeni Dodonov
This should allow even more energy saving when GPU is not in use. According to the testing, this state results in around 0.1 - 0.4 W better power usage.
No issues or regressions observed so far, but additional testing is certainly welcome.
The docs I saw said "not implemented; do not use". Do we have it on good authority that this is safe and useful to enable? And doesn't it require programming of more transition thresholds?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 5 lines · Chris Wilson
Quoted 4 lines · Eugeni Dodonov
This should allow even more energy saving when GPU is not in use. According to the testing, this state results in around 0.1 - 0.4 W better power usage.
Quoted 7 lines
Quoted 2 lines
No issues or regressions observed so far, but additional testing is certainly welcome.
The docs I saw said "not implemented; do not use". Do we have it on good authority that this is safe and useful to enable? And doesn't it require programming of more transition thresholds?
-Chris
Yes, I think we do have to program more stuff to make this work. Perhaps the BIOS puts in decent values for these registers though? We would have to restore those on reset and resume I'd guess. If BIOS doesn't use anything there, you probably aren't even entering these states.
Also, for posterity, there are 3 rc6 states, rc6, deep rc6, and deepest rc6. I think deepest rc6 was recommended to avoid (though I don't recall a specific root caused issue, just some data from Jesse, from the windows team that it didn't seem stable). And I think deepest rc6 is also referred to as rc7 sometimes.
IIRC, Jesse had patches for deep rc6, but it was very minimal performance gain. Someone should check if the windows driver uses it.
Ben
Quoted 21 lines · Ben Widawsky
Quoted 1 line · Chris Wilson
On Tue, 29 Nov 2011 10:55:04 -0200, Eugeni Dodonov <
Quoted 2 lines · [email protected]> wrote:
Quoted 2 lines
This should allow even more energy saving when GPU is not in use. According to the testing, this state results in around 0.1 - 0.4 W
better
Quoted 9 lines
Quoted 4 lines
power usage.
No issues or regressions observed so far, but additional testing is certainly welcome.
The docs I saw said "not implemented; do not use". Do we have it on good authority that this is safe and useful to enable? And doesn't it require programming of more transition thresholds?
-ChrisYes, I think we do have to program more stuff to make this work. Perhaps the BIOS puts in decent values for these registers though? We would have to restore those on reset and resume I'd guess. If BIOS doesn't use anything there, you probably aren't even entering these states.
Quoted 6 lines
Also, for posterity, there are 3 rc6 states, rc6, deep rc6, and deepest rc6. I think deepest rc6 was recommended to avoid (though I don't recall a specific root caused issue, just some data from Jesse, from the windows team that it didn't seem stable). And I think deepest rc6 is also referred to as rc7 sometimes.
We already setup the variables for both deep and deepest rc6 in our driver (GEN6_RC6p_* and GEN6_RC6pp_*), but we weren't using this additional state previously - if I understood the documentation and the code correctly, we do enable plain rc6 and deep rc6 currently. I haven't found any indications which would tell to avoid it in the latest docs, and I also haven't seen any regressions or issues with it being enabled on any of the machines, so I thought it would be worth trying that additional state as well.
Quoted 1 line
From the testing which QA did for this patch, looks like we save between
0.1 and 0.4W when compared to what we had with i915_enable_rc6=1.
But in any case, this is all highly experimental and I'll do more testing with it :).
Signature · 2 lines
Eugeni Dodonov <http://eugeni.dodonov.net/>
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx