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
Subject: Re: [PATCH 04/10] ata: libata-eh: Avoid unnecessary resets when revalidating devices
Date: Mon, 30 Jun 2025 16:47:51 +0200	[thread overview]
Message-ID: <aGKjl4PtYfaFikfY@ryzen> (raw)
In-Reply-To: <20250630062637.258329-5-dlemoal@kernel.org>

On Mon, Jun 30, 2025 at 03:26:31PM +0900, Damien Le Moal wrote:
> In ata_eh_revalidate_and_attach(), a link LPM policy is always
> set to ATA_LPM_MAX_POWER before calling ata_dev_revalidate() to ensure
> that the call to ata_phys_link_offline() does not return true, thus
> causing an unnecessary device reset. This change was introduced
> with commit 71d7b6e51ad3 ("ata: libata-eh: avoid needless hard reset
> when revalidating link").
> 
> However, setting the link LPM policy to ATA_LPM_MAX_POWER may be
> visible only after some time, depending on the power state the link was
> in. E.g. transitioning out of the Partial state should take no longer
> than a few microseconds, but transitioning out of the Slumber or
> DevSleep state may take several milliseconds. So despite the changes
> introduced with commit 71d7b6e51ad3 ("ata: libata-eh: avoid needless
> hard reset when revalidating link"), we can still endup with
> ata_phys_link_offline() seeing a link SCR_STATUS register signaling that
> the device is present (DET is equal to 1h) but that the link PHY is
> still in a low power mode (e.g. IPM is 2h, signaling "Interface in
> Partial power management state"). In such cases, ata_phys_link_offline()
> returns true, causing an EIO return for ata_eh_revalidate_and_attach()
> and a device reset.
> 
> Avoid such unnecessary device resets by introducing a relaxed version
> of the link offline test implemented by ata_phys_link_offline() with
> the new helper function ata_eh_link_established(). This functions
> returns true if for the link SCR_STATUS register we see that:
>  - A device is still present, that is, the DET field is 1h (Device
>    presence detected but Phy communication not established) or 3h
>    (Device presence detected and Phy communication established).
>  - Communication is established, that is, the IPM field is not 0h,
>    indicating that the PHY is online or in a low power state.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Niklas Cassel <cassel@kernel.org>

  reply	other threads:[~2025-06-30 14:47 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 [this message]
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
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=aGKjl4PtYfaFikfY@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 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.