diff mbox series

[3/8] ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn

Message ID 20240826211358.2694603-4-superm1@kernel.org (mailing list archive)
State Superseded, archived
Delegated to: Mario Limonciello
Headers show
Series Adjustments for preferred core detection | expand

Commit Message

Mario Limonciello Aug. 26, 2024, 9:13 p.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

If the boost ratio isn't calculated properly for the system for any
reason this can cause other problems that are non-obvious.

Raise all messages to warn instead.

Suggested-by: Perry Yuan <Perry.Yuan@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 arch/x86/kernel/acpi/cppc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Yuan, Perry Aug. 27, 2024, 6:37 a.m. UTC | #1
[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Mario Limonciello <superm1@kernel.org>
> Sent: Tuesday, August 27, 2024 5:14 AM
> To: Borislav Petkov <bp@alien8.de>; Shenoy, Gautham Ranjal
> <gautham.shenoy@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>
> Cc: maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT) <x86@kernel.org>;
> Rafael J . Wysocki <rafael@kernel.org>; open list:X86 ARCHITECTURE (32-BIT
> AND 64-BIT) <linux-kernel@vger.kernel.org>; open list:ACPI <linux-
> acpi@vger.kernel.org>; open list:CPU FREQUENCY SCALING FRAMEWORK
> <linux-pm@vger.kernel.org>; Limonciello, Mario
> <Mario.Limonciello@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>
> Subject: [PATCH 3/8] ACPI: CPPC: Adjust debug messages in
> amd_set_max_freq_ratio() to warn
>
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> If the boost ratio isn't calculated properly for the system for any reason this
> can cause other problems that are non-obvious.
>
> Raise all messages to warn instead.
>
> Suggested-by: Perry Yuan <Perry.Yuan@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  arch/x86/kernel/acpi/cppc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index
> 1d631ac5ec328..e94507110ca24 100644
> --- a/arch/x86/kernel/acpi/cppc.c
> +++ b/arch/x86/kernel/acpi/cppc.c
> @@ -75,17 +75,17 @@ static void amd_set_max_freq_ratio(void)
>
>       rc = cppc_get_perf_caps(0, &perf_caps);
>       if (rc) {
> -             pr_debug("Could not retrieve perf counters (%d)\n", rc);
> +             pr_warn("Could not retrieve perf counters (%d)\n", rc);
>               return;
>       }
>
>       rc = amd_get_boost_ratio_numerator(0, &highest_perf);
>       if (rc)
> -             pr_debug("Could not retrieve highest performance\n");
> +             pr_warn("Could not retrieve highest performance\n");
>       nominal_perf = perf_caps.nominal_perf;
>
>       if (!nominal_perf) {
> -             pr_debug("Could not retrieve nominal performance\n");
> +             pr_warn("Could not retrieve nominal performance\n");
>               return;
>       }
>
> @@ -93,7 +93,7 @@ static void amd_set_max_freq_ratio(void)
>       /* midpoint between max_boost and max_P */
>       perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
>       if (!perf_ratio) {
> -             pr_debug("Non-zero highest/nominal perf values led to a 0
> ratio\n");
> +             pr_warn("Non-zero highest/nominal perf values led to a 0
> ratio\n");
>               return;
>       }
>
> --
> 2.43.0
>

LGTM, it is good to show the warning message once there are some perf values are invalid.
That will help to debug the issue from customer report log.

Reviewed-by: Perry Yuan <perry.yuan@amd.com>


Best Regards.

Perry.
Gautham R. Shenoy Aug. 27, 2024, 2:50 p.m. UTC | #2
On Mon, Aug 26, 2024 at 04:13:53PM -0500, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> If the boost ratio isn't calculated properly for the system for any
> reason this can cause other problems that are non-obvious.
> 
> Raise all messages to warn instead.
> 
> Suggested-by: Perry Yuan <Perry.Yuan@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  arch/x86/kernel/acpi/cppc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c
> index 1d631ac5ec328..e94507110ca24 100644
> --- a/arch/x86/kernel/acpi/cppc.c
> +++ b/arch/x86/kernel/acpi/cppc.c
> @@ -75,17 +75,17 @@ static void amd_set_max_freq_ratio(void)
>  
>  	rc = cppc_get_perf_caps(0, &perf_caps);
>  	if (rc) {
> -		pr_debug("Could not retrieve perf counters (%d)\n", rc);
> +		pr_warn("Could not retrieve perf counters (%d)\n", rc);
>  		return;
>  	}
>  
>  	rc = amd_get_boost_ratio_numerator(0, &highest_perf);
>  	if (rc)
> -		pr_debug("Could not retrieve highest performance\n");
> +		pr_warn("Could not retrieve highest performance\n");
>  	nominal_perf = perf_caps.nominal_perf;
>  
>  	if (!nominal_perf) {
> -		pr_debug("Could not retrieve nominal performance\n");
> +		pr_warn("Could not retrieve nominal performance\n");
>  		return;
>  	}
>  
> @@ -93,7 +93,7 @@ static void amd_set_max_freq_ratio(void)
>  	/* midpoint between max_boost and max_P */
>  	perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
>  	if (!perf_ratio) {
> -		pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n");
> +		pr_warn("Non-zero highest/nominal perf values led to a 0 ratio\n");
>  		return;

Aside:
perf_ratio is a u64, and SCHED_CAPACITY_SCALE is (1L << 10). Thus, is
it even possible to have !perf_ratio?

Otherwise, I am ok with this promotion of pr_debug to pr_warn.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>

--
Thanks and Regards
gautham.
Mario Limonciello Aug. 27, 2024, 6:48 p.m. UTC | #3
On 8/27/2024 09:50, Gautham R. Shenoy wrote:
> On Mon, Aug 26, 2024 at 04:13:53PM -0500, Mario Limonciello wrote:
>> From: Mario Limonciello <mario.limonciello@amd.com>
>>
>> If the boost ratio isn't calculated properly for the system for any
>> reason this can cause other problems that are non-obvious.
>>
>> Raise all messages to warn instead.
>>
>> Suggested-by: Perry Yuan <Perry.Yuan@amd.com>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>>   arch/x86/kernel/acpi/cppc.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c
>> index 1d631ac5ec328..e94507110ca24 100644
>> --- a/arch/x86/kernel/acpi/cppc.c
>> +++ b/arch/x86/kernel/acpi/cppc.c
>> @@ -75,17 +75,17 @@ static void amd_set_max_freq_ratio(void)
>>   
>>   	rc = cppc_get_perf_caps(0, &perf_caps);
>>   	if (rc) {
>> -		pr_debug("Could not retrieve perf counters (%d)\n", rc);
>> +		pr_warn("Could not retrieve perf counters (%d)\n", rc);
>>   		return;
>>   	}
>>   
>>   	rc = amd_get_boost_ratio_numerator(0, &highest_perf);
>>   	if (rc)
>> -		pr_debug("Could not retrieve highest performance\n");
>> +		pr_warn("Could not retrieve highest performance\n");
>>   	nominal_perf = perf_caps.nominal_perf;
>>   
>>   	if (!nominal_perf) {
>> -		pr_debug("Could not retrieve nominal performance\n");
>> +		pr_warn("Could not retrieve nominal performance\n");
>>   		return;
>>   	}
>>   
>> @@ -93,7 +93,7 @@ static void amd_set_max_freq_ratio(void)
>>   	/* midpoint between max_boost and max_P */
>>   	perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
>>   	if (!perf_ratio) {
>> -		pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n");
>> +		pr_warn("Non-zero highest/nominal perf values led to a 0 ratio\n");
>>   		return;
> 
> Aside:
> perf_ratio is a u64, and SCHED_CAPACITY_SCALE is (1L << 10). Thus, is
> it even possible to have !perf_ratio?
> 
> Otherwise, I am ok with this promotion of pr_debug to pr_warn.

You're right; I don't see this is possible.  I'll tear it out in a 
prerequisite patch in v2.

> 
> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> 
> --
> Thanks and Regards
> gautham.
diff mbox series

Patch

diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c
index 1d631ac5ec328..e94507110ca24 100644
--- a/arch/x86/kernel/acpi/cppc.c
+++ b/arch/x86/kernel/acpi/cppc.c
@@ -75,17 +75,17 @@  static void amd_set_max_freq_ratio(void)
 
 	rc = cppc_get_perf_caps(0, &perf_caps);
 	if (rc) {
-		pr_debug("Could not retrieve perf counters (%d)\n", rc);
+		pr_warn("Could not retrieve perf counters (%d)\n", rc);
 		return;
 	}
 
 	rc = amd_get_boost_ratio_numerator(0, &highest_perf);
 	if (rc)
-		pr_debug("Could not retrieve highest performance\n");
+		pr_warn("Could not retrieve highest performance\n");
 	nominal_perf = perf_caps.nominal_perf;
 
 	if (!nominal_perf) {
-		pr_debug("Could not retrieve nominal performance\n");
+		pr_warn("Could not retrieve nominal performance\n");
 		return;
 	}
 
@@ -93,7 +93,7 @@  static void amd_set_max_freq_ratio(void)
 	/* midpoint between max_boost and max_P */
 	perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1;
 	if (!perf_ratio) {
-		pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n");
+		pr_warn("Non-zero highest/nominal perf values led to a 0 ratio\n");
 		return;
 	}