Re: [PATCH v2] ata: ahci: print the lpm policy on boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Damien,

On Thu, Sep 07, 2023 at 06:18:24AM +0900, Damien Le Moal wrote:
> On 9/6/23 18:22, Niklas Cassel wrote:
> > From: Niklas Cassel <niklas.cassel@xxxxxxx>
> > 
> > The target LPM policy can be set using either a Kconfig or a kernel module
> > parameter.
> > 
> > However, if the board type is set to anything but board_ahci_low_power,
> > then the LPM policy will overridden and set to ATA_LPM_UNKNOWN.
> > 
> > Additionally, if the default suspend is suspend to idle, depending on the
> > hardware capabilities of the HBA, ahci_update_initial_lpm_policy() might
> > override the LPM policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or
> > ATA_LPM_MIN_POWER.
> > 
> > All this means that it is very hard to know which LPM policy a user will
> > actually be using on a given system.
> > 
> > In order to make it easier to debug LPM related issues, print the LPM
> > policy on boot.
> > 
> > One common LPM related issue is that the device fails to link up.
> > Because of that, we cannot add this print to ata_dev_configure(), as that
> > function is only called after a successful link up. Instead, add the info
> > using ata_port_desc(), with the help of a new ata_port_desc_misc() helper.
> > The port description is printed once per port during boot.
> > 
> > Before changes:
> > ata1: SATA max UDMA/133 abar m524288@0xa5780000 port 0xa5780100 irq 170
> > ata2: SATA max UDMA/133 abar m524288@0xa5780000 port 0xa5780180 irq 170
> > 
> > After changes:
> > ata1: SATA max UDMA/133 abar m524288@0xa5780000 port 0xa5780100 irq 170 lpm-pol 4
> > ata2: SATA max UDMA/133 abar m524288@0xa5780000 port 0xa5780180 irq 170 lpm-pol 4
> > 
> > Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
> 
> I am confused... Why not simply:
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index cfb5e6bd03f7..194cf4fcb9bb 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -5945,6 +5945,7 @@ int ata_host_register(struct ata_host *host, const struct
> scsi_host_template *sh
>                                               ap->udma_mask);
> 
>                 if (!ata_port_is_dummy(ap)) {
> +                       ata_port_desc(ap, "lpm-pol %d", ap->target_lpm_policy);
>                         ata_port_info(ap, "%cATA max %s %s\n",
>                                       (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
>                                       ata_mode_string(xfer_mask),
> 
> ?

If AHCI_HFLAG_MULTI_MSI is set, then ahci_host_activate_multi_irqs() will
be called, instead of ata_host_activate():
https://github.com/torvalds/linux/blob/v6.5/drivers/ata/libahci.c#L2755-L2758
so that is why ahci_host_activate_multi_irqs() is also updated.

ata_piix.c implements .set_lpm:
https://github.com/torvalds/linux/blob/v6.5/drivers/ata/ata_piix.c#L1108
and calls ata_pci_sff_activate_host() to activate the host:
https://github.com/torvalds/linux/blob/v6.5/drivers/ata/ata_piix.c#L1746
so that is why ata_pci_sff_activate_host() is also updated.

The only "unnecessary" update is to cs5520_init_one(), which is a pata
driver, and does thus not support any LPM modes. However, in order to be
consistent with all other prints (drivers), print it there as well.
(This specific driver will always print 0, which is technically not a lie.)


Kind regards,
Niklas



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux