Why is link power management policy [ICODE]med_power_with_dipm[/ICODE]?

duncandoo

Cadet
Joined
Mar 5, 2022
Messages
9
cat /sys/class/scsi_host/host0/link_power_management_policy shows that med_power_with_dipm is the default setting in TrueNAS SCALE. I'm guessing this is inherited from Debian. This setting is for a feature called link power management, which seems to be closely related to agressive link power management, and controls the power sent to the SCSI host controllers. It is distinct from the advanced power management, that controls how the disks attached to the SCSI controller behave. This page, for Archlinux, suggests the purpose of this setting is to save power when the disks are idle, about 1-1.5W, and this manpage, from Debian, suggests it is a useful setting to change according to whether a laptop is plugged into mains power or not. There are also hints that this setting might cause some HDDs trouble, and this is indeed the problem I've been having and seems also to be experienced by @polakkenak here and is described here.

I have been having this problem of zpool write errors appearing since I built the system; I've never got out of testing. ASRock have been great, and replaced the motherboard as the inital indications pointed to a faulty SATA connector. The replacement had the same problem. I couldn't replicate the problem in either Proxmox or Windows on the same hardware. They sent me a specific BIOS to try, which didn't help. Then I accidentally stumbled into @polakkenak 's post which pointed me to this setting. I have changed mine to medium_power and have no more instances of write errors.

So, going back to the question. Why is this the default setting in TrueNAS SCALE? Saving 1-1.5W when HDDs are idle seems like a trivial saving, especially when the recommended settings for HDDs seem to be that APM is turned off. TrueNAS SCALE is not designed to run on a laptop, so running on battery power is irrelevant, and there is potential to cause problems. What is the advantage of this setting? Is this a deliberate choice of TrueNAS or just inherited from generic Debian where it may be a sensible default setting?

And finally, does this setting really solve the problem, or am I just covering up some deeper badness? And what is the best way to get this setting to 'stick' on reboot if there are those that need to change it: there isn't any GUI setting for it? Is the solution suggested in the minisforum discussion the best/only way?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Most likely this is inherited from upstream Debian. This power setting is for PCI-E ASPM link state power management. To make this sticky between reboots:
  • From shell, midclt call system.advanced.update '{ "kernel_extra_options": "pcie_aspm=off" }'
  • Reboot
 

duncandoo

Cadet
Joined
Mar 5, 2022
Messages
9
I'm sorry to report that doesn't work for me. I ran the suggested midclt ... command. Reboot so now I've got pcie_aspm=off and med_power_with_dipm. The write errors recur. Change to medium_power and the errors don't recur.
 

freqlabs

iXsystems
iXsystems
Joined
Jul 18, 2019
Messages
50
Indeed this is a kernel config option Debian sets, though it only applies for mobile chipsets. We'll change it to max_performance to match non-mobile chipsets for the 22.12 release.
 
Top