Re: [PATCH 02/21] x86: intel_epb: Don't rely on link order
"Rafael J. Wysocki" <[email protected]> Wed, 22 Nov 2023 21:12:04 +0100
| Newsgroups | gmane.linux.kernel,gmane.linux.power-management.general,gmane.linux.acpi.devel,gmane.linux.kernel.cross-arch,gmane.linux.ports.arm.kernel,gmane.linux.ports.riscv,gmane.linux.documentation,gmane.linux.ports.ia64,gmane.linux.ports.parisc |
|---|---|
| Message-ID | <CAJZ5v0jbjykNooJ_PvkOjpE6hA0QFJUw+kpwYfNY7jOtkcPA0Q@mail.gmail.com> |
On Tue, Nov 21, 2023 at 2:44 PM Russell King <[email protected]> wrote: > > From: James Morse <[email protected]> > > intel_epb_init() is called as a subsys_initcall() to register cpuhp > callbacks. The callbacks make use of get_cpu_device() which will return > NULL unless register_cpu() has been called. register_cpu() is called > from topology_init(), which is also a subsys_initcall(). > > This is fragile. Moving the register_cpu() to a different > subsys_initcall() leads to a NULL dereference during boot. > > Make intel_epb_init() a late_initcall(), user-space can't provide a > policy before this point anyway. > > Signed-off-by: James Morse <[email protected]> > Reviewed-by: Gavin Shan <[email protected]> > Signed-off-by: Russell King (Oracle) <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> and I'd suggest sending this separately to the x86 list. > --- > subsys_initcall_sync() would be an option, but moving the register_cpu() > calls into ACPI also means adding a safety net for CPUs that are online > but not described properly by firmware. This lives in subsys_initcall_sync(). > --- > arch/x86/kernel/cpu/intel_epb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/intel_epb.c b/arch/x86/kernel/cpu/intel_epb.c > index e4c3ba91321c..f18d35fe27a9 100644 > --- a/arch/x86/kernel/cpu/intel_epb.c > +++ b/arch/x86/kernel/cpu/intel_epb.c > @@ -237,4 +237,4 @@ static __init int intel_epb_init(void) > cpuhp_remove_state(CPUHP_AP_X86_INTEL_EPB_ONLINE); > return ret; > } > -subsys_initcall(intel_epb_init); > +late_initcall(intel_epb_init); > -- > 2.30.2 > >