Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1417659 - radeon_powersave config in video plugin is outdated
radeon_powersave config in video plugin is outdated
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: tuned (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
: Patch, Upstream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-30 10:03 EST by Oliver Henshaw
Modified: 2017-10-30 05:51 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-10-30 05:51:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Oliver Henshaw 2017-01-30 10:03:01 EST
Description of problem:

The video power saving plugin sets the power_method "profile" which doesn't appear to be supported on this device. Furthermore tuned doesn't recognise the "dpm" power_method, i.e. the most modern method - see https://www.x.org/wiki/RadeonFeature/#index3h2 - and so presumably the best.


I use the balanced profile which has the stanza:

[video]
radeon_powersave=auto

From /usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.py it looks like this sets /sys/class/drm/$DEVICE/device/power_method to "profile" and /sys/class/drm/$DEVICE/device/power_profile to "auto".

But I see these messages in /var/log/tuned/tuned.log:

017-01-30 10:33:27,439 ERROR    tuned.utils.commands: Writing to file /sys/class/drm/card0/device/power_method error: [Errno 22] Invalid argument
2017-01-30 10:33:27,440 ERROR    tuned.utils.commands: Writing to file /sys/class/drm/card0/device/power_profile error: [Errno 22] Invalid argument


# cat /sys/class/drm/card0/device/power_method 
dpm

Furthermore it looks like usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.py does not recognise the default dpm power method.

I don't know why the profile power_method isn't supported. For this card it works out fine, but for devices/drivers that support both then tuned will select a sub-optimal power_method.


$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: X.Org (0x1002)
    Device: AMD KABINI (DRM 2.48.0 / 4.9.5-200.fc25.x86_64, LLVM 3.8.1) (0x9830)
    Version: 13.0.3
    Accelerated: yes
    Video memory: 512MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.1
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD KABINI (DRM 2.48.0 / 4.9.5-200.fc25.x86_64, LLVM 3.8.1)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 13.0.3
OpenGL core profile shading language version string: 4.10
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.0 Mesa 13.0.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 13.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00


Version-Release number of selected component (if applicable):

tuned-2.7.1-3.fc25.noarch
kernel-4.9.5-200.fc25.x86_64
Comment 1 Ondřej Lysoněk 2017-04-12 07:52:09 EDT
(In reply to Oliver Henshaw from comment #0)
> I don't know why the profile power_method isn't supported. For this card it
> works out fine, but for devices/drivers that support both then tuned will
> select a sub-optimal power_method.

Tuned by itself currently doesn't automatically select anything. The line 'radeon_powersave=auto' means, that tuned should set the power method to 'profile' and set the 'auto' profile, not that it should automatically select a power method.

I added support for the 'dpm' power method in the following pull request:
https://github.com/redhat-performance/tuned/pull/32

So now you can set 'radeon_powersave=dpm'.

The PR also adds support for the automatic selection of 'the best' power method (tuned tries 'dpm', and if that doesn't work, it sets the 'auto' profile). To use it, set 'radeon_powersave=best'.

Let's see if it gets merged in.

I did not test any of this, as I don't have a radeon card. So I'm leaving it up to you :).
Comment 2 Ondřej Lysoněk 2017-04-12 10:42:01 EDT
Here is a scratch build:
https://koji.fedoraproject.org/koji/taskinfo?taskID=18950966
Comment 3 Oliver Henshaw 2017-04-18 10:07:54 EDT
Not yet tested but had a look at the pull request and played around a little on the command line:

# cat /sys/class/drm/card0/device/power_method                                       
dpm
# echo dpm > /sys/class/drm/card0/device/power_method                              
-bash: echo: write error: Invalid argument

Re-reading https://www.x.org/wiki/RadeonFeature/#index3h2 I see '"dpm" support, must be selected at boot (via radeon.dpm=1)' (and I think it's now the default) - so I think the sysfs configuration is read-only when dpm is set.
Comment 4 Ondřej Lysoněk 2017-04-18 10:48:16 EDT
(In reply to Oliver Henshaw from comment #3)
> Re-reading https://www.x.org/wiki/RadeonFeature/#index3h2 I see '"dpm"
> support, must be selected at boot (via radeon.dpm=1)' (and I think it's now
> the default) - so I think the sysfs configuration is read-only when dpm is
> set.

Well, to me it sounds more like you have radeon.dpm disabled, and so the sysfs file doesn't recognize 'dpm' as a valid argument - hence the 'Invalid argument' message.

But it might as well be the way you're saying. Can you issue
$ sysctl radeon.dpm
to check if its enabled? Also, are you sure your card supports the dpm power method?
Comment 5 Ondřej Lysoněk 2017-04-18 10:50:59 EDT
Oh wait, I didn't notice the 'cat /sys/class/drm/card0/device/power_method' line :D. In that case, I guess there's a kernel bug - the 'Invalid argument' error message doesn't make sense.
Comment 6 Ondřej Lysoněk 2017-04-18 10:58:09 EDT
Can you maybe try echoing 'profile' to the file, so we know it doesn't return EINVAL when the current and the requested setting are the same?
Comment 7 Oliver Henshaw 2017-04-18 12:21:16 EDT
# echo profile > /sys/class/drm/card0/device/power_method 
-bash: echo: write error: Invalid argument
# cat /sys/class/drm/card0/device/driver/module/holders/radeon/parameters/dpm 
-1
# ls /sys/class/drm/card0/device/power_dpm*
/sys/class/drm/card0/device/power_dpm_force_performance_level
/sys/class/drm/card0/device/power_dpm_state

From https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/radeon/radeon_pm.c#L421 onwards (radeon_set_pm_method, radeon_get_dpm_state, radeon_set_dpm_state) it looks like power_method is supposed to be read-only when dpm is set and further customisation is available via /sys/class/drm/cardX/device/power_dpm_state

I'm not sure where it's documented upstream but arch has a write-up at https://wiki.archlinux.org/index.php/ATI#Dynamic_power_management


radeon.dpm defaults to -1 if not set - which means auto, which I think means the card-dependent default. On an older r600 system, /sys/class/drm/card0/device/driver/module/holders/radeon/parameters/dpm  is still -1 but /sys/class/drm/card0/device/power_method is profile and the /sys/class/drm/card0/device/power_dpm* entries do not exist.
Comment 8 Ondřej Lysoněk 2017-04-21 09:06:06 EDT
Right, thanks for looking into it.

I rewrote the pull request to make tuned support changing the 'power_dpm_state' attribute through a new 'radeon_dpm_state' option. You can now remove the line
radeon_powersave=auto
from your configuration and replace it with something like
radeon_dpm_state=balanced

Or you can just not use the video plugin at all if you're not interested in changing the 'power_dpm_state' attribute. The dpm power method itself can be enabled using the sysctl plugin.

I think there's nothing else to do here. Agreed?
Comment 9 Jaroslav Škarvada 2017-09-20 07:53:37 EDT
Related pull request:
https://github.com/redhat-performance/tuned/pull/72/commits/f9f261e82015eba9d107a4060439a53897a43dd8

TLDR:

- remove the whole [video] section
- add:
[video]
radeon_powersave=dpm-balanced

Stock Tuned profiles have been updated to support it out of the box.
Comment 10 Fedora Update System 2017-10-13 10:19:57 EDT
tuned-2.9.0-0.1.rc1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df
Comment 11 Fedora Update System 2017-10-13 18:24:52 EDT
tuned-2.9.0-0.1.rc1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df
Comment 12 Fedora Update System 2017-10-13 19:24:41 EDT
tuned-2.9.0-0.1.rc1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5f0849d207
Comment 13 Fedora Update System 2017-10-29 17:06:16 EDT
tuned-2.9.0-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e45ce4685
Comment 14 Fedora Update System 2017-10-29 17:12:27 EDT
tuned-2.9.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c30e9bd1ea
Comment 15 Jaroslav Škarvada 2017-10-30 05:51:58 EDT
It should be fixed in f26 and up (tuned-2.9.0 and up), closing as next release.

Note You need to log in before you can comment on or make changes to this bug.