[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b594e092-0002-61d8-fdb9-74fad2285245@redhat.com>
Date: Fri, 10 Nov 2023 11:27:02 +0800
From: Shaoqin Huang <shahuang@...hat.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
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, linux-csky@...r.kernel.org,
linux-doc@...r.kernel.org, linux-ia64@...r.kernel.org,
linux-parisc@...r.kernel.org
Cc: Salil Mehta <salil.mehta@...wei.com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
jianyong.wu@....com, justin.he@....com,
James Morse <james.morse@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
On 11/7/23 18:30, Russell King (Oracle) wrote:
> The differences between architecture specific implementations of
> arch_register_cpu() are down to whether the CPU is hotpluggable or not.
> Rather than overriding the weak version of arch_register_cpu(), provide
> a function that can be used to provide this detail instead.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@...hat.com>
> ---
> drivers/base/cpu.c | 11 ++++++++++-
> include/linux/cpu.h | 1 +
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 58bb86091b34..221ffbeb1c9b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -527,9 +527,18 @@ EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
> #ifdef CONFIG_GENERIC_CPU_DEVICES
> DEFINE_PER_CPU(struct cpu, cpu_devices);
>
> +bool __weak arch_cpu_is_hotpluggable(int cpu)
> +{
> + return false;
> +}
> +
> int __weak arch_register_cpu(int cpu)
> {
> - return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
> + struct cpu *c = &per_cpu(cpu_devices, cpu);
> +
> + c->hotpluggable = arch_cpu_is_hotpluggable(cpu);
> +
> + return register_cpu(c, cpu);
> }
>
> #ifdef CONFIG_HOTPLUG_CPU
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 1e982d63eae8..dcb89c987164 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -80,6 +80,7 @@ extern __printf(4, 5)
> struct device *cpu_device_create(struct device *parent, void *drvdata,
> const struct attribute_group **groups,
> const char *fmt, ...);
> +extern bool arch_cpu_is_hotpluggable(int cpu);
> extern int arch_register_cpu(int cpu);
> extern void arch_unregister_cpu(int cpu);
> #ifdef CONFIG_HOTPLUG_CPU
--
Shaoqin
Powered by blists - more mailing lists