lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <da422ab9-363d-4266-a964-aea2e181691e@huawei.com>
Date: Tue, 23 Sep 2025 11:03:48 +0800
From: "lihuisong (C)" <lihuisong@...wei.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
CC: <lenb@...nel.org>, <linux-acpi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
	<jonathan.cameron@...wei.com>, <zhanjie9@...ilicon.com>,
	<zhenglifeng1@...wei.com>, <yubowen8@...wei.com>
Subject: Re: [PATCH v4 1/1] ACPI: processor: Do not expose the global
 acpi_idle_driver variable


在 2025/9/23 1:38, Rafael J. Wysocki 写道:
> On Mon, Sep 22, 2025 at 9:04 AM Huisong Li <lihuisong@...wei.com> wrote:
>> Currently, processor_driver just use the global acpi_idle_driver variable
>> to check if the cpuidle driver is acpi_idle_driver. Actually, there is no
>> need to expose this global variable defined in processor_idle.c to outside.
>> So move the related check to acpi_processor_power_init() and limit the
>> global variable to a static one.
>>
>> Signed-off-by: Huisong Li <lihuisong@...wei.com>
>> ---
>>   drivers/acpi/processor_driver.c |  3 +--
>>   drivers/acpi/processor_idle.c   | 12 +++++++++++-
>>   include/acpi/processor.h        |  1 -
>>   3 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
>> index de17c1412678..5d824435b26b 100644
>> --- a/drivers/acpi/processor_driver.c
>> +++ b/drivers/acpi/processor_driver.c
>> @@ -166,8 +166,7 @@ static int __acpi_processor_start(struct acpi_device *device)
>>          if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS))
>>                  dev_dbg(&device->dev, "CPPC data invalid or not present\n");
>>
>> -       if (cpuidle_get_driver() == &acpi_idle_driver)
>> -               acpi_processor_power_init(pr);
>> +       acpi_processor_power_init(pr);
>>
>>          acpi_pss_perf_init(pr);
>>
>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>> index 698d14c19587..42948495f4f1 100644
>> --- a/drivers/acpi/processor_idle.c
>> +++ b/drivers/acpi/processor_idle.c
>> @@ -51,7 +51,7 @@ module_param(latency_factor, uint, 0644);
>>
>>   static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
>>
>> -struct cpuidle_driver acpi_idle_driver = {
>> +static struct cpuidle_driver acpi_idle_driver = {
>>          .name =         "acpi_idle",
>>          .owner =        THIS_MODULE,
>>   };
>> @@ -1402,8 +1402,18 @@ void acpi_processor_unregister_idle_driver(void)
>>
>>   void acpi_processor_power_init(struct acpi_processor *pr)
>>   {
>> +       struct cpuidle_driver *drv = cpuidle_get_driver();
> This variable is not needed any more.
Ack
>
>>          struct cpuidle_device *dev;
>>
>> +       /*
>> +        * Normally, the ACPI idle driver has already been registered before
>> +        * CPU online. But the 'drv' may be NULL if register idle driver failed.
>> +        * So do not anything if the idle driver isn't acpi_idle_driver or the
>> +        * 'drv' is NULL.
> And this comment can be much shorter, maybe something like "The code
> below only works if acpi_idle_driver is the current cpuidle driver."
will fix it.
>
>> +        */
>> +       if (drv != &acpi_idle_driver)
>> +               return;
>> +
>>          if (disabled_by_idle_boot_param())
>>                  return;
>>
>> diff --git a/include/acpi/processor.h b/include/acpi/processor.h
>> index 24fdaa3c2899..7146a8e9e9c2 100644
>> --- a/include/acpi/processor.h
>> +++ b/include/acpi/processor.h
>> @@ -417,7 +417,6 @@ static inline void acpi_processor_throttling_init(void) {}
>>   #endif /* CONFIG_ACPI_CPU_FREQ_PSS */
>>
>>   /* in processor_idle.c */
>> -extern struct cpuidle_driver acpi_idle_driver;
>>   #ifdef CONFIG_ACPI_PROCESSOR_IDLE
>>   void acpi_processor_power_init(struct acpi_processor *pr);
>>   void acpi_processor_power_exit(struct acpi_processor *pr);
>> --
>> 2.33.0
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ