[PATCH v1 0/6] ACPI: processor: Recovery some reverted patches

Huisong Li posted 6 patches 1 month, 2 weeks ago
drivers/acpi/processor_driver.c |  13 +++-
drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
include/acpi/processor.h        |  34 ++--------
3 files changed, 86 insertions(+), 77 deletions(-)
[PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by Huisong Li 1 month, 2 weeks ago
This series of patches have been reverted due to the crash issue reported
by Borislav [1] and a missing cpuidle sysfs directory reported by Amandeep.

The root cause was commit 7a8c994cbb2d (ACPI: processor: idle: Optimize
ACPI idle driver registration).  Since the other patches in the series 
depended on this commit, they were also reverted.

I have analyzed these issues and implemented the following fixes:
Fix for the Crash:
The crash occurred because 'max_cstate' (which defaults to 8) was not
updated before the ACPI idle states were initialized.  As a result, the idle
driver believed multiple C-states were available, but only the state with
index 1 was actually initialized in the per-CPU acpi_cstate array.  When the
cpuidle governor tried to access a C-state index greater than 1, it hit a
NULL pointer.
Patch 1/6 fixes this by adding acpi_processor_cstate_first_run_checks() to
update 'max_cstate' before initialization.

Fix for missing /sys/devices/system/cpu/cpu*/cpuidle directory:
The previous optimization depended on an external patch [2].  In kernel versions
without that patch, acpi_processor_start() was being called before the ACPI idle
driver had finished registering.  This caused the cpuidle device registration
to fail, resulting in the missing directory.
Patch 1/6 fixes this by moving acpi_processor_register_idle_driver() ahead of 
the acpi_processor_driver registration.

Note:
In this series, only patch 1/6 has been modified to address these bugs, more
detail changes please see the commit.  Patches 2-6/6 remain identical to the
versions that were previously merged.

[1] https://lore.kernel.org/lkml/20251124200019.GIaSS5U9HhsWBotrQZ@fat_crate.local/
[2] https://lore.kernel.org/all/20240529133446.28446-2-Jonathan.Cameron@huawei.com/

Huisong Li (4):
  ACPI: processor: idle: Optimize ACPI idle driver registration
  ACPI: processor: Remove unused empty stubs of some functions
  ACPI: processor: idle: Rearrange declarations in header file
  ACPI: processor: Do not expose global variable acpi_idle_driver

Rafael J. Wysocki (2):
  ACPI: processor: Update cpuidle driver check in
    __acpi_processor_start()
  ACPI: processor: idle: Redefine two functions as void

 drivers/acpi/processor_driver.c |  13 +++-
 drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
 include/acpi/processor.h        |  34 ++--------
 3 files changed, 86 insertions(+), 77 deletions(-)

-- 
2.33.0
Re: [PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by Borislav Petkov 1 month, 2 weeks ago
On Tue, Dec 23, 2025 at 06:09:08PM +0800, Huisong Li wrote:
> Huisong Li (4):
>   ACPI: processor: idle: Optimize ACPI idle driver registration
>   ACPI: processor: Remove unused empty stubs of some functions
>   ACPI: processor: idle: Rearrange declarations in header file
>   ACPI: processor: Do not expose global variable acpi_idle_driver
> 
> Rafael J. Wysocki (2):
>   ACPI: processor: Update cpuidle driver check in
>     __acpi_processor_start()
>   ACPI: processor: idle: Redefine two functions as void
> 
>  drivers/acpi/processor_driver.c |  13 +++-
>  drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
>  include/acpi/processor.h        |  34 ++--------
>  3 files changed, 86 insertions(+), 77 deletions(-)

I'll run them on the affected machine once I get to it.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by Borislav Petkov 1 month ago
On Wed, Dec 24, 2025 at 03:05:32AM +0100, Borislav Petkov wrote:
> On Tue, Dec 23, 2025 at 06:09:08PM +0800, Huisong Li wrote:
> > Huisong Li (4):
> >   ACPI: processor: idle: Optimize ACPI idle driver registration
> >   ACPI: processor: Remove unused empty stubs of some functions
> >   ACPI: processor: idle: Rearrange declarations in header file
> >   ACPI: processor: Do not expose global variable acpi_idle_driver
> > 
> > Rafael J. Wysocki (2):
> >   ACPI: processor: Update cpuidle driver check in
> >     __acpi_processor_start()
> >   ACPI: processor: idle: Redefine two functions as void
> > 
> >  drivers/acpi/processor_driver.c |  13 +++-
> >  drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
> >  include/acpi/processor.h        |  34 ++--------
> >  3 files changed, 86 insertions(+), 77 deletions(-)
> 
> I'll run them on the affected machine once I get to it.

Looks good.

Tested-by: Borislav Petkov (AMD) <bp@alien8.de>

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by Rafael J. Wysocki 4 weeks, 1 day ago
On Fri, Jan 2, 2026 at 11:18 AM Borislav Petkov <bp@alien8.de> wrote:
>
> On Wed, Dec 24, 2025 at 03:05:32AM +0100, Borislav Petkov wrote:
> > On Tue, Dec 23, 2025 at 06:09:08PM +0800, Huisong Li wrote:
> > > Huisong Li (4):
> > >   ACPI: processor: idle: Optimize ACPI idle driver registration
> > >   ACPI: processor: Remove unused empty stubs of some functions
> > >   ACPI: processor: idle: Rearrange declarations in header file
> > >   ACPI: processor: Do not expose global variable acpi_idle_driver
> > >
> > > Rafael J. Wysocki (2):
> > >   ACPI: processor: Update cpuidle driver check in
> > >     __acpi_processor_start()
> > >   ACPI: processor: idle: Redefine two functions as void
> > >
> > >  drivers/acpi/processor_driver.c |  13 +++-
> > >  drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
> > >  include/acpi/processor.h        |  34 ++--------
> > >  3 files changed, 86 insertions(+), 77 deletions(-)
> >
> > I'll run them on the affected machine once I get to it.
>
> Looks good.
>
> Tested-by: Borislav Petkov (AMD) <bp@alien8.de>

Applied as 6.20 material, thanks!
Re: [PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by lihuisong (C) 1 month ago
在 2026/1/2 18:18, Borislav Petkov 写道:
> On Wed, Dec 24, 2025 at 03:05:32AM +0100, Borislav Petkov wrote:
>> On Tue, Dec 23, 2025 at 06:09:08PM +0800, Huisong Li wrote:
>>> Huisong Li (4):
>>>    ACPI: processor: idle: Optimize ACPI idle driver registration
>>>    ACPI: processor: Remove unused empty stubs of some functions
>>>    ACPI: processor: idle: Rearrange declarations in header file
>>>    ACPI: processor: Do not expose global variable acpi_idle_driver
>>>
>>> Rafael J. Wysocki (2):
>>>    ACPI: processor: Update cpuidle driver check in
>>>      __acpi_processor_start()
>>>    ACPI: processor: idle: Redefine two functions as void
>>>
>>>   drivers/acpi/processor_driver.c |  13 +++-
>>>   drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
>>>   include/acpi/processor.h        |  34 ++--------
>>>   3 files changed, 86 insertions(+), 77 deletions(-)
>> I'll run them on the affected machine once I get to it.
> Looks good.
>
> Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
>
Apologize for the crash issue on your platform.
Thank you very much for your test, Borisla.

/Huisong
>
Re: [PATCH v1 0/6] ACPI: processor: Recovery some reverted patches
Posted by lihuisong (C) 1 month ago
Hi Amandeep,

Could you help test this series on your platform?
It would be perfect if has your Tested-by.

/Huisong

在 2025/12/23 18:09, Huisong Li 写道:
> This series of patches have been reverted due to the crash issue reported
> by Borislav [1] and a missing cpuidle sysfs directory reported by Amandeep.
>
> The root cause was commit 7a8c994cbb2d (ACPI: processor: idle: Optimize
> ACPI idle driver registration).  Since the other patches in the series
> depended on this commit, they were also reverted.
>
> I have analyzed these issues and implemented the following fixes:
> Fix for the Crash:
> The crash occurred because 'max_cstate' (which defaults to 8) was not
> updated before the ACPI idle states were initialized.  As a result, the idle
> driver believed multiple C-states were available, but only the state with
> index 1 was actually initialized in the per-CPU acpi_cstate array.  When the
> cpuidle governor tried to access a C-state index greater than 1, it hit a
> NULL pointer.
> Patch 1/6 fixes this by adding acpi_processor_cstate_first_run_checks() to
> update 'max_cstate' before initialization.
>
> Fix for missing /sys/devices/system/cpu/cpu*/cpuidle directory:
> The previous optimization depended on an external patch [2].  In kernel versions
> without that patch, acpi_processor_start() was being called before the ACPI idle
> driver had finished registering.  This caused the cpuidle device registration
> to fail, resulting in the missing directory.
> Patch 1/6 fixes this by moving acpi_processor_register_idle_driver() ahead of
> the acpi_processor_driver registration.
>
> Note:
> In this series, only patch 1/6 has been modified to address these bugs, more
> detail changes please see the commit.  Patches 2-6/6 remain identical to the
> versions that were previously merged.
>
> [1] https://lore.kernel.org/lkml/20251124200019.GIaSS5U9HhsWBotrQZ@fat_crate.local/
> [2] https://lore.kernel.org/all/20240529133446.28446-2-Jonathan.Cameron@huawei.com/
>
> Huisong Li (4):
>    ACPI: processor: idle: Optimize ACPI idle driver registration
>    ACPI: processor: Remove unused empty stubs of some functions
>    ACPI: processor: idle: Rearrange declarations in header file
>    ACPI: processor: Do not expose global variable acpi_idle_driver
>
> Rafael J. Wysocki (2):
>    ACPI: processor: Update cpuidle driver check in
>      __acpi_processor_start()
>    ACPI: processor: idle: Redefine two functions as void
>
>   drivers/acpi/processor_driver.c |  13 +++-
>   drivers/acpi/processor_idle.c   | 116 +++++++++++++++++++-------------
>   include/acpi/processor.h        |  34 ++--------
>   3 files changed, 86 insertions(+), 77 deletions(-)
>