Bug 1246992

Summary: tuned doesnt honor devices specified when setting alpm policy
Product: [Fedora] Fedora Reporter: davestux
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: jskarvad, jv+fedora, pknirsch, twoerner
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.7.0-2.fc24 tuned-2.7.0-2.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 18:51:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description davestux 2015-07-27 06:37:27 UTC
Description of problem:
When setting devices=sda, alpm=medium_power all hard drives will be set to medium_power. This is true even when setting devices=/dev/sda,!sdb. 
When setting more than one policy, specifying different devices, the last setting applied to all the devices. 


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


How reproducible:
Configure a tuned.conf profile on machine with more than one hard drive.

Steps to Reproduce:
1. create tuned.conf profile with the following setting:
[systemdisk]
# Comma separated list of devices, all devices if commented out.
# devices=sda
devices=sdb
type=disk
replace=0
alpm=max_performance

[datadisk]
devices=sda, sdd
type=disk
replace=0
alpm=medium_power

2.assign the profile, restart the service
3.check the alpm policy set with - 
cat /sys/class/scsi_host/host*/link_power_management_policy
Actual results:
All drives are set to medium_power

Expected results:
sdb should be set max_performance, only sda and sdd should be set medium_power.

Additional info:

Comment 1 Jaroslav Škarvada 2015-07-27 14:59:46 UTC
Yup, this is currently not supported. IIRC it can be set per SCSI adapter number, not per disk. I will investigate, but I am afraid it will be not possible to map it 1:1.

Comment 2 Jaroslav Škarvada 2015-07-27 15:16:33 UTC
It could try to find out which adapter the disk is connected to and configure this adapter.

In case there are more disks connected to the same adapter, the policy which was set as the last will persist.

Comment 3 davestux 2015-07-27 15:22:43 UTC
The comments in my conf file are copied from the example in the default conf file (the balanced profile), so if it isn't supported it might be better to clarify it in the comment. 

It does somewhat disappointing. I guess I can use the script plugin for configuring it. Any chance it will be supported in the future?

Comment 4 Jaroslav Škarvada 2015-07-27 15:31:53 UTC
(In reply to davestux from comment #3)
> The comments in my conf file are copied from the example in the default conf
> file (the balanced profile), so if it isn't supported it might be better to
> clarify it in the comment. 
>
It needs reference guide. Hopefully I will write something for f23.

> It does somewhat disappointing. I guess I can use the script plugin for
> configuring it. Any chance it will be supported in the future?
>
I will try to implement it according to comment 2. Hopefully it will get into tuned-2.5.1 (scheduled for upstream release this week).

Comment 5 davestux 2015-07-27 17:17:35 UTC
(In reply to Jaroslav Škarvada from comment #4)
> (In reply to davestux from comment #3)
> > The comments in my conf file are copied from the example in the default conf
> > file (the balanced profile), so if it isn't supported it might be better to
> > clarify it in the comment. 
> >
> It needs reference guide. Hopefully I will write something for f23.
That reminded me where I got the idea in the first place:
http://docs.fedoraproject.org/en-US/Fedora/20/html/Power_Management_Guide/sect-tuned-custom-profiles.html
Does the limitation of one configuration per adapter specific to alpm policy?

> 
> > It does somewhat disappointing. I guess I can use the script plugin for
> > configuring it. Any chance it will be supported in the future?
> >
> I will try to implement it according to comment 2. Hopefully it will get
> into tuned-2.5.1 (scheduled for upstream release this week).
If a policy can only be set for adapters, I suggest implementing the setting with reference to the adapter and not to the disk device. Configuration that are stated by the /dev/sd? notation often leads to unintended results when disks are added or removed from the system and the drives change their names.

Comment 6 Jaroslav Škarvada 2015-07-28 08:54:14 UTC
(In reply to davestux from comment #5)
> (In reply to Jaroslav Škarvada from comment #4)
> > (In reply to davestux from comment #3)
> > > The comments in my conf file are copied from the example in the default conf
> > > file (the balanced profile), so if it isn't supported it might be better to
> > > clarify it in the comment. 
> > >
> > It needs reference guide. Hopefully I will write something for f23.
> That reminded me where I got the idea in the first place:
> http://docs.fedoraproject.org/en-US/Fedora/20/html/Power_Management_Guide/
> sect-tuned-custom-profiles.html
> Does the limitation of one configuration per adapter specific to alpm policy?
>
Yes, other 'disk' tunings should be disk specific, ALPM is an exception.

> > 
> > > It does somewhat disappointing. I guess I can use the script plugin for
> > > configuring it. Any chance it will be supported in the future?
> > >
> > I will try to implement it according to comment 2. Hopefully it will get
> > into tuned-2.5.1 (scheduled for upstream release this week).
> If a policy can only be set for adapters, I suggest implementing the setting
> with reference to the adapter and not to the disk device. Configuration that
> are stated by the /dev/sd? notation often leads to unintended results when
> disks are added or removed from the system and the drives change their names.
>
OK, this is better approach. I will add 'scsi' or 'sata' plugin (not yet sure about it) and move the ALPM setting there. It will be possible to match the specific adapter by using "device=hostN". It will not get into tuned-2.5.1, but it will be released later.

Comment 7 davestux 2015-07-29 18:18:15 UTC
OK, not the answer I hoped for, but I understand that there are technical constraints. 
Thank you for the quick response and for your efforts!

Comment 8 Jaroslav Škarvada 2015-08-24 14:18:02 UTC
Fixed by following upstream commit:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=b6ad363186e4cfcce60cbcfc3d984e1fb016aca3

Comment 9 davestux 2015-09-04 11:45:06 UTC
Thank you for putting the effort into it, I really appreciate it.
If I understand correctly, in the case of SATA disks the new version will make it possible to set different setting per disk since each disk connection is recognized as a scsi host?

I understand that this commit will be available only on Fedora 23?

Comment 10 Jaroslav Škarvada 2015-09-04 15:21:00 UTC
(In reply to davestux from comment #9)
> Thank you for putting the effort into it, I really appreciate it.
> If I understand correctly, in the case of SATA disks the new version will
> make it possible to set different setting per disk since each disk
> connection is recognized as a scsi host?
>
It seems so. On all my systems internal SATA disks maps 1:1 to scsi_hosts. But I am not sure whether you can rely on it. Maybe it's good question for kernel mailing list. What I am currently sure is that PATA IDE disks, SCSI disks, and USB disks needn't map 1:1.

> I understand that this commit will be available only on Fedora 23?

It will be available in next tuned release. I am currently not 100% sure whether I will push it into all stable Fedora releases. But I will probably do. The chance it would break anybody is low. In the worst case the ALPM tuned functionality will stop working for users with custom profiles, but anyhow it haven't been working correctly so far, thus it's probably not an issue blocking the rebase.

Comment 11 Fedora Update System 2016-07-19 14:10:43 UTC
tuned-2.7.0-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-327cccfbae

Comment 12 Fedora Update System 2016-07-19 14:13:27 UTC
tuned-2.7.0-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-122381bf6f

Comment 13 Fedora End Of Life 2016-07-19 17:11:56 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 14 Fedora Update System 2016-07-20 01:49:04 UTC
tuned-2.7.0-1.fc23 has been pushed to the Fedora 23 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-2016-122381bf6f

Comment 15 Fedora Update System 2016-07-20 01:53:08 UTC
tuned-2.7.0-1.fc24 has been pushed to the Fedora 24 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-2016-327cccfbae

Comment 16 Fedora Update System 2016-07-21 15:54:27 UTC
tuned-2.7.0-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f2b0ad383e

Comment 17 Fedora Update System 2016-07-21 15:55:11 UTC
tuned-2.7.0-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3acc8e3722

Comment 18 Fedora Update System 2016-07-22 19:21:54 UTC
tuned-2.7.0-2.fc23 has been pushed to the Fedora 23 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-2016-3acc8e3722

Comment 19 Fedora Update System 2016-07-22 19:21:58 UTC
tuned-2.7.0-2.fc24 has been pushed to the Fedora 24 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-2016-f2b0ad383e

Comment 20 Fedora Update System 2016-07-27 18:51:29 UTC
tuned-2.7.0-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2016-08-01 18:53:17 UTC
tuned-2.7.0-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.