All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-ide@vger.kernel.org, Dieter Mummenschanz <dmummenschanz@web.de>
Subject: Re: [PATCH v2] ata: ahci: Allow ignoring the external/hotplug capability of ports
Date: Fri, 22 Aug 2025 16:49:49 +0200	[thread overview]
Message-ID: <aKiDjVODoAN2z46C@ryzen> (raw)
In-Reply-To: <aKhj7prAFmQ9U95z@ryzen>

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

  reply	other threads:[~2025-08-22 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  8:06 [PATCH v2] ata: ahci: Allow ignoring the external/hotplug capability of ports Damien Le Moal
2025-08-22 12:34 ` Niklas Cassel
2025-08-22 14:49   ` Niklas Cassel [this message]
2025-08-25  2:04     ` Damien Le Moal
2025-08-25  2:36   ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKiDjVODoAN2z46C@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dmummenschanz@web.de \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.