You are not logged in.

#1 2020-05-06 11:11:14

rubenvb
Member
Registered: 2011-01-14
Posts: 104

PCI udev powersaving rule not working for specific devices

I have set up the following udev rule as described in the Arch Wiki:

SUBSYSTEM=="pci", ATTR{power/control}="auto"

It works for some PCI devices, but not all (snipped output of the "Tunables" tab in Powertop):

   Bad           Runtime PM for port ata1 of PCI device: Marvell Technology Group Ltd. Device 9215
   Bad           Runtime PM for port ata3 of PCI device: Marvell Technology Group Ltd. Device 9215
   Bad           Runtime PM for port ata4 of PCI device: Marvell Technology Group Ltd. Device 9215
   Bad           Runtime PM for port ata2 of PCI device: Marvell Technology Group Ltd. Device 9215
   Good          Runtime PM for PCI Device Marvell Technology Group Ltd. Device 9215
   Good          Runtime PM for PCI Device Fuzhou Rockchip Electronics Co., Ltd RK3399 PCI Express Root Port

The rule seems to match these controls:

/sys/bus/pci/devices/0000:01:00.0/power/control
/sys/bus/pci/devices/0000:00:00.0/power/control

But not these

/sys/bus/pci/devices/0000:01:00.0/ata1/power/control
/sys/bus/pci/devices/0000:01:00.0/ata2/power/control
/sys/bus/pci/devices/0000:01:00.0/ata3/power/control
/sys/bus/pci/devices/0000:01:00.0/ata4/power/control

I have tried any of these additional rules, but none of them seem to work:

SUBSYSTEM=="pci", ATTR{ata*/power/control}="auto"
SUBSYSTEM=="pci", ATTR{ata1/power/control}="auto"
SUBSYSTEM=="pci", ATTR{ata2/power/control}="auto"
SUBSYSTEM=="pci", ATTR{ata3/power/control}="auto"
SUBSYSTEM=="pci", ATTR{ata4/power/control}="auto"
SUBSYSTEM=="pci", ATTR{ata[1-4]/power/control}="auto"

For the above, relading udev gets me this log output:

systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:3 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata*/power/control}, ignoring: No such file or directory
systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:4 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata1/power/control}, ignoring: No such file or directory
systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:5 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata2/power/control}, ignoring: No such file or directory
systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:6 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata3/power/control}, ignoring: No such file or directory
systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:7 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata4/power/control}, ignoring: No such file or directory
systemd-udevd[57157]: 0000:00:00.0: /etc/udev/rules.d/pci_pm.rules:8 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/ata[1-4]/power/control}, ignoring: No such file or directory
systemd-udevd[57163]: 0000:01:00.0: /etc/udev/rules.d/pci_pm.rules:3 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/ata*/power/control}, ignoring: No such file or directory
systemd-udevd[57163]: 0000:01:00.0: /etc/udev/rules.d/pci_pm.rules:8 Failed to write ATTR{/sys/devices/platform/f8000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/ata[1-4]/power/control}, ignoring: No such file or directory

and doesn't change the ata[1-4]/power/control values to "auto".

What udev rule do I need to match the above devices without spamming the log with unrelated devices?

Offline

#2 2020-05-06 13:55:15

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: PCI udev powersaving rule not working for specific devices

You are currently using this rule here for searching/matching the stuff you are interested in:

SUBSYSTEM=="pci"

Perhaps try something else. You can inspect a device using "udevadm info" and "udevadm info -a" to see what kind of interesting attributes you have available. For me here for example:

$ udevadm info -a /sys/class/ata_port/ata1
...
  looking at device '/devices/pci0000:00/0000:00:01.3/0000:01:00.1/ata1/ata_port/ata1':
    KERNEL=="ata1"
    SUBSYSTEM=="ata_port"
    DRIVER==""
    ATTR{nr_pmp_links}=="0"
    ATTR{port_no}=="1"
    ATTR{idle_irq}=="0"
...

I would then try using something like this for matching:

SUBSYSTEM=="ata_port", KERNEL=="ata*"

That "KERNEL==..." is maybe not needed.

In the udevadm-info output earlier, you could see that udevadm said the path for this is "/devices/pci0000:00/0000:00:01.3/0000:01:00.1/ata1/ata_port/ata1". If I check what's in that path here with "ls", I can see there is a "power" sub-folder there, so I'm then guessing writing into "ATTR{power/control}" will work for that match.

Offline

Board footer

Powered by FluxBB