public inbox for linux-ide@vger.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
Subject: Re: [PATCH 08/10] ata: ahci: Disallow LPM policy control if not supported
Date: Mon, 30 Jun 2025 17:07:59 +0200	[thread overview]
Message-ID: <aGKoT3acZI_EXU2x@ryzen> (raw)
In-Reply-To: <20250630062637.258329-9-dlemoal@kernel.org>

On Mon, Jun 30, 2025 at 03:26:35PM +0900, Damien Le Moal wrote:
> Commit fa997b0576c9 ("ata: ahci: Do not enable LPM if no LPM states are
> supported by the HBA") introduced an early return in
> ahci_update_initial_lpm_policy() to ensure that the target_lpm_policy
> of ports belonging to a host that does not support the Partial, Slumber
> and DevSleep power states is unchanged and remains set to
> ATA_LPM_UNKNOWN and thus prevents the execution of
> ata_eh_link_set_lpm().
> 
> However, a user or a system daemon (e.g. systemd-udevd) may still
> attempt changing the LPM policy through the sysfs
> link_power_management_policy of the host.
> 
> Improve this to prevent sysfs LPM policy changes by setting the flag
> ATA_FLOAG_NO_LPM for the port of such host, and initialize the port
> target_lpm_policy to ATA_LPM_MAX_POWER to guarantee that no unsupported
> low power state is being used on the port and its link.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/ahci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 34698ae39f55..737f5d1bde11 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1793,7 +1793,10 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
>  	if ((ap->host->flags & ATA_HOST_NO_PART) &&
>  	    (ap->host->flags & ATA_HOST_NO_SSC) &&
>  	    (ap->host->flags & ATA_HOST_NO_DEVSLP)) {
> -		ata_port_dbg(ap, "no LPM states supported, not enabling LPM\n");
> +		ata_port_warn(ap,
> +			"No LPM states supported, forcing LPM max_power\n");

Do we really want this to be a warning?

I don't think there is anything wrong with an HBA that does not support any
LPM states, so it seems a bit excessive to give a warning about it.

e.g. [PATCH 06/10] ata: ahci: Disable DIPM if host lacks support
was only a at_port_dbg().


Or, if you really want to keep this warning, then perhaps we should move this
if-statement
(and the ap->pflags & ATA_PFLAG_EXTERNAL if-statement)
below the

update_policy:

label

And change it to:

if (policy != ATA_LPM_MAX_POWER &&
   (ap->host->flags & ATA_HOST_NO_PART) &&
   (ap->host->flags & ATA_HOST_NO_SSC) &&
   (ap->host->flags & ATA_HOST_NO_DEVSLP)) {


(and add the same policy != ATA_LPM_MAX_POWER &&
guard to the ap->pflags & ATA_PFLAG_EXTERNAL if-statement)

But I think that I prefer to just keep it as ata_port_dbg().


Kind regards,
Niklas

  parent reply	other threads:[~2025-06-30 15:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  6:26 [PATCH 00/10] Improve link power management Damien Le Moal
2025-06-30  6:26 ` [PATCH 01/10] ata: libata-core: Introduce ata_dev_config_lpm() Damien Le Moal
2025-06-30 14:46   ` Niklas Cassel
2025-07-01  6:09   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 02/10] ata: libata-core: Move device LPM quirk settings to ata_dev_config_lpm() Damien Le Moal
2025-06-30 14:47   ` Niklas Cassel
2025-07-01  6:13   ` Hannes Reinecke
2025-07-01  6:43     ` Damien Le Moal
2025-07-01  7:19       ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 03/10] ata: libata-core: Advertize device support for DIPM and HIPM features Damien Le Moal
2025-06-30 14:47   ` Niklas Cassel
2025-07-01  6:14   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 04/10] ata: libata-eh: Avoid unnecessary resets when revalidating devices Damien Le Moal
2025-06-30 14:47   ` Niklas Cassel
2025-07-01  6:23   ` Hannes Reinecke
2025-07-01  6:48     ` Damien Le Moal
2025-07-01  7:21       ` Hannes Reinecke
2025-07-01  9:24       ` Niklas Cassel
2025-07-01  9:25         ` Damien Le Moal
2025-06-30  6:26 ` [PATCH 05/10] ata: libata-sata: Disallow changing LPM state if not supported Damien Le Moal
2025-06-30 14:49   ` Niklas Cassel
2025-07-01  6:23   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 06/10] ata: ahci: Disable DIPM if host lacks support Damien Le Moal
2025-06-30 14:50   ` Niklas Cassel
2025-07-01  6:23   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 07/10] ata: ahci: Disallow LPM policy control for external ports Damien Le Moal
2025-06-30 14:50   ` Niklas Cassel
2025-07-01  6:24   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 08/10] ata: ahci: Disallow LPM policy control if not supported Damien Le Moal
2025-06-30  8:30   ` Sergey Shtylyov
2025-06-30 15:07   ` Niklas Cassel [this message]
2025-07-01  6:25   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 09/10] ata: libata-core: Reduce the number of messages signaling broken LPM Damien Le Moal
2025-06-30 15:08   ` Niklas Cassel
2025-07-01  6:26   ` Hannes Reinecke
2025-06-30  6:26 ` [PATCH 10/10] ata: libata_eh: Add debug messages to ata_eh_link_set_lpm() Damien Le Moal
2025-06-30 15:11   ` Niklas Cassel
2025-06-30 15:25     ` Sergey Shtylyov
2025-07-01  6:27   ` Hannes Reinecke

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=aGKoT3acZI_EXU2x@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox