Re: SATA link power management issues

From: Tejun Heo
Date: Fri Apr 24 2015 - 17:45:05 EST


Hello, Gabriele.

On Tue, Apr 21, 2015 at 11:44:28PM +0200, Gabriele Mazzotta wrote:
> I haven't considered that possibility. Something like the following then?

Yeah, looks great. Some minor comments below.

> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -1700,6 +1700,8 @@ static void ahci_handle_port_interrupt(struct ata_port *ap,
> struct ahci_port_priv *pp = ap->private_data;
> struct ahci_host_priv *hpriv = ap->host->private_data;
> int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING);
> + unsigned long lpm_timeout = ap->link.last_lpm_change + 10 * HZ;

We prolly want to define the timeout as a constant symbol in libata.h
and explain what this is about.

> + int ignore_event = 0;

Use bool?

> @@ -1707,8 +1709,13 @@ static void ahci_handle_port_interrupt(struct ata_port *ap,
> if (unlikely(resetting))
> status &= ~PORT_IRQ_BAD_PMP;
>
> + if (time_before(jiffies, lpm_timeout) &&
> + (ap->link.flags & ATA_LFLAG_CHANGED))
> + ignore_event = 1;

Nothing major but testing LFLAG first would prolly be a better style
given that timeout value is relevant only while the flag is asserted
and some comment would be nice too.

> @@ -788,6 +789,8 @@ struct ata_link {
> struct ata_eh_context eh_context;
>
> struct ata_device device[ATA_MAX_DEVICES];
> +
> + unsigned long last_lpm_change;

A brief explanation would be nice.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/