From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Russell King <rmk+kernel@armlinux.org.uk>
Cc: <linux-pm@vger.kernel.org>, <loongarch@lists.linux.dev>,
<linux-acpi@vger.kernel.org>, <linux-arch@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-riscv@lists.infradead.org>, <kvmarm@lists.linux.dev>,
<x86@kernel.org>, <linux-csky@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <linux-ia64@vger.kernel.org>,
<linux-parisc@vger.kernel.org>,
Salil Mehta <salil.mehta@huawei.com>,
Jean-Philippe Brucker <jean-philippe@linaro.org>,
<jianyong.wu@arm.com>, <justin.he@arm.com>,
James Morse <james.morse@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
Date: Tue, 28 Nov 2023 15:08:54 +0000 [thread overview]
Message-ID: <20231128150854.00005370@Huawei.com> (raw)
In-Reply-To: <E1r0JLl-00CTxk-7O@rmk-PC.armlinux.org.uk>
On Tue, 07 Nov 2023 10:30:25 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:
> From: James Morse <james.morse@arm.com>
>
> To allow ACPI's _STA value to hide CPUs that are present, but not
> available to online right now due to VMM or firmware policy, the
> register_cpu() call needs to be made by the ACPI machinery when ACPI
> is in use. This allows it to hide CPUs that are unavailable from sysfs.
>
> Switching to GENERIC_CPU_DEVICES is an intermediate step to allow all
> five ACPI architectures to be modified at once.
>
> Switch over to GENERIC_CPU_DEVICES, and provide an arch_register_cpu()
> that populates the hotpluggable flag. arch_register_cpu() is also the
> interface the ACPI machinery expects.
>
> The struct cpu in struct cpuinfo_arm64 is never used directly, remove
> it to use the one GENERIC_CPU_DEVICES provides.
>
> This changes the CPUs visible in sysfs from possible to present, but
> on arm64 smp_prepare_cpus() ensures these are the same.
>
> This patch also has the effect of moving the registration of CPUs from
> subsys to driver core initialisation, prior to any initcalls running.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Given this series adds an arch_cpu_is_hotpluggable() callback we probably
want something in this patch description to say why this
isn't using that, but instead overriding arch_register_cpu()
Jonathan
> ---
> Changes since RFC v2:
> * Add note about initialisation order change.
> ---
> arch/arm64/Kconfig | 1 +
> arch/arm64/include/asm/cpu.h | 1 -
> arch/arm64/kernel/setup.c | 13 ++++---------
> 3 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 7b071a00425d..84bce830e365 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -132,6 +132,7 @@ config ARM64
> select GENERIC_ARCH_TOPOLOGY
> select GENERIC_CLOCKEVENTS_BROADCAST
> select GENERIC_CPU_AUTOPROBE
> + select GENERIC_CPU_DEVICES
> select GENERIC_CPU_VULNERABILITIES
> select GENERIC_EARLY_IOREMAP
> select GENERIC_IDLE_POLL_SETUP
> diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h
> index f3034099fd95..b1e43f56ee46 100644
> --- a/arch/arm64/include/asm/cpu.h
> +++ b/arch/arm64/include/asm/cpu.h
> @@ -38,7 +38,6 @@ struct cpuinfo_32bit {
> };
>
> struct cpuinfo_arm64 {
> - struct cpu cpu;
> struct kobject kobj;
> u64 reg_ctr;
> u64 reg_cntfrq;
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 417a8a86b2db..165bd2c0dd5a 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,19 +402,14 @@ static inline bool cpu_can_disable(unsigned int cpu)
> return false;
> }
>
> -static int __init topology_init(void)
> +int arch_register_cpu(int num)
> {
> - int i;
> + struct cpu *cpu = &per_cpu(cpu_devices, num);
>
> - for_each_possible_cpu(i) {
> - struct cpu *cpu = &per_cpu(cpu_data.cpu, i);
> - cpu->hotpluggable = cpu_can_disable(i);
> - register_cpu(cpu, i);
> - }
> + cpu->hotpluggable = cpu_can_disable(num);
>
> - return 0;
> + return register_cpu(cpu, num);
> }
> -subsys_initcall(topology_init);
>
> static void dump_kernel_offset(void)
> {
next prev parent reply other threads:[~2023-11-28 15:08 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 10:28 [PATCH RFC 00/22] Initial cleanups for vCPU hotplug Russell King (Oracle)
2023-11-07 10:29 ` [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs Russell King
2023-11-13 0:04 ` Gavin Shan
2023-11-28 14:37 ` Jonathan Cameron
2023-11-28 15:41 ` Russell King (Oracle)
2023-11-07 10:29 ` [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order Russell King
2023-11-13 0:03 ` Gavin Shan
2023-11-28 14:40 ` Jonathan Cameron
2023-11-28 15:42 ` Russell King (Oracle)
2023-11-07 10:29 ` [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports Russell King (Oracle)
2023-11-13 0:08 ` Gavin Shan
2023-11-28 14:42 ` Jonathan Cameron
2023-11-07 10:29 ` [PATCH RFC 04/22] Loongarch: " Russell King (Oracle)
2023-11-13 0:11 ` Gavin Shan
2023-11-28 14:43 ` Jonathan Cameron
2023-11-07 10:29 ` [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv Russell King
2023-11-09 9:43 ` Shaoqin Huang
2023-11-13 0:29 ` Gavin Shan
2023-11-13 8:56 ` Russell King (Oracle)
2023-11-13 10:01 ` Gavin Shan
2023-11-28 14:46 ` Jonathan Cameron
2023-11-07 10:29 ` [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES Russell King
2023-11-09 10:09 ` Shaoqin Huang
2023-11-09 10:29 ` Russell King (Oracle)
2023-11-09 10:59 ` Shaoqin Huang
2023-11-13 0:37 ` Gavin Shan
2023-11-07 10:29 ` [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden Russell King
2023-11-09 10:13 ` Shaoqin Huang
2023-11-13 0:42 ` Gavin Shan
2023-11-28 14:49 ` Jonathan Cameron
2023-11-07 10:29 ` [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu() Russell King
2023-11-09 10:51 ` Shaoqin Huang
2023-11-13 0:45 ` Gavin Shan
2023-11-21 13:33 ` Russell King (Oracle)
2023-11-28 14:51 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-10 3:27 ` Shaoqin Huang
2023-11-13 0:56 ` Gavin Shan
2023-11-28 14:53 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init() Russell King
2023-11-13 0:58 ` Gavin Shan
2023-11-13 8:00 ` Russell King (Oracle)
2023-11-21 13:27 ` Russell King (Oracle)
2023-11-28 13:55 ` Jonathan Cameron
2023-11-28 15:00 ` Jonathan Cameron
2023-11-30 12:17 ` Russell King (Oracle)
2023-11-07 10:30 ` [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node() Russell King (Oracle)
2023-11-13 4:04 ` Gavin Shan
2023-11-15 10:11 ` Russell King (Oracle)
2023-11-07 10:30 ` [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails Russell King
2023-11-10 3:35 ` Shaoqin Huang
2023-11-13 4:03 ` Gavin Shan
2023-11-28 15:05 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu() Russell King
2023-11-10 3:36 ` Shaoqin Huang
2023-11-13 4:07 ` Gavin Shan
2023-11-28 15:08 ` Jonathan Cameron [this message]
2023-11-28 15:12 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-10 3:37 ` Shaoqin Huang
2023-11-13 4:09 ` Gavin Shan
2023-11-28 15:11 ` Jonathan Cameron
2023-11-30 12:09 ` Russell King (Oracle)
2023-11-07 10:30 ` [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES Russell King
2023-11-13 4:13 ` Gavin Shan
2023-11-28 15:16 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu() Russell King (Oracle)
2023-11-13 4:16 ` Gavin Shan
2023-11-28 15:17 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-13 4:18 ` Gavin Shan
2023-11-28 15:18 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES Russell King
2023-11-13 4:20 ` Gavin Shan
2023-11-28 15:19 ` Jonathan Cameron
2023-11-07 10:30 ` [PATCH RFC 19/22] LoongArch: Use the __weak version of arch_unregister_cpu() Russell King
2023-11-07 10:31 ` [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-13 4:22 ` Gavin Shan
2023-11-28 15:20 ` Jonathan Cameron
2023-11-07 10:31 ` [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES Russell King
2023-11-07 17:48 ` Palmer Dabbelt
2023-11-13 4:23 ` Gavin Shan
2023-11-07 10:31 ` [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-07 17:48 ` Palmer Dabbelt
2023-11-13 4:24 ` Gavin Shan
2023-11-28 15:21 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231128150854.00005370@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=jean-philippe@linaro.org \
--cc=jianyong.wu@arm.com \
--cc=justin.he@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=rmk+kernel@armlinux.org.uk \
--cc=salil.mehta@huawei.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).