mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "lihuisong (C)" <lihuisong@huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <lenb@kernel.org>, <linux-acpi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <Sudeep.Holla@arm.com>,
	<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
	<zhanjie9@hisilicon.com>, <zhenglifeng1@huawei.com>,
	<yubowen8@huawei.com>
Subject: Re: [PATCH 1/3] cpuidle: Add enable_cpuidle() interface
Date: Thu, 26 Mar 2026 20:17:01 +0800	[thread overview]
Message-ID: <f2be1178-28f4-4412-adb7-1530944a76ed@huawei.com> (raw)
In-Reply-To: <2d2d2d40-c73a-4988-90fe-fad75e35c75b@huawei.com>

Hi Rafael,

On 1/30/2026 9:59 AM, lihuisong (C) wrote:
> Hi Rafael,
>
> On 1/15/2026 8:18 PM, lihuisong (C) wrote:
>>
>> On 1/15/2026 3:18 AM, Rafael J. Wysocki wrote:
>>> On Tue, Nov 25, 2025 at 8:29 AM Huisong Li <lihuisong@huawei.com> 
>>> wrote:
>>>> The global switch of cpuidle can be turned back on in some case.
>>>> So add enable_cpuidle().
>>> No, this is not going to work.  The "off" switch only affects
>>> initialization AFAICS.
>> I think it would be work.
>> The cpuidle_not_available() also see the "off" on do_idle().
>> And cpuidle_idle_call() check this function first and then select 
>> idle state.
>> Cpuidle doesn't select and enter idle state if this fuction return true.
> I verified that disable_cpuidle() effectively prevents all CPUs from 
> entering any idle states and the cpuidle function is correctly 
> restored after calling enable_cpuidle().
> What do you think? 
Could you pleasetake a look atmy reply?
If not ok, I will drop this from my upstream list.

/Huisong
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>> ---
>>>>   drivers/cpuidle/cpuidle.c | 5 ++++-
>>>>   include/linux/cpuidle.h   | 2 ++
>>>>   2 files changed, 6 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>>>> index 56132e843c99..980ddfd3d930 100644
>>>> --- a/drivers/cpuidle/cpuidle.c
>>>> +++ b/drivers/cpuidle/cpuidle.c
>>>> @@ -48,7 +48,10 @@ void disable_cpuidle(void)
>>>>   {
>>>>          off = 1;
>>>>   }
>>>> -
>>>> +void enable_cpuidle(void)
>>>> +{
>>>> +       off = 0;
>>>> +}
>>>>   bool cpuidle_not_available(struct cpuidle_driver *drv,
>>>>                             struct cpuidle_device *dev)
>>>>   {
>>>> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
>>>> index a9ee4fe55dcf..94c030748af3 100644
>>>> --- a/include/linux/cpuidle.h
>>>> +++ b/include/linux/cpuidle.h
>>>> @@ -168,6 +168,7 @@ struct cpuidle_driver {
>>>>   };
>>>>
>>>>   #ifdef CONFIG_CPU_IDLE
>>>> +extern void enable_cpuidle(void);
>>>>   extern void disable_cpuidle(void);
>>>>   extern bool cpuidle_not_available(struct cpuidle_driver *drv,
>>>>                                    struct cpuidle_device *dev);
>>>> @@ -203,6 +204,7 @@ extern struct cpuidle_driver 
>>>> *cpuidle_get_cpu_driver(struct cpuidle_device *dev)
>>>>   static inline struct cpuidle_device *cpuidle_get_device(void)
>>>>   {return __this_cpu_read(cpuidle_devices); }
>>>>   #else
>>>> +static inline void enable_cpuidle(void) { }
>>>>   static inline void disable_cpuidle(void) { }
>>>>   static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
>>>>                                           struct cpuidle_device *dev)
>>>> -- 
>>>> 2.33.0
>>>>
>
>

  reply	other threads:[~2026-03-26 12:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  7:29 [PATCH 0/3] ACPI: processor: idle: Fix ACPI idle handling in power notify on failure Huisong Li
2025-11-25  7:29 ` [PATCH 1/3] cpuidle: Add enable_cpuidle() interface Huisong Li
2026-01-14 19:18   ` Rafael J. Wysocki
2026-01-15 12:18     ` lihuisong (C)
2026-01-30  1:59       ` lihuisong (C)
2026-03-26 12:17         ` lihuisong (C) [this message]
2026-03-26 13:39           ` Rafael J. Wysocki
2026-03-27  6:23             ` lihuisong (C)
2026-03-27 11:33               ` Rafael J. Wysocki
2026-03-28  4:06                 ` lihuisong (C)
2026-03-31 12:01                   ` lihuisong (C)
2026-03-31 12:05                     ` Rafael J. Wysocki
2026-03-31 12:10                       ` Rafael J. Wysocki
2026-03-31 12:48                         ` lihuisong (C)
2026-03-31 13:00                           ` Rafael J. Wysocki
2025-11-25  7:29 ` [PATCH 2/3] ACPI: processor: idle: Disable ACPI idle if get power information failed in power notify Huisong Li
2025-11-27 15:10   ` kernel test robot
2025-11-25  7:29 ` [PATCH 3/3] ACPI: processor: idle: Update idle states from avaiable power information Huisong Li
2025-11-27 18:09   ` Dan Carpenter

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=f2be1178-28f4-4412-adb7-1530944a76ed@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=rafael@kernel.org \
    --cc=yubowen8@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    --cc=zhenglifeng1@huawei.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®