mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
	Len Brown <lenb@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<linux-kernel@vger.kernel.org>,
	"open list:ACPI" <linux-acpi@vger.kernel.org>,
	Ivan Shapovalov <intelfx@intelfx.name>,
	Oleksandr Natalenko <oleksandr@natalenko.name>
Subject: Re: [PATCH v2] ACPI: processor: Move arch_init_invariance_cppc() call later
Date: Mon, 4 Nov 2024 11:17:05 -0600	[thread overview]
Message-ID: <c72e23ee-4a53-4f3b-8387-bd9b77c0a3fe@kernel.org> (raw)
In-Reply-To: <CAJZ5v0hVbJctHHMS4=c74Y1+qOw2VRfevkPi9W99nHHPejNw0w@mail.gmail.com>

On 11/4/2024 10:55, Rafael J. Wysocki wrote:
> On Sat, Nov 2, 2024 at 4:24 AM Mario Limonciello <superm1@kernel.org> wrote:
>>
>> From: Mario Limonciello <mario.limonciello@amd.com>
>>
>> arch_init_invariance_cppc() is called at the end of
>> acpi_cppc_processor_probe() in order to configure frequency invariance
>> based upon the values from _CPC.
>>
>> This however doesn't work on AMD CPPC shared memory designs that have
>> AMD preferred cores enabled because _CPC needs to be analyzed from all
>> cores to judge if preferred cores are enabled.
>>
>> This issue manifests to users as a warning since commit 21fb59ab4b97
>> ("ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn"):
>> ```
>> Could not retrieve highest performance (-19)
>> ```
>>
>> However the warning isn't the cause of this, it was actually
>> commit 279f838a61f9 ("x86/amd: Detect preferred cores in
>> amd_get_boost_ratio_numerator()") which exposed the issue.
>>
>> To fix this problem, push the call to the arch_init_invariance_cppc()
>> macro to the end of acpi_processor_driver_init().
>>
>> Fixes: 279f838a61f9 ("x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator()")
>> Reported-by: Ivan Shapovalov <intelfx@intelfx.name>
>> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219431
>> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>> v1->v2:
>>   * Fix LKP robot issue when CONFIG_ACPI_CPPC_LIB not defined
>> ---
>>   arch/x86/include/asm/topology.h | 2 ++
>>   drivers/acpi/cppc_acpi.c        | 6 ------
>>   drivers/acpi/processor_driver.c | 1 +
>>   3 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
>> index abe3a8f22cbd..b04c5db7e945 100644
>> --- a/arch/x86/include/asm/topology.h
>> +++ b/arch/x86/include/asm/topology.h
>> @@ -295,6 +295,8 @@ extern void arch_scale_freq_tick(void);
>>   #ifdef CONFIG_ACPI_CPPC_LIB
>>   void init_freq_invariance_cppc(void);
>>   #define arch_init_invariance_cppc init_freq_invariance_cppc
>> +#else
>> +static inline void arch_init_invariance_cppc(void) { }
>>   #endif
>>
>>   #endif /* _ASM_X86_TOPOLOGY_H */
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index ed91dfd4fdca..9d48cd706659 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -671,10 +671,6 @@ static int pcc_data_alloc(int pcc_ss_id)
>>    *  )
>>    */
>>
>> -#ifndef arch_init_invariance_cppc
>> -static inline void arch_init_invariance_cppc(void) { }
>> -#endif
>> -
>>   /**
>>    * acpi_cppc_processor_probe - Search for per CPU _CPC objects.
>>    * @pr: Ptr to acpi_processor containing this CPU's logical ID.
>> @@ -905,8 +901,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
>>                  goto out_free;
>>          }
>>
>> -       arch_init_invariance_cppc();
>> -
>>          kfree(output.pointer);
>>          return 0;
>>
>> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
>> index cb52dd000b95..59620e7bc664 100644
>> --- a/drivers/acpi/processor_driver.c
>> +++ b/drivers/acpi/processor_driver.c
>> @@ -270,6 +270,7 @@ static int __init acpi_processor_driver_init(void)
>>                                    NULL, acpi_soft_cpu_dead);
>>
>>          acpi_processor_throttling_init();
>> +       arch_init_invariance_cppc();
>>          return 0;
>>   err:
>>          driver_unregister(&acpi_processor_driver);
>> --
> 
> Applied as a fix for 6.12-rc7.
> 
> However, it would be good to add a comment explaining why
> acpi_processor_driver_init() calls arch_init_invariance_cppc() at the
> end.  The ACPI processor driver and CPPC are not otherwise related I
> think?

Sure, I'm thinking a comment like this.

/*
  * Frequency invariance calculations on AMD platforms can't be run until
  * _CPC has been evaluated on all processors which will only happen
  * after probing is complete.
  */

If that sounds good do you want to squash it in?  Or if you would prefer 
another commit tacked on that's no problem I'll do that.

  reply	other threads:[~2024-11-04 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-02  3:23 Mario Limonciello
2024-11-04 16:55 ` Rafael J. Wysocki
2024-11-04 17:17   ` Mario Limonciello [this message]
2024-11-04 17:43     ` Rafael J. Wysocki

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=c72e23ee-4a53-4f3b-8387-bd9b77c0a3fe@kernel.org \
    --to=superm1@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gautham.shenoy@amd.com \
    --cc=hpa@zytor.com \
    --cc=intelfx@intelfx.name \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mingo@redhat.com \
    --cc=oleksandr@natalenko.name \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®