Linux Power Management development
 help / color / mirror / Atom feed
From: Klara Modin <klarasmodin@gmail.com>
To: Mario Limonciello <superm1@gmail.com>,
	Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>,
	gautham.shenoy@amd.com, mario.limonciello@amd.com,
	perry.yuan@amd.com, rafael@kernel.org, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, klara@kasm.eu
Subject: Re: [PATCH 4/4] cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call
Date: Sun, 27 Oct 2024 12:41:29 +0100	[thread overview]
Message-ID: <f208714a-ed23-4f7e-a93d-6b6dad193f28@gmail.com> (raw)
In-Reply-To: <5cfc19d6-e171-4049-ad00-5f8474051c9b@gmail.com>

On 2024-10-27 05:27, Mario Limonciello wrote:
> 
> 
> On 10/26/24 06:58, Klara Modin wrote:
>> Hi,
>>
>> On 2024-10-17 12:05, Dhananjay Ugwekar wrote:
>>> amd_pstate_set_driver() is called twice, once in amd_pstate_init() 
>>> and once
>>> as part of amd_pstate_register_driver(). Move around code and eliminate
>>> the redundancy.
>>>
>>> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
>>> ---
>>>   drivers/cpufreq/amd-pstate.c | 12 ++++--------
>>>   1 file changed, 4 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>>> index 13ee5cac901d..6f6d961879cc 100644
>>> --- a/drivers/cpufreq/amd-pstate.c
>>> +++ b/drivers/cpufreq/amd-pstate.c
>>> @@ -1848,9 +1848,11 @@ static int __init amd_pstate_init(void)
>>>           return -ENODEV;
>>>       }
>>> -    ret = amd_pstate_set_driver(cppc_state);
>>> -    if (ret)
>>> +    ret = amd_pstate_register_driver(cppc_state);
>>> +    if (ret) {
>>> +        pr_err("failed to register with return %d\n", ret);
>>>           return ret;
>>> +    }
>>>       /* capability check */
>>>       if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
>>> @@ -1870,12 +1872,6 @@ static int __init amd_pstate_init(void)
>>>               return ret;
>>>       }
>>> -    ret = amd_pstate_register_driver(cppc_state);
>>> -    if (ret) {
>>> -        pr_err("failed to register with return %d\n", ret);
>>> -        return ret;
>>> -    }
>>> -
>>>       dev_root = bus_get_dev_root(&cpu_subsys);
>>>       if (dev_root) {
>>>           ret = sysfs_create_group(&dev_root->kobj, 
>>> &amd_pstate_global_attr_group);
>>
>>
>> This seems to break boot on my Zen 2 desktop (my Zen 4 laptop is fine, 
>> however). I don't see any messages on the console and nothing shows up 
>> in the pstore either.
>>
>> I'll attach the kernel log from a normal boot (with the patch 
>> reverted) in case it helps.
>>
>> Please let me know if there's anything else you need.
>>
>> Regards,
>> Klara Modin
> 
> Hi,
> 
> Thanks for reporting.  I think this might be a regression on shared 
> memory designs specifically because static calls weren't updated yet.
> 
> Can you try this below diff?
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 206725219d8c9..2f0e29b05963d 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1857,12 +1857,6 @@ static int __init amd_pstate_init(void)
>                  return -ENODEV;
>          }
> 
> -       ret = amd_pstate_register_driver(cppc_state);
> -       if (ret) {
> -               pr_err("failed to register with return %d\n", ret);
> -               return ret;
> -       }
> -
>          /* capability check */
>          if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
>                  pr_debug("AMD CPPC MSR based functionality is 
> supported\n");
> @@ -1881,6 +1875,12 @@ static int __init amd_pstate_init(void)
>                          return ret;
>          }
> 
> +       ret = amd_pstate_register_driver(cppc_state);
> +       if (ret) {
> +               pr_err("failed to register with return %d\n", ret);
> +               return ret;
> +       }
> +
>          dev_root = bus_get_dev_root(&cpu_subsys);
>          if (dev_root) {
>                  ret = sysfs_create_group(&dev_root->kobj, 
> &amd_pstate_global_attr_group);
> 

Moving the it afterwards does fix the issue, thanks!

Tested-by: Klara Modin <klarasmodin@gmail.com>

  reply	other threads:[~2024-10-27 11:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 10:05 [PATCH 0/4] cpufreq/amd-pstate: Refactor amd_pstate_init() Dhananjay Ugwekar
2024-10-17 10:05 ` [PATCH 1/4] cpufreq/amd-pstate: Call amd_pstate_register() in amd_pstate_init() Dhananjay Ugwekar
2024-10-17 10:05 ` [PATCH 2/4] cpufreq/amd-pstate: Call amd_pstate_set_driver() in amd_pstate_register_driver() Dhananjay Ugwekar
2024-10-17 10:05 ` [PATCH 3/4] cpufreq/amd-pstate: Remove the switch case in amd_pstate_init() Dhananjay Ugwekar
2024-10-17 10:05 ` [PATCH 4/4] cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call Dhananjay Ugwekar
2024-10-26 11:58   ` Klara Modin
2024-10-27  4:27     ` Mario Limonciello
2024-10-27 11:41       ` Klara Modin [this message]
2024-10-17 18:06 ` [PATCH 0/4] cpufreq/amd-pstate: Refactor amd_pstate_init() Mario Limonciello

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=f208714a-ed23-4f7e-a93d-6b6dad193f28@gmail.com \
    --to=klarasmodin@gmail.com \
    --cc=Dhananjay.Ugwekar@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=klara@kasm.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=rafael@kernel.org \
    --cc=superm1@gmail.com \
    --cc=viresh.kumar@linaro.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