Message ID | E1r5R3H-00CszC-2n@rmk-PC.armlinux.org.uk |
---|---|
State | New |
Headers | show |
Series | Initial cleanups for vCPU hotplug | expand |
On Tue, 21 Nov 2023 13:44:31 +0000 Russell King <rmk+kernel@armlinux.org.uk> wrote: > From: James Morse <james.morse@arm.com> > > Add arch_unregister_cpu() to allow the ACPI machinery to call > unregister_cpu(). This is enough for arm64, riscv and loongarch, but > needs to be overridden by x86 and ia64 who need to do more work. > > CC: Jean-Philippe Brucker <jean-philippe@linaro.org> > Signed-off-by: James Morse <james.morse@arm.com> > Reviewed-by: Shaoqin Huang <shahuang@redhat.com> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
On 11/22/23 00:44, Russell King (Oracle) wrote: > From: James Morse <james.morse@arm.com> > > Add arch_unregister_cpu() to allow the ACPI machinery to call > unregister_cpu(). This is enough for arm64, riscv and loongarch, but > needs to be overridden by x86 and ia64 who need to do more work. > > CC: Jean-Philippe Brucker <jean-philippe@linaro.org> > Signed-off-by: James Morse <james.morse@arm.com> > Reviewed-by: Shaoqin Huang <shahuang@redhat.com> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> > --- > An open question remains from the RFC v2 posting: should we provide a > __weak stub for !HOTPLUG_CPU as well, since in later patches ACPI may > reference this if the compiler doesn't optimise as we expect? > > Changes since v1: > * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu > Changes since RFC v2: > * Move earlier in the series > --- > drivers/base/cpu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > Reviewed-by: Gavin Shan <gshan@redhat.com>
On Tue, Nov 21 2023 at 13:44, Russell King wrote: > --- > An open question remains from the RFC v2 posting: should we provide a > __weak stub for !HOTPLUG_CPU as well, since in later patches ACPI may > reference this if the compiler doesn't optimise as we expect? You mean: extern void foo(void); if (!IS_ENABLED(CONFIG_FOO)) foo(); The kernel uses this pattern for years and if someday a compiler starts to fail to eliminate the call to 'foo()' for CONFIG_FOO=n then you already get hundreds linkage fails today. So adding one more in later patches won't matter much :)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 579064fda97b..58bb86091b34 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -531,7 +531,14 @@ int __weak arch_register_cpu(int cpu) { return register_cpu(&per_cpu(cpu_devices, cpu), cpu); } -#endif + +#ifdef CONFIG_HOTPLUG_CPU +void __weak arch_unregister_cpu(int num) +{ + unregister_cpu(&per_cpu(cpu_devices, num)); +} +#endif /* CONFIG_HOTPLUG_CPU */ +#endif /* CONFIG_GENERIC_CPU_DEVICES */ static void __init cpu_dev_register_generic(void) {