You are not logged in.

#1 2015-10-09 11:13:18

barchiesi
Member
Registered: 2011-11-04
Posts: 15

Writing values so /sys on boot

Hello. I just ran powertop and it show me a bunch of values I should have set at boot. To be precise I get the following output:

echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host5/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';
echo 'auto' > '/sys/bus/usb/devices/1-1.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.6/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';

The first one I can set the module option and everything is fine. I though about /etc/tmpfiles.d for the others, but a warning on the archwiki tells me that I shouldn't use tmpfiles for /sys.

What would be the correct way of applying these on boot?

Last edited by barchiesi (2015-10-09 11:25:38)

Offline

#2 2015-10-09 11:27:08

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Writing values so /sys on boot

Interesting question, but couldn't you just run 'powertop --auto-tune' in some login script?


1000

Offline

#3 2015-10-09 11:28:23

barchiesi
Member
Registered: 2011-11-04
Posts: 15

Re: Writing values so /sys on boot

byte wrote:

Interesting question, but couldn't you just run 'powertop --auto-tune' in some login script?

I probably could,  but I would prefer doing it the proper way.

Offline

#4 2015-10-09 11:35:21

barchiesi
Member
Registered: 2011-11-04
Posts: 15

Re: Writing values so /sys on boot

I actually just realized that

Note: This method may not work to set options in /sys since the systemd-tmpfiles-setup service may run before the appropriate device modules is loaded. In this case you could check whether the module has a parameter for the option you want to set with modinfo module and set this option with a config file in /etc/modprobe.d. Otherwise you will have to write a udev rule to set the appropriate attribute as soon as the device appears.

Might only refer to kernel modules, would

/sys/bus/pci/devices

and

/sys/class/scsi_host/

refer to modules?

Offline

Board footer

Powered by FluxBB