[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTY07FlviAL1DlNz@shell.armlinux.org.uk>
Date: Mon, 23 Oct 2023 09:55:08 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Gavin Shan <gshan@...hat.com>
Cc: James Morse <james.morse@....com>, linux-pm@...r.kernel.org,
loongarch@...ts.linux.dev, linux-acpi@...r.kernel.org,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-riscv@...ts.infradead.org, kvmarm@...ts.linux.dev,
x86@...nel.org, Salil Mehta <salil.mehta@...wei.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
jianyong.wu@....com, justin.he@....com
Subject: Re: [RFC PATCH v2 24/35] drivers: base: Implement weak
arch_unregister_cpu()
On Mon, Oct 23, 2023 at 09:44:50AM +0100, Russell King (Oracle) wrote:
> On Tue, Sep 19, 2023 at 10:59:23AM +1000, Gavin Shan wrote:
> > On 9/14/23 02:38, James Morse wrote:
> > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> > > index 677f963e02ce..c709747c4a18 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 */
> >
> > It seems conflicting with its declaration in include/linux/cpu.h.
>
> How so? The declaration is:
>
> extern void arch_unregister_cpu(int cpu);
>
> So:
>
> void __weak arch_unregister_cpu(int num)
>
> is compatible.
>
> > Besides, the function is still needed by
> > drivers/acpi/acpi_processor.c::acpi_processor_make_not_present()
> > even both CONFIG_HOTPLUG_CPU and CONFIG_GENERIC_CPU_DEVICES are disabled?
>
> Yes, I agree - it needs to be present when ACPI is built, so I'm
> thinking the right solution is to move it out from under at least
> CONFIG_HOTPLUG_CPU.
>
> It can't be moved out from under CONFIG_GENERIC_CPU_DEVICES because
> then we end up referencing the per-cpu variable cpu_devices which only
> exists when CONFIG_GENERIC_CPU_DEVICES is enabled. Is that a problem
> though, because in the case of !CONFIG_GENERIC_CPU_DEVICES, aren't
> architectures required to provide both arch_.*register_cpu() functions?
I'm also wondering why this patch isn't part of:
"drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
because it seems to be doing something very similar.
The commit I refer to introduces a weak version of arch_register_cpu(),
and it seems it would also be appropriate to introduce a weak version
of its unregister paired function at the same time.
Any existing definitions of non-weak arch_unregister_cpu() would
override it so it shouldn't cause any issues.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists