diff mbox series

[10/10] ata: libata_eh: Add debug messages to ata_eh_link_set_lpm()

Message ID 20250630062637.258329-11-dlemoal@kernel.org
State New
Headers show
Series Improve link power management | expand

Commit Message

Damien Le Moal June 30, 2025, 6:26 a.m. UTC
To facilitate field debugging of link power management related issues,
add a debug message to ata_eh_link_set_lpm() to easily track LPM policy
changes done from EH context, that is, during device scan and
revalidation, error handling, and when a policy change is issued through
a host sysfs link_power_management_policy attribute.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/libata-eh.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Niklas Cassel June 30, 2025, 3:11 p.m. UTC | #1
On Mon, Jun 30, 2025 at 03:26:37PM +0900, Damien Le Moal wrote:
> To facilitate field debugging of link power management related issues,
> add a debug message to ata_eh_link_set_lpm() to easily track LPM policy
> changes done from EH context, that is, during device scan and
> revalidation, error handling, and when a policy change is issued through
> a host sysfs link_power_management_policy attribute.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  drivers/ata/libata-eh.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index 7f5d13f9ca73..7134a4ff6535 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -2140,6 +2140,9 @@ static int ata_eh_link_set_lpm(struct ata_link *link,
>  	if (WARN_ON_ONCE(policy == ATA_LPM_UNKNOWN))
>  		return 0;
>  
> +	ata_link_dbg(link, "Set LPM policy: %d -> %d\n",
> +		     old_policy, policy);

Nit: This is smaller than 80 columns, so it can be one line.

Reviewed-by: Niklas Cassel <cassel@kernel.org>
Sergey Shtylyov June 30, 2025, 3:25 p.m. UTC | #2
On 6/30/25 6:11 PM, Niklas Cassel wrote:

>> To facilitate field debugging of link power management related issues,
>> add a debug message to ata_eh_link_set_lpm() to easily track LPM policy
>> changes done from EH context, that is, during device scan and
>> revalidation, error handling, and when a policy change is issued through
>> a host sysfs link_power_management_policy attribute.
>>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> ---
>>  drivers/ata/libata-eh.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
>> index 7f5d13f9ca73..7134a4ff6535 100644
>> --- a/drivers/ata/libata-eh.c
>> +++ b/drivers/ata/libata-eh.c
>> @@ -2140,6 +2140,9 @@ static int ata_eh_link_set_lpm(struct ata_link *link,
>>  	if (WARN_ON_ONCE(policy == ATA_LPM_UNKNOWN))
>>  		return 0;
>>  
>> +	ata_link_dbg(link, "Set LPM policy: %d -> %d\n",
>> +		     old_policy, policy);
> 
> Nit: This is smaller than 80 columns, so it can be one line.

   The new checkpatch limit is 100 columns anyway... :-)

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

MBR, Sergey
Hannes Reinecke July 1, 2025, 6:27 a.m. UTC | #3
On 6/30/25 08:26, Damien Le Moal wrote:
> To facilitate field debugging of link power management related issues,
> add a debug message to ata_eh_link_set_lpm() to easily track LPM policy
> changes done from EH context, that is, during device scan and
> revalidation, error handling, and when a policy change is issued through
> a host sysfs link_power_management_policy attribute.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>   drivers/ata/libata-eh.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index 7f5d13f9ca73..7134a4ff6535 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -2140,6 +2140,9 @@ static int ata_eh_link_set_lpm(struct ata_link *link,
>   	if (WARN_ON_ONCE(policy == ATA_LPM_UNKNOWN))
>   		return 0;
>   
> +	ata_link_dbg(link, "Set LPM policy: %d -> %d\n",
> +		     old_policy, policy);
> +
>   	/*
>   	 * DIPM is enabled only for ATA_LPM_MIN_POWER,
>   	 * ATA_LPM_MIN_POWER_WITH_PARTIAL, and ATA_LPM_MED_POWER_WITH_DIPM, as

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 7f5d13f9ca73..7134a4ff6535 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2140,6 +2140,9 @@  static int ata_eh_link_set_lpm(struct ata_link *link,
 	if (WARN_ON_ONCE(policy == ATA_LPM_UNKNOWN))
 		return 0;
 
+	ata_link_dbg(link, "Set LPM policy: %d -> %d\n",
+		     old_policy, policy);
+
 	/*
 	 * DIPM is enabled only for ATA_LPM_MIN_POWER,
 	 * ATA_LPM_MIN_POWER_WITH_PARTIAL, and ATA_LPM_MED_POWER_WITH_DIPM, as