mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
	<zhanjie9@hisilicon.com>, <lihuisong@huawei.com>,
	<fanghao11@huawei.com>
Subject: Re: [PATCH 1/2] cpufreq: Fix re-boost issue after hotplugging a cpu
Date: Thu, 16 Jan 2025 09:51:26 +0800	[thread overview]
Message-ID: <5a404c4b-686c-4686-94be-8785cb44fc46@huawei.com> (raw)
In-Reply-To: <CAJZ5v0h9zb=_HTR-nraCZj18YcOSfkMm7WVZ4ePsziOzpV0ndg@mail.gmail.com>

On 2025/1/15 20:50, Rafael J. Wysocki wrote:

> On Wed, Jan 15, 2025 at 12:18 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>>
>> On 15-01-25, 18:01, Lifeng Zheng wrote:
>>> It turns out that cpuX will stay on the base frequency after performing
>>> these operations:
>>>
>>> 1. boost all cpus: echo 1 > /sys/devices/system/cpu/cpufreq/boost
>>>
>>> 2. offline the cpu: echo 0 > /sys/devices/system/cpu/cpuX/online
>>>
>>> 3. deboost all cpus: echo 0 > /sys/devices/system/cpu/cpufreq/boost
>>>
>>> 4. online the cpu: echo 1 > /sys/devices/system/cpu/cpuX/online
>>>
>>> 5. boost all cpus again: echo 1 > /sys/devices/system/cpu/cpufreq/boost
>>>
>>> This is because max_freq_req of the policy is not updated during the
>>> online process, and the value of max_freq_req before the last offline is
>>> retained. When the CPU is boosted again, freq_qos_update_request() will
>>> do nothing because the old value is the same as the new one. This causes
>>> the CPU stay on the base frequency. Update max_freq_req (and
>>> min_freq_req of course) in cpufreq_online() will solve this problem.
>>>
>>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>>> ---
>>>  drivers/cpufreq/cpufreq.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>>> index 1a4cae54a01b..03ae879d50b9 100644
>>> --- a/drivers/cpufreq/cpufreq.c
>>> +++ b/drivers/cpufreq/cpufreq.c
>>> @@ -1475,6 +1475,13 @@ static int cpufreq_online(unsigned int cpu)
>>>
>>>               blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
>>>                               CPUFREQ_CREATE_POLICY, policy);
>>> +     } else {
>>> +             ret = freq_qos_update_request(policy->min_freq_req, policy->min);
>>
>> This may not be required, as min-freq-req is never updated.
> 
> It gets updated via scaling_min_freq AFAICS.  Doesn't this matter?

If fact, scaling_min_freq cannot be operated when a cpu is offline. So this
update may indeed be unnecessary.

> 
>>> +             if (ret < 0)
>>> +                     goto out_destroy_policy;
>>> +             ret = freq_qos_update_request(policy->max_freq_req, policy->max);
>>> +             if (ret < 0)
>>> +                     goto out_destroy_policy;
>>>       }
>>>
>>>       if (cpufreq_driver->get && has_target()) {
>>> --


  reply	other threads:[~2025-01-16  1:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15 10:01 [PATCH 0/2] cpufreq: Introduce a more generic way to boost when cpu is going online Lifeng Zheng
2025-01-15 10:01 ` [PATCH 1/2] cpufreq: Fix re-boost issue after hotplugging a cpu Lifeng Zheng
2025-01-15 11:18   ` Viresh Kumar
2025-01-15 12:50     ` Rafael J. Wysocki
2025-01-16  1:51       ` zhenglifeng (A) [this message]
2025-01-15 10:01 ` [PATCH 2/2] cpufreq: Introduce a more generic way to set default per-policy boost flag Lifeng Zheng
2025-01-16  6:54   ` Viresh Kumar
2025-01-16  8:30     ` zhenglifeng (A)
2025-01-15 12:53 ` [PATCH 0/2] cpufreq: Introduce a more generic way to boost when cpu is going online Rafael J. Wysocki
2025-01-16  2:08   ` zhenglifeng (A)

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=5a404c4b-686c-4686-94be-8785cb44fc46@huawei.com \
    --to=zhenglifeng1@huawei.com \
    --cc=fanghao11@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=zhanjie9@hisilicon.com \
    /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®