On Fri, Aug 22, 2025 at 02:34:54PM +0200, Niklas Cassel wrote: (snip) > But do we really want a introduce a module parameter for this? > I know that commit 4edf1505b76d ("ata: ahci: Disallow LPM policy control for > external ports") > if external, both: > 1) sets initial lpm policy to MAX_POWER (so that hot plug works by default) > 2) sets ATA_FLAG_NO_LPM, so that you cannot change the LPM policy using sysfs > > I think that 1) is good. > > However, why should we forbid the user to override to policy via sysfs just > because the port is external? > If a system admin has installed a udev rule or similar to set a lpm policy, > why should we not respect that? > > Yes, I know that many distros supply a rule that just enables LPM > unconditionally for all disks... > > But... instead of forbidding the user to change to policy using sysfs, perhaps > a better way would be for the system admin/distros to improve their udev rules? > > We have a sysfs property that says if the port supports LPM. > Perhaps we should have a sysfs attribute that says if the port is external. > > The udev rules can then be smarter and just set the LPM policy if the port is > not external. But the user would still have the option to set a LPM policy > (using the same interface), if they don't care about hotplug. > > It seems more user friendly for a user that has a laptop with a docking > station with hotplug capable ports, to install a udev rule to set an LPM > policy, than to set a kernel module param. > > What do you think? Another idea: perhaps we could add something like: "hotplug_supported" and "hotplug_enable" to sysfs. For ports marked as external/hotplug capable, we set "hotplug_supported" to true, and for ports that support hotplug, we set "hotplug_enable" to true by default. We can then continue to disallow (return -EOPNOTSUPP) when the user tries to write to /sys/class/scsi_host/hostX/link_power_management_policy for a port that has "hotplug_enable" == true. If a user sets "hotplug_enable" = false, we allow writing to /sys/class/scsi_host/hostX/link_power_management_policy What do you think? Better or worse idea? Kind regards, Niklas