All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 00/22] Initial cleanups for vCPU hotplug
@ 2023-11-07 10:28 ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:28 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Albert Ou, Borislav Petkov, Catalin Marinas, Dave Hansen,
	Greg Kroah-Hartman, Guo Ren, H. Peter Anvin, Huacai Chen,
	Ingo Molnar, James Morse, Jean-Philippe Brucker, jianyong.wu,
	justin.he, Len Brown, Palmer Dabbelt, Paul Walmsley,
	Peter Zijlstra, Rafael J. Wysocki, Salil Mehta, Sudeep Holla,
	Thomas Gleixner, WANG Xuerui, Will Deacon

Hi,

Rather than posting the entire set of vCPU kernel patches, this is a
subset of those patches which I hope will be able to be appropriately
queued for the next merge window. I am also hoping that nothing here
is covered by Rafael's concerns he alluded to in his response to the
RFC v3 series.

This series aims to switch most architectures over to using generic CPU
devices rather than arch specific implementations, which I think is
worthwhile doing even if the vCPU hotplug series needs further work.

Since this series changes the init order (node_dev_init() vs
cpu_dev_init()) and later on in the vCPU hotplug series move the
location that CPUs are registered, the first two patches head off
problems with register_cpu_capacity_sysctl() and the intel_epb code.
These two were ordered later in the original series.

The next pair of patches are new and remove the exports of
arch_*register_cpu() which are not necessary - these functions are only
called from non-modular code - drivers/base/cpu.c and acpi_processor.c
both of which can only be built-in.

The majority of the other patches come from the vCPU hotplug RFC v3
series I posted earlier, rebased on Linus' current tip, but with some
new patches adding arch_cpu_is_hotpluggable() as the remaining
arch_register_cpu() functions only differ in the setting of the
hotpluggable member of the CPU device - so let's get generic code
doing that and provide a way for an architecture to specify whether a
CPU is hotpluggable.

I would appreciate testing reports on loongarch, riscv and x86
platforms please.

Thanks!

 arch/arm64/Kconfig               |  1 +
 arch/arm64/include/asm/cpu.h     |  1 -
 arch/arm64/kernel/setup.c        | 13 ++-----------
 arch/loongarch/Kconfig           |  2 ++
 arch/loongarch/kernel/topology.c | 42 ++--------------------------------------
 arch/riscv/Kconfig               |  1 +
 arch/riscv/kernel/setup.c        | 18 ++---------------
 arch/x86/Kconfig                 |  2 ++
 arch/x86/include/asm/cpu.h       |  4 ----
 arch/x86/kernel/cpu/intel_epb.c  |  2 +-
 arch/x86/kernel/topology.c       | 33 ++-----------------------------
 drivers/acpi/Kconfig             |  1 -
 drivers/acpi/acpi_processor.c    | 18 -----------------
 drivers/base/arch_topology.c     | 38 ++++++++++++++++++++++++------------
 drivers/base/cpu.c               | 39 +++++++++++++++++++++++++++++--------
 drivers/base/init.c              |  2 +-
 drivers/base/node.c              |  7 -------
 include/linux/cpu.h              |  5 +++++
 18 files changed, 78 insertions(+), 151 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* [PATCH RFC 00/22] Initial cleanups for vCPU hotplug
@ 2023-11-07 10:28 ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:28 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Albert Ou, Borislav Petkov, Catalin Marinas, Dave Hansen,
	Greg Kroah-Hartman, Guo Ren, H. Peter Anvin, Huacai Chen,
	Ingo Molnar, James Morse, Jean-Philippe Brucker, jianyong.wu,
	justin.he, Len Brown, Palmer Dabbelt, Paul Walmsley,
	Peter Zijlstra, Rafael J. Wysocki, Salil Mehta, Sudeep Holla,
	Thomas Gleixner, WANG Xuerui, Will Deacon

Hi,

Rather than posting the entire set of vCPU kernel patches, this is a
subset of those patches which I hope will be able to be appropriately
queued for the next merge window. I am also hoping that nothing here
is covered by Rafael's concerns he alluded to in his response to the
RFC v3 series.

This series aims to switch most architectures over to using generic CPU
devices rather than arch specific implementations, which I think is
worthwhile doing even if the vCPU hotplug series needs further work.

Since this series changes the init order (node_dev_init() vs
cpu_dev_init()) and later on in the vCPU hotplug series move the
location that CPUs are registered, the first two patches head off
problems with register_cpu_capacity_sysctl() and the intel_epb code.
These two were ordered later in the original series.

The next pair of patches are new and remove the exports of
arch_*register_cpu() which are not necessary - these functions are only
called from non-modular code - drivers/base/cpu.c and acpi_processor.c
both of which can only be built-in.

The majority of the other patches come from the vCPU hotplug RFC v3
series I posted earlier, rebased on Linus' current tip, but with some
new patches adding arch_cpu_is_hotpluggable() as the remaining
arch_register_cpu() functions only differ in the setting of the
hotpluggable member of the CPU device - so let's get generic code
doing that and provide a way for an architecture to specify whether a
CPU is hotpluggable.

I would appreciate testing reports on loongarch, riscv and x86
platforms please.

Thanks!

 arch/arm64/Kconfig               |  1 +
 arch/arm64/include/asm/cpu.h     |  1 -
 arch/arm64/kernel/setup.c        | 13 ++-----------
 arch/loongarch/Kconfig           |  2 ++
 arch/loongarch/kernel/topology.c | 42 ++--------------------------------------
 arch/riscv/Kconfig               |  1 +
 arch/riscv/kernel/setup.c        | 18 ++---------------
 arch/x86/Kconfig                 |  2 ++
 arch/x86/include/asm/cpu.h       |  4 ----
 arch/x86/kernel/cpu/intel_epb.c  |  2 +-
 arch/x86/kernel/topology.c       | 33 ++-----------------------------
 drivers/acpi/Kconfig             |  1 -
 drivers/acpi/acpi_processor.c    | 18 -----------------
 drivers/base/arch_topology.c     | 38 ++++++++++++++++++++++++------------
 drivers/base/cpu.c               | 39 +++++++++++++++++++++++++++++--------
 drivers/base/init.c              |  2 +-
 drivers/base/node.c              |  7 -------
 include/linux/cpu.h              |  5 +++++
 18 files changed, 78 insertions(+), 151 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* [PATCH RFC 00/22] Initial cleanups for vCPU hotplug
@ 2023-11-07 10:28 ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:28 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Albert Ou, Borislav Petkov, Catalin Marinas, Dave Hansen,
	Greg Kroah-Hartman, Guo Ren, H. Peter Anvin, Huacai Chen,
	Ingo Molnar, James Morse, Jean-Philippe Brucker, jianyong.wu,
	justin.he, Len Brown, Palmer Dabbelt, Paul Walmsley,
	Peter Zijlstra, Rafael J. Wysocki, Salil Mehta, Sudeep Holla,
	Thomas Gleixner, WANG Xuerui, Will Deacon

Hi,

Rather than posting the entire set of vCPU kernel patches, this is a
subset of those patches which I hope will be able to be appropriately
queued for the next merge window. I am also hoping that nothing here
is covered by Rafael's concerns he alluded to in his response to the
RFC v3 series.

This series aims to switch most architectures over to using generic CPU
devices rather than arch specific implementations, which I think is
worthwhile doing even if the vCPU hotplug series needs further work.

Since this series changes the init order (node_dev_init() vs
cpu_dev_init()) and later on in the vCPU hotplug series move the
location that CPUs are registered, the first two patches head off
problems with register_cpu_capacity_sysctl() and the intel_epb code.
These two were ordered later in the original series.

The next pair of patches are new and remove the exports of
arch_*register_cpu() which are not necessary - these functions are only
called from non-modular code - drivers/base/cpu.c and acpi_processor.c
both of which can only be built-in.

The majority of the other patches come from the vCPU hotplug RFC v3
series I posted earlier, rebased on Linus' current tip, but with some
new patches adding arch_cpu_is_hotpluggable() as the remaining
arch_register_cpu() functions only differ in the setting of the
hotpluggable member of the CPU device - so let's get generic code
doing that and provide a way for an architecture to specify whether a
CPU is hotpluggable.

I would appreciate testing reports on loongarch, riscv and x86
platforms please.

Thanks!

 arch/arm64/Kconfig               |  1 +
 arch/arm64/include/asm/cpu.h     |  1 -
 arch/arm64/kernel/setup.c        | 13 ++-----------
 arch/loongarch/Kconfig           |  2 ++
 arch/loongarch/kernel/topology.c | 42 ++--------------------------------------
 arch/riscv/Kconfig               |  1 +
 arch/riscv/kernel/setup.c        | 18 ++---------------
 arch/x86/Kconfig                 |  2 ++
 arch/x86/include/asm/cpu.h       |  4 ----
 arch/x86/kernel/cpu/intel_epb.c  |  2 +-
 arch/x86/kernel/topology.c       | 33 ++-----------------------------
 drivers/acpi/Kconfig             |  1 -
 drivers/acpi/acpi_processor.c    | 18 -----------------
 drivers/base/arch_topology.c     | 38 ++++++++++++++++++++++++------------
 drivers/base/cpu.c               | 39 +++++++++++++++++++++++++++++--------
 drivers/base/init.c              |  2 +-
 drivers/base/node.c              |  7 -------
 include/linux/cpu.h              |  5 +++++
 18 files changed, 78 insertions(+), 151 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

register_cpu_capacity_sysctl() adds a property to sysfs that describes
the CPUs capacity. This is done from a subsys_initcall() that assumes
all possible CPUs are registered.

With CPU hotplug, possible CPUs aren't registered until they become
present, (or for arm64 enabled). This leads to messages during boot:
| register_cpu_capacity_sysctl: too early to get CPU1 device!
and once these CPUs are added to the system, the file is missing.

Move this to a cpuhp callback, so that the file is created once
CPUs are brought online. This covers CPUs that are added late by
mechanisms like hotplug.
One observable difference is the file is now missing for offline CPUs.

Signed-off-by: James Morse <james.morse@arm.com>
---
If the offline CPUs thing is a problem for the tools that consume
this value, we'd need to move cpu_capacity to be part of cpu.c's
common_cpu_attr_groups.
---
 drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index b741b5ba82bd..9ccb7daee78e 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -220,20 +220,34 @@ static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
 
 static DEVICE_ATTR_RO(cpu_capacity);
 
-static int register_cpu_capacity_sysctl(void)
+static int cpu_capacity_sysctl_add(unsigned int cpu)
 {
-	int i;
-	struct device *cpu;
+	struct device *cpu_dev = get_cpu_device(cpu);
 
-	for_each_possible_cpu(i) {
-		cpu = get_cpu_device(i);
-		if (!cpu) {
-			pr_err("%s: too early to get CPU%d device!\n",
-			       __func__, i);
-			continue;
-		}
-		device_create_file(cpu, &dev_attr_cpu_capacity);
-	}
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_create_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int cpu_capacity_sysctl_remove(unsigned int cpu)
+{
+	struct device *cpu_dev = get_cpu_device(cpu);
+
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int register_cpu_capacity_sysctl(void)
+{
+	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
+			  cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
 
 	return 0;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

register_cpu_capacity_sysctl() adds a property to sysfs that describes
the CPUs capacity. This is done from a subsys_initcall() that assumes
all possible CPUs are registered.

With CPU hotplug, possible CPUs aren't registered until they become
present, (or for arm64 enabled). This leads to messages during boot:
| register_cpu_capacity_sysctl: too early to get CPU1 device!
and once these CPUs are added to the system, the file is missing.

Move this to a cpuhp callback, so that the file is created once
CPUs are brought online. This covers CPUs that are added late by
mechanisms like hotplug.
One observable difference is the file is now missing for offline CPUs.

Signed-off-by: James Morse <james.morse@arm.com>
---
If the offline CPUs thing is a problem for the tools that consume
this value, we'd need to move cpu_capacity to be part of cpu.c's
common_cpu_attr_groups.
---
 drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index b741b5ba82bd..9ccb7daee78e 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -220,20 +220,34 @@ static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
 
 static DEVICE_ATTR_RO(cpu_capacity);
 
-static int register_cpu_capacity_sysctl(void)
+static int cpu_capacity_sysctl_add(unsigned int cpu)
 {
-	int i;
-	struct device *cpu;
+	struct device *cpu_dev = get_cpu_device(cpu);
 
-	for_each_possible_cpu(i) {
-		cpu = get_cpu_device(i);
-		if (!cpu) {
-			pr_err("%s: too early to get CPU%d device!\n",
-			       __func__, i);
-			continue;
-		}
-		device_create_file(cpu, &dev_attr_cpu_capacity);
-	}
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_create_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int cpu_capacity_sysctl_remove(unsigned int cpu)
+{
+	struct device *cpu_dev = get_cpu_device(cpu);
+
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int register_cpu_capacity_sysctl(void)
+{
+	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
+			  cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
 
 	return 0;
 }
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

register_cpu_capacity_sysctl() adds a property to sysfs that describes
the CPUs capacity. This is done from a subsys_initcall() that assumes
all possible CPUs are registered.

With CPU hotplug, possible CPUs aren't registered until they become
present, (or for arm64 enabled). This leads to messages during boot:
| register_cpu_capacity_sysctl: too early to get CPU1 device!
and once these CPUs are added to the system, the file is missing.

Move this to a cpuhp callback, so that the file is created once
CPUs are brought online. This covers CPUs that are added late by
mechanisms like hotplug.
One observable difference is the file is now missing for offline CPUs.

Signed-off-by: James Morse <james.morse@arm.com>
---
If the offline CPUs thing is a problem for the tools that consume
this value, we'd need to move cpu_capacity to be part of cpu.c's
common_cpu_attr_groups.
---
 drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index b741b5ba82bd..9ccb7daee78e 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -220,20 +220,34 @@ static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
 
 static DEVICE_ATTR_RO(cpu_capacity);
 
-static int register_cpu_capacity_sysctl(void)
+static int cpu_capacity_sysctl_add(unsigned int cpu)
 {
-	int i;
-	struct device *cpu;
+	struct device *cpu_dev = get_cpu_device(cpu);
 
-	for_each_possible_cpu(i) {
-		cpu = get_cpu_device(i);
-		if (!cpu) {
-			pr_err("%s: too early to get CPU%d device!\n",
-			       __func__, i);
-			continue;
-		}
-		device_create_file(cpu, &dev_attr_cpu_capacity);
-	}
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_create_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int cpu_capacity_sysctl_remove(unsigned int cpu)
+{
+	struct device *cpu_dev = get_cpu_device(cpu);
+
+	if (!cpu_dev)
+		return -ENOENT;
+
+	device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
+
+	return 0;
+}
+
+static int register_cpu_capacity_sysctl(void)
+{
+	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
+			  cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
 
 	return 0;
 }
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

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 <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
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


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

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 <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

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 <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 0bab03130033..fcb62cfdf946 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -45,13 +45,11 @@ int arch_register_cpu(int cpu)
 	xc->cpu.hotpluggable = cpu > 0;
 	return register_cpu(&xc->cpu, cpu);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int num)
 {
 	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
 int __init arch_register_cpu(int num)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-07 10:29   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 0bab03130033..fcb62cfdf946 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -45,13 +45,11 @@ int arch_register_cpu(int cpu)
 	xc->cpu.hotpluggable = cpu > 0;
 	return register_cpu(&xc->cpu, cpu);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int num)
 {
 	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
 int __init arch_register_cpu(int num)
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-07 10:29   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 0bab03130033..fcb62cfdf946 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -45,13 +45,11 @@ int arch_register_cpu(int cpu)
 	xc->cpu.hotpluggable = cpu > 0;
 	return register_cpu(&xc->cpu, cpu);
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int num)
 {
 	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
 int __init arch_register_cpu(int num)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 3fd166006698..ae860fe81536 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -25,7 +25,6 @@ int arch_register_cpu(int cpu)
 
 	return ret;
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int cpu)
 {
@@ -34,7 +33,6 @@ void arch_unregister_cpu(int cpu)
 	c->hotpluggable = 0;
 	unregister_cpu(c);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #endif
 
 static int __init topology_init(void)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-07 10:29   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 3fd166006698..ae860fe81536 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -25,7 +25,6 @@ int arch_register_cpu(int cpu)
 
 	return ret;
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int cpu)
 {
@@ -34,7 +33,6 @@ void arch_unregister_cpu(int cpu)
 	c->hotpluggable = 0;
 	unregister_cpu(c);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #endif
 
 static int __init topology_init(void)
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-07 10:29   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

arch_register_cpu() and arch_unregister_cpu() are not used by anything
that can be a module - they are used by drivers/base/cpu.c and
drivers/acpi/acpi_processor.c, neither of which can be a module.

Remove the exports.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 3fd166006698..ae860fe81536 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -25,7 +25,6 @@ int arch_register_cpu(int cpu)
 
 	return ret;
 }
-EXPORT_SYMBOL(arch_register_cpu);
 
 void arch_unregister_cpu(int cpu)
 {
@@ -34,7 +33,6 @@ void arch_unregister_cpu(int cpu)
 	c->hotpluggable = 0;
 	unregister_cpu(c);
 }
-EXPORT_SYMBOL(arch_unregister_cpu);
 #endif
 
 static int __init topology_init(void)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

From: James Morse <james.morse@arm.com>

Neither arm64 nor riscv support physical hotadd of CPUs that were not
present at boot. For arm64 much of the platform description is in static
tables which do not have update methods. arm64 does support HOTPLUG_CPU,
which is backed by a firmware interface to turn CPUs on and off.

acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
and removing CPUs that were not present at boot. arm64 systems that do this
are not supported as there is currently insufficient information in the
platform description. (e.g. did the GICR get removed too?)

arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
to prevent CPUs that were not described as present at boot from being
added to the system. Similarly, riscv relies on the same check in
map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
definitions of acpi_map_cpu() and arch_register_cpu().

Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
CPUs present. Neither arm64 nor riscv support this.

Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
selecting it on the other three ACPI architectures. This allows the weak
definitions of some symbols to be removed.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
   HOTPLUG_CPU isn't.
Changes since RFC v3:
 * Dropped ia64 changes
---
 arch/loongarch/Kconfig        |  1 +
 arch/x86/Kconfig              |  1 +
 drivers/acpi/Kconfig          |  1 -
 drivers/acpi/acpi_processor.c | 18 ------------------
 4 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index d889a0b97bc1..64620e90c12c 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -5,6 +5,7 @@ config LOONGARCH
 	select ACPI
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_MCFG if ACPI
+	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_PPTT if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
 	select ARCH_BINFMT_ELF_STATE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3762f41bb092..dbdcfc708369 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -59,6 +59,7 @@ config X86
 	#
 	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
+	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ARCH_32BIT_OFF_T			if X86_32
 	select ARCH_CLOCKSOURCE_INIT
 	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index f819e760ff19..a3acfc750fce 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
 	bool
 	depends on ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_CONTAINER
-	default y
 
 config ACPI_PROCESSOR_AGGREGATOR
 	tristate "Processor Aggregator"
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 0f5218e361df..4fe2ef54088c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
 
 /* Initialization */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int __weak acpi_map_cpu(acpi_handle handle,
-		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
-{
-	return -ENODEV;
-}
-
-int __weak acpi_unmap_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-int __weak arch_register_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-void __weak arch_unregister_cpu(int cpu) {}
-
 static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 {
 	unsigned long long sta;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

From: James Morse <james.morse@arm.com>

Neither arm64 nor riscv support physical hotadd of CPUs that were not
present at boot. For arm64 much of the platform description is in static
tables which do not have update methods. arm64 does support HOTPLUG_CPU,
which is backed by a firmware interface to turn CPUs on and off.

acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
and removing CPUs that were not present at boot. arm64 systems that do this
are not supported as there is currently insufficient information in the
platform description. (e.g. did the GICR get removed too?)

arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
to prevent CPUs that were not described as present at boot from being
added to the system. Similarly, riscv relies on the same check in
map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
definitions of acpi_map_cpu() and arch_register_cpu().

Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
CPUs present. Neither arm64 nor riscv support this.

Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
selecting it on the other three ACPI architectures. This allows the weak
definitions of some symbols to be removed.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
   HOTPLUG_CPU isn't.
Changes since RFC v3:
 * Dropped ia64 changes
---
 arch/loongarch/Kconfig        |  1 +
 arch/x86/Kconfig              |  1 +
 drivers/acpi/Kconfig          |  1 -
 drivers/acpi/acpi_processor.c | 18 ------------------
 4 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index d889a0b97bc1..64620e90c12c 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -5,6 +5,7 @@ config LOONGARCH
 	select ACPI
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_MCFG if ACPI
+	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_PPTT if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
 	select ARCH_BINFMT_ELF_STATE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3762f41bb092..dbdcfc708369 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -59,6 +59,7 @@ config X86
 	#
 	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
+	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ARCH_32BIT_OFF_T			if X86_32
 	select ARCH_CLOCKSOURCE_INIT
 	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index f819e760ff19..a3acfc750fce 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
 	bool
 	depends on ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_CONTAINER
-	default y
 
 config ACPI_PROCESSOR_AGGREGATOR
 	tristate "Processor Aggregator"
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 0f5218e361df..4fe2ef54088c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
 
 /* Initialization */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int __weak acpi_map_cpu(acpi_handle handle,
-		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
-{
-	return -ENODEV;
-}
-
-int __weak acpi_unmap_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-int __weak arch_register_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-void __weak arch_unregister_cpu(int cpu) {}
-
 static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 {
 	unsigned long long sta;
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

From: James Morse <james.morse@arm.com>

Neither arm64 nor riscv support physical hotadd of CPUs that were not
present at boot. For arm64 much of the platform description is in static
tables which do not have update methods. arm64 does support HOTPLUG_CPU,
which is backed by a firmware interface to turn CPUs on and off.

acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
and removing CPUs that were not present at boot. arm64 systems that do this
are not supported as there is currently insufficient information in the
platform description. (e.g. did the GICR get removed too?)

arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
to prevent CPUs that were not described as present at boot from being
added to the system. Similarly, riscv relies on the same check in
map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
definitions of acpi_map_cpu() and arch_register_cpu().

Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
CPUs present. Neither arm64 nor riscv support this.

Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
selecting it on the other three ACPI architectures. This allows the weak
definitions of some symbols to be removed.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
   HOTPLUG_CPU isn't.
Changes since RFC v3:
 * Dropped ia64 changes
---
 arch/loongarch/Kconfig        |  1 +
 arch/x86/Kconfig              |  1 +
 drivers/acpi/Kconfig          |  1 -
 drivers/acpi/acpi_processor.c | 18 ------------------
 4 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index d889a0b97bc1..64620e90c12c 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -5,6 +5,7 @@ config LOONGARCH
 	select ACPI
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_MCFG if ACPI
+	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_PPTT if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
 	select ARCH_BINFMT_ELF_STATE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3762f41bb092..dbdcfc708369 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -59,6 +59,7 @@ config X86
 	#
 	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
 	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
+	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
 	select ARCH_32BIT_OFF_T			if X86_32
 	select ARCH_CLOCKSOURCE_INIT
 	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index f819e760ff19..a3acfc750fce 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
 	bool
 	depends on ACPI_PROCESSOR && HOTPLUG_CPU
 	select ACPI_CONTAINER
-	default y
 
 config ACPI_PROCESSOR_AGGREGATOR
 	tristate "Processor Aggregator"
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 0f5218e361df..4fe2ef54088c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
 
 /* Initialization */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int __weak acpi_map_cpu(acpi_handle handle,
-		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
-{
-	return -ENODEV;
-}
-
-int __weak acpi_unmap_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-int __weak arch_register_cpu(int cpu)
-{
-	return -ENODEV;
-}
-
-void __weak arch_unregister_cpu(int cpu) {}
-
 static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 {
 	unsigned long long sta;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

From: James Morse <james.morse@arm.com>

Three of the five ACPI architectures create sysfs entries using
register_cpu() for present CPUs, whereas arm64, riscv and all
GENERIC_CPU_DEVICES do this for possible CPUs.

Registering a CPU is what causes them to show up in sysfs.

It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu(). Making the ACPI architectures use
GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
cpu_register() logic, before moving it into the ACPI processor driver.
When ACPI is disabled this work would be done by
cpu_dev_register_generic().

Of the ACPI architectures that register possible CPUs, arm64 and riscv
do not support making possible CPUs present as they use the weak 'always
fails' version of arch_register_cpu().

Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
distinction between present and possible CPUs.

The following architectures use GENERIC_CPU_DEVICES but are not SMP,
so possible == present:
 * m68k
 * microblaze
 * nios2

The following architectures use GENERIC_CPU_DEVICES and consider
possible == present:
 * csky: setup_smp()
 * processor_probe() sets possible for all CPUs and present for all CPUs
   except the boot cpu, which will have been done by
   init/main.c::start_kernel().

um appears to be a subarchitecture of x86.

The remaining architecture using GENERIC_CPU_DEVICES are:
 * openrisc and hexagon:
   where smp_init_cpus() makes all CPUs < NR_CPUS possible,
   whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.

After this change, openrisc and hexagon systems that use the max_cpus
command line argument would not see the other CPUs present in sysfs.
This should not be a problem as these CPUs can't bre brought online as
_cpu_up() checks cpu_present().

After this change, only CPUs which are present appear in sysfs.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 9ea22e165acd..34b48f660b6b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
 #ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
-	for_each_possible_cpu(i) {
+	for_each_present_cpu(i) {
 		if (register_cpu(&per_cpu(cpu_devices, i), i))
 			panic("Failed to register CPU device");
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

From: James Morse <james.morse@arm.com>

Three of the five ACPI architectures create sysfs entries using
register_cpu() for present CPUs, whereas arm64, riscv and all
GENERIC_CPU_DEVICES do this for possible CPUs.

Registering a CPU is what causes them to show up in sysfs.

It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu(). Making the ACPI architectures use
GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
cpu_register() logic, before moving it into the ACPI processor driver.
When ACPI is disabled this work would be done by
cpu_dev_register_generic().

Of the ACPI architectures that register possible CPUs, arm64 and riscv
do not support making possible CPUs present as they use the weak 'always
fails' version of arch_register_cpu().

Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
distinction between present and possible CPUs.

The following architectures use GENERIC_CPU_DEVICES but are not SMP,
so possible == present:
 * m68k
 * microblaze
 * nios2

The following architectures use GENERIC_CPU_DEVICES and consider
possible == present:
 * csky: setup_smp()
 * processor_probe() sets possible for all CPUs and present for all CPUs
   except the boot cpu, which will have been done by
   init/main.c::start_kernel().

um appears to be a subarchitecture of x86.

The remaining architecture using GENERIC_CPU_DEVICES are:
 * openrisc and hexagon:
   where smp_init_cpus() makes all CPUs < NR_CPUS possible,
   whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.

After this change, openrisc and hexagon systems that use the max_cpus
command line argument would not see the other CPUs present in sysfs.
This should not be a problem as these CPUs can't bre brought online as
_cpu_up() checks cpu_present().

After this change, only CPUs which are present appear in sysfs.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 9ea22e165acd..34b48f660b6b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
 #ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
-	for_each_possible_cpu(i) {
+	for_each_present_cpu(i) {
 		if (register_cpu(&per_cpu(cpu_devices, i), i))
 			panic("Failed to register CPU device");
 	}
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

From: James Morse <james.morse@arm.com>

Three of the five ACPI architectures create sysfs entries using
register_cpu() for present CPUs, whereas arm64, riscv and all
GENERIC_CPU_DEVICES do this for possible CPUs.

Registering a CPU is what causes them to show up in sysfs.

It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu(). Making the ACPI architectures use
GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
cpu_register() logic, before moving it into the ACPI processor driver.
When ACPI is disabled this work would be done by
cpu_dev_register_generic().

Of the ACPI architectures that register possible CPUs, arm64 and riscv
do not support making possible CPUs present as they use the weak 'always
fails' version of arch_register_cpu().

Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
distinction between present and possible CPUs.

The following architectures use GENERIC_CPU_DEVICES but are not SMP,
so possible == present:
 * m68k
 * microblaze
 * nios2

The following architectures use GENERIC_CPU_DEVICES and consider
possible == present:
 * csky: setup_smp()
 * processor_probe() sets possible for all CPUs and present for all CPUs
   except the boot cpu, which will have been done by
   init/main.c::start_kernel().

um appears to be a subarchitecture of x86.

The remaining architecture using GENERIC_CPU_DEVICES are:
 * openrisc and hexagon:
   where smp_init_cpus() makes all CPUs < NR_CPUS possible,
   whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.

After this change, openrisc and hexagon systems that use the max_cpus
command line argument would not see the other CPUs present in sysfs.
This should not be a problem as these CPUs can't bre brought online as
_cpu_up() checks cpu_present().

After this change, only CPUs which are present appear in sysfs.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 9ea22e165acd..34b48f660b6b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
 #ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
-	for_each_possible_cpu(i) {
+	for_each_present_cpu(i) {
 		if (register_cpu(&per_cpu(cpu_devices, i), i))
 			panic("Failed to register CPU device");
 	}
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

From: James Morse <james.morse@arm.com>

Architectures often have extra per-cpu work that needs doing
before a CPU is registered, often to determine if a CPU is
hotpluggable.

To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
the cpu_register() call into arch_register_cpu(), which is made __weak
so architectures with extra work can override it.
This aligns with the way x86, ia64 and loongarch register hotplug CPUs
when they become present.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Dropped __init from x86/ia64 arch_register_cpu()
Changes since RFC v2:
 * Dropped unnecessary Loongarch asm/cpu.h changes
---
 drivers/base/cpu.c  | 14 ++++++++++----
 include/linux/cpu.h |  4 ++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 34b48f660b6b..579064fda97b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
 EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
 
 #ifdef CONFIG_GENERIC_CPU_DEVICES
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
+DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+int __weak arch_register_cpu(int cpu)
+{
+	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
+}
 #endif
 
 static void __init cpu_dev_register_generic(void)
 {
-#ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
+	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
+		return;
+
 	for_each_present_cpu(i) {
-		if (register_cpu(&per_cpu(cpu_devices, i), i))
+		if (arch_register_cpu(i))
 			panic("Failed to register CPU device");
 	}
-#endif
 }
 
 #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fc8094419084..1e982d63eae8 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
 extern ssize_t arch_cpu_release(const char *, size_t);
 #endif
 
+#ifdef CONFIG_GENERIC_CPU_DEVICES
+DECLARE_PER_CPU(struct cpu, cpu_devices);
+#endif
+
 /*
  * These states are not related to the core CPU hotplug mechanism. They are
  * used by various (sub)architectures to track internal state
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

From: James Morse <james.morse@arm.com>

Architectures often have extra per-cpu work that needs doing
before a CPU is registered, often to determine if a CPU is
hotpluggable.

To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
the cpu_register() call into arch_register_cpu(), which is made __weak
so architectures with extra work can override it.
This aligns with the way x86, ia64 and loongarch register hotplug CPUs
when they become present.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Dropped __init from x86/ia64 arch_register_cpu()
Changes since RFC v2:
 * Dropped unnecessary Loongarch asm/cpu.h changes
---
 drivers/base/cpu.c  | 14 ++++++++++----
 include/linux/cpu.h |  4 ++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 34b48f660b6b..579064fda97b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
 EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
 
 #ifdef CONFIG_GENERIC_CPU_DEVICES
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
+DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+int __weak arch_register_cpu(int cpu)
+{
+	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
+}
 #endif
 
 static void __init cpu_dev_register_generic(void)
 {
-#ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
+	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
+		return;
+
 	for_each_present_cpu(i) {
-		if (register_cpu(&per_cpu(cpu_devices, i), i))
+		if (arch_register_cpu(i))
 			panic("Failed to register CPU device");
 	}
-#endif
 }
 
 #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fc8094419084..1e982d63eae8 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
 extern ssize_t arch_cpu_release(const char *, size_t);
 #endif
 
+#ifdef CONFIG_GENERIC_CPU_DEVICES
+DECLARE_PER_CPU(struct cpu, cpu_devices);
+#endif
+
 /*
  * These states are not related to the core CPU hotplug mechanism. They are
  * used by various (sub)architectures to track internal state
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

From: James Morse <james.morse@arm.com>

Architectures often have extra per-cpu work that needs doing
before a CPU is registered, often to determine if a CPU is
hotpluggable.

To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
the cpu_register() call into arch_register_cpu(), which is made __weak
so architectures with extra work can override it.
This aligns with the way x86, ia64 and loongarch register hotplug CPUs
when they become present.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC:
 * Dropped __init from x86/ia64 arch_register_cpu()
Changes since RFC v2:
 * Dropped unnecessary Loongarch asm/cpu.h changes
---
 drivers/base/cpu.c  | 14 ++++++++++----
 include/linux/cpu.h |  4 ++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 34b48f660b6b..579064fda97b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
 EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
 
 #ifdef CONFIG_GENERIC_CPU_DEVICES
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
+DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+int __weak arch_register_cpu(int cpu)
+{
+	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
+}
 #endif
 
 static void __init cpu_dev_register_generic(void)
 {
-#ifdef CONFIG_GENERIC_CPU_DEVICES
 	int i;
 
+	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
+		return;
+
 	for_each_present_cpu(i) {
-		if (register_cpu(&per_cpu(cpu_devices, i), i))
+		if (arch_register_cpu(i))
 			panic("Failed to register CPU device");
 	}
-#endif
 }
 
 #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index fc8094419084..1e982d63eae8 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
 extern ssize_t arch_cpu_release(const char *, size_t);
 #endif
 
+#ifdef CONFIG_GENERIC_CPU_DEVICES
+DECLARE_PER_CPU(struct cpu, cpu_devices);
+#endif
+
 /*
  * These states are not related to the core CPU hotplug mechanism. They are
  * used by various (sub)architectures to track internal state
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:29   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

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>
---
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(-)

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)
 {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

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>
---
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(-)

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)
 {
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-07 10:29   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:29 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

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>
---
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(-)

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)
 {
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

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@armlinux.org.uk>
---
 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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

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@armlinux.org.uk>
---
 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
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

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@armlinux.org.uk>
---
 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
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

NUMA systems require the node descriptions to be ready before CPUs are
registered. This is so that the node symlinks can be created in sysfs.

Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
are registered by arch code, instead of cpu_dev_init().

Move cpu_dev_init() after node_dev_init() so that NUMA architectures
can use GENERIC_CPU_DEVICES.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Note: Jonathan's comment still needs addressing - see
  https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
---
 drivers/base/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/init.c b/drivers/base/init.c
index 397eb9880cec..c4954835128c 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -35,8 +35,8 @@ void __init driver_init(void)
 	of_core_init();
 	platform_bus_init();
 	auxiliary_bus_init();
-	cpu_dev_init();
 	memory_dev_init();
 	node_dev_init();
+	cpu_dev_init();
 	container_dev_init();
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

NUMA systems require the node descriptions to be ready before CPUs are
registered. This is so that the node symlinks can be created in sysfs.

Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
are registered by arch code, instead of cpu_dev_init().

Move cpu_dev_init() after node_dev_init() so that NUMA architectures
can use GENERIC_CPU_DEVICES.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Note: Jonathan's comment still needs addressing - see
  https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
---
 drivers/base/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/init.c b/drivers/base/init.c
index 397eb9880cec..c4954835128c 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -35,8 +35,8 @@ void __init driver_init(void)
 	of_core_init();
 	platform_bus_init();
 	auxiliary_bus_init();
-	cpu_dev_init();
 	memory_dev_init();
 	node_dev_init();
+	cpu_dev_init();
 	container_dev_init();
 }
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

From: James Morse <james.morse@arm.com>

NUMA systems require the node descriptions to be ready before CPUs are
registered. This is so that the node symlinks can be created in sysfs.

Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
are registered by arch code, instead of cpu_dev_init().

Move cpu_dev_init() after node_dev_init() so that NUMA architectures
can use GENERIC_CPU_DEVICES.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Note: Jonathan's comment still needs addressing - see
  https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
---
 drivers/base/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/init.c b/drivers/base/init.c
index 397eb9880cec..c4954835128c 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -35,8 +35,8 @@ void __init driver_init(void)
 	of_core_init();
 	platform_bus_init();
 	auxiliary_bus_init();
-	cpu_dev_init();
 	memory_dev_init();
 	node_dev_init();
+	cpu_dev_init();
 	container_dev_init();
 }
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
can remove some redundant code.

node_dev_init() will walk through the nodes calling register_one_node()
on each. This will trickle down to __register_one_node() which walks
all present CPUs, calling register_cpu_under_node() on each.

register_cpu_under_node() will call get_cpu_device(cpu) for each, which
will return NULL until the CPU is registered using register_cpu(). This
now happens _after_ node_dev_init().

Therefore, calling register_cpu_under_node() from __register_one_node()
becomes a no-op, and can be removed.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/node.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 493d533f8375..4d5ac7cf8757 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
 int __register_one_node(int nid)
 {
 	int error;
-	int cpu;
 
 	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
 	if (!node_devices[nid])
@@ -875,12 +874,6 @@ int __register_one_node(int nid)
 
 	error = register_node(node_devices[nid], nid);
 
-	/* link cpu under this node */
-	for_each_present_cpu(cpu) {
-		if (cpu_to_node(cpu) == nid)
-			register_cpu_under_node(cpu, nid);
-	}
-
 	INIT_LIST_HEAD(&node_devices[nid]->access_list);
 	node_init_caches(nid);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
can remove some redundant code.

node_dev_init() will walk through the nodes calling register_one_node()
on each. This will trickle down to __register_one_node() which walks
all present CPUs, calling register_cpu_under_node() on each.

register_cpu_under_node() will call get_cpu_device(cpu) for each, which
will return NULL until the CPU is registered using register_cpu(). This
now happens _after_ node_dev_init().

Therefore, calling register_cpu_under_node() from __register_one_node()
becomes a no-op, and can be removed.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/node.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 493d533f8375..4d5ac7cf8757 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
 int __register_one_node(int nid)
 {
 	int error;
-	int cpu;
 
 	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
 	if (!node_devices[nid])
@@ -875,12 +874,6 @@ int __register_one_node(int nid)
 
 	error = register_node(node_devices[nid], nid);
 
-	/* link cpu under this node */
-	for_each_present_cpu(cpu) {
-		if (cpu_to_node(cpu) == nid)
-			register_cpu_under_node(cpu, nid);
-	}
-
 	INIT_LIST_HEAD(&node_devices[nid]->access_list);
 	node_init_caches(nid);
 
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
can remove some redundant code.

node_dev_init() will walk through the nodes calling register_one_node()
on each. This will trickle down to __register_one_node() which walks
all present CPUs, calling register_cpu_under_node() on each.

register_cpu_under_node() will call get_cpu_device(cpu) for each, which
will return NULL until the CPU is registered using register_cpu(). This
now happens _after_ node_dev_init().

Therefore, calling register_cpu_under_node() from __register_one_node()
becomes a no-op, and can be removed.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/base/node.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 493d533f8375..4d5ac7cf8757 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
 int __register_one_node(int nid)
 {
 	int error;
-	int cpu;
 
 	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
 	if (!node_devices[nid])
@@ -875,12 +874,6 @@ int __register_one_node(int nid)
 
 	error = register_node(node_devices[nid], nid);
 
-	/* link cpu under this node */
-	for_each_present_cpu(cpu) {
-		if (cpu_to_node(cpu) == nid)
-			register_cpu_under_node(cpu, nid);
-	}
-
 	INIT_LIST_HEAD(&node_devices[nid]->access_list);
 	node_init_caches(nid);
 
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

loongarch, mips, parisc, riscv and sh all print a warning if
register_cpu() returns an error. Architectures that use
GENERIC_CPU_DEVICES call panic() instead.

Errors in this path indicate something is wrong with the firmware
description of the platform, but the kernel is able to keep running.

Downgrade this to a warning to make it easier to debug this issue.

This will allow architectures that switching over to GENERIC_CPU_DEVICES
to drop their warning, but keep the existing behaviour.

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>
---
 drivers/base/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 221ffbeb1c9b..82b6a76125f5 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
 
 static void __init cpu_dev_register_generic(void)
 {
-	int i;
+	int i, ret;
 
 	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
 		return;
 
 	for_each_present_cpu(i) {
-		if (arch_register_cpu(i))
-			panic("Failed to register CPU device");
+		ret = arch_register_cpu(i);
+		if (ret)
+			pr_warn("register_cpu %d failed (%d)\n", i, ret);
 	}
 }
 
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

loongarch, mips, parisc, riscv and sh all print a warning if
register_cpu() returns an error. Architectures that use
GENERIC_CPU_DEVICES call panic() instead.

Errors in this path indicate something is wrong with the firmware
description of the platform, but the kernel is able to keep running.

Downgrade this to a warning to make it easier to debug this issue.

This will allow architectures that switching over to GENERIC_CPU_DEVICES
to drop their warning, but keep the existing behaviour.

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>
---
 drivers/base/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 221ffbeb1c9b..82b6a76125f5 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
 
 static void __init cpu_dev_register_generic(void)
 {
-	int i;
+	int i, ret;
 
 	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
 		return;
 
 	for_each_present_cpu(i) {
-		if (arch_register_cpu(i))
-			panic("Failed to register CPU device");
+		ret = arch_register_cpu(i);
+		if (ret)
+			pr_warn("register_cpu %d failed (%d)\n", i, ret);
 	}
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

loongarch, mips, parisc, riscv and sh all print a warning if
register_cpu() returns an error. Architectures that use
GENERIC_CPU_DEVICES call panic() instead.

Errors in this path indicate something is wrong with the firmware
description of the platform, but the kernel is able to keep running.

Downgrade this to a warning to make it easier to debug this issue.

This will allow architectures that switching over to GENERIC_CPU_DEVICES
to drop their warning, but keep the existing behaviour.

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>
---
 drivers/base/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 221ffbeb1c9b..82b6a76125f5 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
 
 static void __init cpu_dev_register_generic(void)
 {
-	int i;
+	int i, ret;
 
 	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
 		return;
 
 	for_each_present_cpu(i) {
-		if (arch_register_cpu(i))
-			panic("Failed to register CPU device");
+		ret = arch_register_cpu(i);
+		if (ret)
+			pr_warn("register_cpu %d failed (%d)\n", i, ret);
 	}
 }
 
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

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>
---
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)
 {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

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>
---
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)
 {
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

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>
---
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)
 {
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/arm64/kernel/setup.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 165bd2c0dd5a..42c690bb2d60 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
 	return false;
 }
 
-int arch_register_cpu(int num)
+bool arch_cpu_is_hotpluggable(int num)
 {
-	struct cpu *cpu = &per_cpu(cpu_devices, num);
-
-	cpu->hotpluggable = cpu_can_disable(num);
-
-	return register_cpu(cpu, num);
+	return cpu_can_disable(num);
 }
 
 static void dump_kernel_offset(void)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/arm64/kernel/setup.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 165bd2c0dd5a..42c690bb2d60 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
 	return false;
 }
 
-int arch_register_cpu(int num)
+bool arch_cpu_is_hotpluggable(int num)
 {
-	struct cpu *cpu = &per_cpu(cpu_devices, num);
-
-	cpu->hotpluggable = cpu_can_disable(num);
-
-	return register_cpu(cpu, num);
+	return cpu_can_disable(num);
 }
 
 static void dump_kernel_offset(void)
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/arm64/kernel/setup.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 165bd2c0dd5a..42c690bb2d60 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
 	return false;
 }
 
-int arch_register_cpu(int num)
+bool arch_cpu_is_hotpluggable(int num)
 {
-	struct cpu *cpu = &per_cpu(cpu_devices, num);
-
-	cpu->hotpluggable = cpu_can_disable(num);
-
-	return register_cpu(cpu, num);
+	return cpu_can_disable(num);
 }
 
 static void dump_kernel_offset(void)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

x86's struct cpus come from struct x86_cpu, which has no other members
or users. Remove this and use the version defined by common code.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
----
Changes since RFC:
 * Fixed the second copy of arch_register_cpu() used for non-hotplug
Changes since RFC v2:
 * Remove duplicate of the weak generic arch_register_cpu(), spotted
   by Jonathan Cameron. Add note about initialisation order change.
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/Kconfig           |  1 +
 arch/x86/include/asm/cpu.h |  4 ----
 arch/x86/kernel/topology.c | 27 ++++-----------------------
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dbdcfc708369..8330c4ac26b3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -148,6 +148,7 @@ config X86
 	select GENERIC_CLOCKEVENTS_MIN_ADJUST
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index fecc4fe1d68a..f8f9a9b79395 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -23,10 +23,6 @@ static inline void prefill_possible_map(void) {}
 
 #endif /* CONFIG_SMP */
 
-struct x86_cpu {
-	struct cpu cpu;
-};
-
 #ifdef CONFIG_HOTPLUG_CPU
 extern void soft_restart_cpu(void);
 #endif
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index fcb62cfdf946..c2ed3145a93b 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -35,36 +35,17 @@
 #include <asm/io_apic.h>
 #include <asm/cpu.h>
 
-static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	struct x86_cpu *xc = per_cpu_ptr(&cpu_devices, cpu);
+	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
 
-	xc->cpu.hotpluggable = cpu > 0;
-	return register_cpu(&xc->cpu, cpu);
+	c->hotpluggable = cpu > 0;
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int num)
 {
-	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
-}
-#else /* CONFIG_HOTPLUG_CPU */
-
-int __init arch_register_cpu(int num)
-{
-	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
+	unregister_cpu(&per_cpu(cpu_devices, num));
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-
-static int __init topology_init(void)
-{
-	int i;
-
-	for_each_present_cpu(i)
-		arch_register_cpu(i);
-
-	return 0;
-}
-subsys_initcall(topology_init);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

x86's struct cpus come from struct x86_cpu, which has no other members
or users. Remove this and use the version defined by common code.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
----
Changes since RFC:
 * Fixed the second copy of arch_register_cpu() used for non-hotplug
Changes since RFC v2:
 * Remove duplicate of the weak generic arch_register_cpu(), spotted
   by Jonathan Cameron. Add note about initialisation order change.
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/Kconfig           |  1 +
 arch/x86/include/asm/cpu.h |  4 ----
 arch/x86/kernel/topology.c | 27 ++++-----------------------
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dbdcfc708369..8330c4ac26b3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -148,6 +148,7 @@ config X86
 	select GENERIC_CLOCKEVENTS_MIN_ADJUST
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index fecc4fe1d68a..f8f9a9b79395 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -23,10 +23,6 @@ static inline void prefill_possible_map(void) {}
 
 #endif /* CONFIG_SMP */
 
-struct x86_cpu {
-	struct cpu cpu;
-};
-
 #ifdef CONFIG_HOTPLUG_CPU
 extern void soft_restart_cpu(void);
 #endif
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index fcb62cfdf946..c2ed3145a93b 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -35,36 +35,17 @@
 #include <asm/io_apic.h>
 #include <asm/cpu.h>
 
-static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	struct x86_cpu *xc = per_cpu_ptr(&cpu_devices, cpu);
+	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
 
-	xc->cpu.hotpluggable = cpu > 0;
-	return register_cpu(&xc->cpu, cpu);
+	c->hotpluggable = cpu > 0;
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int num)
 {
-	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
-}
-#else /* CONFIG_HOTPLUG_CPU */
-
-int __init arch_register_cpu(int num)
-{
-	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
+	unregister_cpu(&per_cpu(cpu_devices, num));
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-
-static int __init topology_init(void)
-{
-	int i;
-
-	for_each_present_cpu(i)
-		arch_register_cpu(i);
-
-	return 0;
-}
-subsys_initcall(topology_init);
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

x86's struct cpus come from struct x86_cpu, which has no other members
or users. Remove this and use the version defined by common code.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
----
Changes since RFC:
 * Fixed the second copy of arch_register_cpu() used for non-hotplug
Changes since RFC v2:
 * Remove duplicate of the weak generic arch_register_cpu(), spotted
   by Jonathan Cameron. Add note about initialisation order change.
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/Kconfig           |  1 +
 arch/x86/include/asm/cpu.h |  4 ----
 arch/x86/kernel/topology.c | 27 ++++-----------------------
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dbdcfc708369..8330c4ac26b3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -148,6 +148,7 @@ config X86
 	select GENERIC_CLOCKEVENTS_MIN_ADJUST
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index fecc4fe1d68a..f8f9a9b79395 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -23,10 +23,6 @@ static inline void prefill_possible_map(void) {}
 
 #endif /* CONFIG_SMP */
 
-struct x86_cpu {
-	struct cpu cpu;
-};
-
 #ifdef CONFIG_HOTPLUG_CPU
 extern void soft_restart_cpu(void);
 #endif
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index fcb62cfdf946..c2ed3145a93b 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -35,36 +35,17 @@
 #include <asm/io_apic.h>
 #include <asm/cpu.h>
 
-static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	struct x86_cpu *xc = per_cpu_ptr(&cpu_devices, cpu);
+	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
 
-	xc->cpu.hotpluggable = cpu > 0;
-	return register_cpu(&xc->cpu, cpu);
+	c->hotpluggable = cpu > 0;
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int num)
 {
-	unregister_cpu(&per_cpu(cpu_devices, num).cpu);
-}
-#else /* CONFIG_HOTPLUG_CPU */
-
-int __init arch_register_cpu(int num)
-{
-	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
+	unregister_cpu(&per_cpu(cpu_devices, num));
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-
-static int __init topology_init(void)
-{
-	int i;
-
-	for_each_present_cpu(i)
-		arch_register_cpu(i);
-
-	return 0;
-}
-subsys_initcall(topology_init);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Since the x86 version of arch_unregister_cpu() is the same as the weak
version, drop the x86 specific version.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/kernel/topology.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index c2ed3145a93b..211863cb5b81 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = cpu > 0;
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int num)
-{
-	unregister_cpu(&per_cpu(cpu_devices, num));
-}
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Since the x86 version of arch_unregister_cpu() is the same as the weak
version, drop the x86 specific version.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/kernel/topology.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index c2ed3145a93b..211863cb5b81 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = cpu > 0;
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int num)
-{
-	unregister_cpu(&per_cpu(cpu_devices, num));
-}
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Since the x86 version of arch_unregister_cpu() is the same as the weak
version, drop the x86 specific version.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt to removal of EXPORT_SYMBOL()s
---
 arch/x86/kernel/topology.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index c2ed3145a93b..211863cb5b81 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = cpu > 0;
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int num)
-{
-	unregister_cpu(&per_cpu(cpu_devices, num));
-}
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 211863cb5b81..d42c28b8bfd8 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -36,11 +36,8 @@
 #include <asm/cpu.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
-
-	c->hotpluggable = cpu > 0;
-	return register_cpu(c, cpu);
+	return cpu > 0;
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 211863cb5b81..d42c28b8bfd8 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -36,11 +36,8 @@
 #include <asm/cpu.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
-
-	c->hotpluggable = cpu > 0;
-	return register_cpu(c, cpu);
+	return cpu > 0;
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:30   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/x86/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 211863cb5b81..d42c28b8bfd8 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -36,11 +36,8 @@
 #include <asm/cpu.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
-
-	c->hotpluggable = cpu > 0;
-	return register_cpu(c, cpu);
+	return cpu > 0;
 }
 #endif /* CONFIG_HOTPLUG_CPU */
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

This is a subtle change. Originally:
- on boot, topology_init() would have marked present CPUs that
  io_master() is true for as hotplug-incapable.
- if a CPU is hotplugged that is an io_master(), it can later be
  hot-unplugged.

The new behaviour is that any CPU that io_master() is true for will
now always be marked as hotplug-incapable, thus even if it was
hotplugged, it can no longer be hot-unplugged.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Explain the change in behaviour in the patch description
   (highlighted by Jonathan Cameron - thanks.) Add note about
   initialisation order change.
---
 arch/loongarch/Kconfig           |  1 +
 arch/loongarch/kernel/topology.c | 29 ++---------------------------
 2 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 64620e90c12c..632de780a490 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -72,6 +72,7 @@ config LOONGARCH
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_IOREMAP if !ARCH_IOREMAP
diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index ae860fe81536..7dfb46c68f58 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -10,20 +10,13 @@
 
 #include <acpi/processor.h>
 
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	int ret;
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	c->hotpluggable = 1;
-	ret = register_cpu(c, cpu);
-	if (ret < 0)
-		pr_warn("register_cpu %d failed (%d)\n", cpu, ret);
-
-	return ret;
+	c->hotpluggable = !io_master(cpu);
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int cpu)
@@ -34,21 +27,3 @@ void arch_unregister_cpu(int cpu)
 	unregister_cpu(c);
 }
 #endif
-
-static int __init topology_init(void)
-{
-	int i, ret;
-
-	for_each_present_cpu(i) {
-		struct cpu *c = &per_cpu(cpu_devices, i);
-
-		c->hotpluggable = !io_master(i);
-		ret = register_cpu(c, i);
-		if (ret < 0)
-			pr_warn("topology_init: register_cpu %d failed (%d)\n", i, ret);
-	}
-
-	return 0;
-}
-
-subsys_initcall(topology_init);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

This is a subtle change. Originally:
- on boot, topology_init() would have marked present CPUs that
  io_master() is true for as hotplug-incapable.
- if a CPU is hotplugged that is an io_master(), it can later be
  hot-unplugged.

The new behaviour is that any CPU that io_master() is true for will
now always be marked as hotplug-incapable, thus even if it was
hotplugged, it can no longer be hot-unplugged.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Explain the change in behaviour in the patch description
   (highlighted by Jonathan Cameron - thanks.) Add note about
   initialisation order change.
---
 arch/loongarch/Kconfig           |  1 +
 arch/loongarch/kernel/topology.c | 29 ++---------------------------
 2 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 64620e90c12c..632de780a490 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -72,6 +72,7 @@ config LOONGARCH
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_IOREMAP if !ARCH_IOREMAP
diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index ae860fe81536..7dfb46c68f58 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -10,20 +10,13 @@
 
 #include <acpi/processor.h>
 
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	int ret;
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	c->hotpluggable = 1;
-	ret = register_cpu(c, cpu);
-	if (ret < 0)
-		pr_warn("register_cpu %d failed (%d)\n", cpu, ret);
-
-	return ret;
+	c->hotpluggable = !io_master(cpu);
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int cpu)
@@ -34,21 +27,3 @@ void arch_unregister_cpu(int cpu)
 	unregister_cpu(c);
 }
 #endif
-
-static int __init topology_init(void)
-{
-	int i, ret;
-
-	for_each_present_cpu(i) {
-		struct cpu *c = &per_cpu(cpu_devices, i);
-
-		c->hotpluggable = !io_master(i);
-		ret = register_cpu(c, i);
-		if (ret < 0)
-			pr_warn("topology_init: register_cpu %d failed (%d)\n", i, ret);
-	}
-
-	return 0;
-}
-
-subsys_initcall(topology_init);
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

This is a subtle change. Originally:
- on boot, topology_init() would have marked present CPUs that
  io_master() is true for as hotplug-incapable.
- if a CPU is hotplugged that is an io_master(), it can later be
  hot-unplugged.

The new behaviour is that any CPU that io_master() is true for will
now always be marked as hotplug-incapable, thus even if it was
hotplugged, it can no longer be hot-unplugged.

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>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Explain the change in behaviour in the patch description
   (highlighted by Jonathan Cameron - thanks.) Add note about
   initialisation order change.
---
 arch/loongarch/Kconfig           |  1 +
 arch/loongarch/kernel/topology.c | 29 ++---------------------------
 2 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 64620e90c12c..632de780a490 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -72,6 +72,7 @@ config LOONGARCH
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_CPU_DEVICES
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_IOREMAP if !ARCH_IOREMAP
diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index ae860fe81536..7dfb46c68f58 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -10,20 +10,13 @@
 
 #include <acpi/processor.h>
 
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
-
 #ifdef CONFIG_HOTPLUG_CPU
 int arch_register_cpu(int cpu)
 {
-	int ret;
 	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	c->hotpluggable = 1;
-	ret = register_cpu(c, cpu);
-	if (ret < 0)
-		pr_warn("register_cpu %d failed (%d)\n", cpu, ret);
-
-	return ret;
+	c->hotpluggable = !io_master(cpu);
+	return register_cpu(c, cpu);
 }
 
 void arch_unregister_cpu(int cpu)
@@ -34,21 +27,3 @@ void arch_unregister_cpu(int cpu)
 	unregister_cpu(c);
 }
 #endif
-
-static int __init topology_init(void)
-{
-	int i, ret;
-
-	for_each_present_cpu(i) {
-		struct cpu *c = &per_cpu(cpu_devices, i);
-
-		c->hotpluggable = !io_master(i);
-		ret = register_cpu(c, i);
-		if (ret < 0)
-			pr_warn("topology_init: register_cpu %d failed (%d)\n", i, ret);
-	}
-
-	return 0;
-}
-
-subsys_initcall(topology_init);
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 19/22] LoongArch: Use the __weak version of arch_unregister_cpu()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:30   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

LoongArch provides its own arch_unregister_cpu(). This clears the
hotpluggable flag, then unregisters the CPU.

It isn't necessary to clear the hotpluggable flag when unregistering
a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices
pointer, meaning cpu_is_hotpluggable() will return false, as
get_cpu_device() has returned NULL.

Remove arch_unregister_cpu() and use the __weak version.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt for removal of EXPORT_SYMBOL()s
---
 arch/loongarch/kernel/topology.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 7dfb46c68f58..866c2c9ef6ab 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -18,12 +18,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = !io_master(cpu);
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int cpu)
-{
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = 0;
-	unregister_cpu(c);
-}
 #endif
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 19/22] LoongArch: Use the __weak version of arch_unregister_cpu()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

LoongArch provides its own arch_unregister_cpu(). This clears the
hotpluggable flag, then unregisters the CPU.

It isn't necessary to clear the hotpluggable flag when unregistering
a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices
pointer, meaning cpu_is_hotpluggable() will return false, as
get_cpu_device() has returned NULL.

Remove arch_unregister_cpu() and use the __weak version.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt for removal of EXPORT_SYMBOL()s
---
 arch/loongarch/kernel/topology.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 7dfb46c68f58..866c2c9ef6ab 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -18,12 +18,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = !io_master(cpu);
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int cpu)
-{
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = 0;
-	unregister_cpu(c);
-}
 #endif
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 19/22] LoongArch: Use the __weak version of arch_unregister_cpu()
@ 2023-11-07 10:30   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:30 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

From: James Morse <james.morse@arm.com>

LoongArch provides its own arch_unregister_cpu(). This clears the
hotpluggable flag, then unregisters the CPU.

It isn't necessary to clear the hotpluggable flag when unregistering
a cpu. unregister_cpu() writes NULL to the percpu cpu_sys_devices
pointer, meaning cpu_is_hotpluggable() will return false, as
get_cpu_device() has returned NULL.

Remove arch_unregister_cpu() and use the __weak version.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v3:
 * Adapt for removal of EXPORT_SYMBOL()s
---
 arch/loongarch/kernel/topology.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 7dfb46c68f58..866c2c9ef6ab 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -18,12 +18,4 @@ int arch_register_cpu(int cpu)
 	c->hotpluggable = !io_master(cpu);
 	return register_cpu(c, cpu);
 }
-
-void arch_unregister_cpu(int cpu)
-{
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = 0;
-	unregister_cpu(c);
-}
 #endif
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:31   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
than arch_register_cpu(). Also remove the export as nothing should be
using arch_register_cpu() outside of the core kernel/acpi code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 866c2c9ef6ab..75d5c51a7cd3 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -11,11 +11,8 @@
 #include <acpi/processor.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = !io_master(cpu);
-	return register_cpu(c, cpu);
+	return !io_master(cpu);
 }
 #endif
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:31   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
than arch_register_cpu(). Also remove the export as nothing should be
using arch_register_cpu() outside of the core kernel/acpi code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 866c2c9ef6ab..75d5c51a7cd3 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -11,11 +11,8 @@
 #include <acpi/processor.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = !io_master(cpu);
-	return register_cpu(c, cpu);
+	return !io_master(cpu);
 }
 #endif
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:31   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
than arch_register_cpu(). Also remove the export as nothing should be
using arch_register_cpu() outside of the core kernel/acpi code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/loongarch/kernel/topology.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/kernel/topology.c b/arch/loongarch/kernel/topology.c
index 866c2c9ef6ab..75d5c51a7cd3 100644
--- a/arch/loongarch/kernel/topology.c
+++ b/arch/loongarch/kernel/topology.c
@@ -11,11 +11,8 @@
 #include <acpi/processor.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = !io_master(cpu);
-	return register_cpu(c, cpu);
+	return !io_master(cpu);
 }
 #endif
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:31   ` Russell King
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Add note about initialisation order change.
---
 arch/riscv/Kconfig        |  1 +
 arch/riscv/kernel/setup.c | 19 ++++---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index eaa15a20e6ae..264aa466aec3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -69,6 +69,7 @@ config RISCV
 	select GENERIC_ARCH_TOPOLOGY
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+	select GENERIC_CPU_DEVICES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 0624f44d43ec..f8875ae1b0aa 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
 /*
  * Place kernel memory regions on the resource tree so that
@@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-static int __init topology_init(void)
+int arch_register_cpu(int cpu)
 {
-	int i, ret;
+	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	for_each_possible_cpu(i) {
-		struct cpu *cpu = &per_cpu(cpu_devices, i);
-
-		cpu->hotpluggable = cpu_has_hotplug(i);
-		ret = register_cpu(cpu, i);
-		if (unlikely(ret))
-			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
-			       __func__, i, ret);
-	}
-
-	return 0;
+	c->hotpluggable = cpu_has_hotplug(cpu);
+	return register_cpu(c, cpu);
 }
-subsys_initcall(topology_init);
 
 void free_initmem(void)
 {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:31   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Add note about initialisation order change.
---
 arch/riscv/Kconfig        |  1 +
 arch/riscv/kernel/setup.c | 19 ++++---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index eaa15a20e6ae..264aa466aec3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -69,6 +69,7 @@ config RISCV
 	select GENERIC_ARCH_TOPOLOGY
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+	select GENERIC_CPU_DEVICES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 0624f44d43ec..f8875ae1b0aa 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
 /*
  * Place kernel memory regions on the resource tree so that
@@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-static int __init topology_init(void)
+int arch_register_cpu(int cpu)
 {
-	int i, ret;
+	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	for_each_possible_cpu(i) {
-		struct cpu *cpu = &per_cpu(cpu_devices, i);
-
-		cpu->hotpluggable = cpu_has_hotplug(i);
-		ret = register_cpu(cpu, i);
-		if (unlikely(ret))
-			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
-			       __func__, i, ret);
-	}
-
-	return 0;
+	c->hotpluggable = cpu_has_hotplug(cpu);
+	return register_cpu(c, cpu);
 }
-subsys_initcall(topology_init);
 
 void free_initmem(void)
 {
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 10:31   ` Russell King
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

From: James Morse <james.morse@arm.com>

Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
overridden by the arch code, switch over to this to allow common code
to choose when the register_cpu() call is made.

This allows topology_init() to be removed.

This is an intermediate step to the logic being moved to drivers/acpi,
where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.

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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Changes since RFC v2:
 * Add note about initialisation order change.
---
 arch/riscv/Kconfig        |  1 +
 arch/riscv/kernel/setup.c | 19 ++++---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index eaa15a20e6ae..264aa466aec3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -69,6 +69,7 @@ config RISCV
 	select GENERIC_ARCH_TOPOLOGY
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
+	select GENERIC_CPU_DEVICES
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_ENTRY
 	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 0624f44d43ec..f8875ae1b0aa 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
-static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
 /*
  * Place kernel memory regions on the resource tree so that
@@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-static int __init topology_init(void)
+int arch_register_cpu(int cpu)
 {
-	int i, ret;
+	struct cpu *c = &per_cpu(cpu_devices, cpu);
 
-	for_each_possible_cpu(i) {
-		struct cpu *cpu = &per_cpu(cpu_devices, i);
-
-		cpu->hotpluggable = cpu_has_hotplug(i);
-		ret = register_cpu(cpu, i);
-		if (unlikely(ret))
-			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
-			       __func__, i, ret);
-	}
-
-	return 0;
+	c->hotpluggable = cpu_has_hotplug(cpu);
+	return register_cpu(c, cpu);
 }
-subsys_initcall(topology_init);
 
 void free_initmem(void)
 {
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:28 ` Russell King (Oracle)
  (?)
@ 2023-11-07 10:31   ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/riscv/kernel/setup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f8875ae1b0aa..168f0db63d53 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = cpu_has_hotplug(cpu);
-	return register_cpu(c, cpu);
+	return cpu_has_hotplug(cpu);
 }
 
 void free_initmem(void)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:31   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/riscv/kernel/setup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f8875ae1b0aa..168f0db63d53 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = cpu_has_hotplug(cpu);
-	return register_cpu(c, cpu);
+	return cpu_has_hotplug(cpu);
 }
 
 void free_initmem(void)
-- 
2.30.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 10:31   ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-07 10:31 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
arch_register_cpu().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 arch/riscv/kernel/setup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f8875ae1b0aa..168f0db63d53 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
 	riscv_set_dma_cache_alignment();
 }
 
-int arch_register_cpu(int cpu)
+bool arch_cpu_is_hotpluggable(int cpu)
 {
-	struct cpu *c = &per_cpu(cpu_devices, cpu);
-
-	c->hotpluggable = cpu_has_hotplug(cpu);
-	return register_cpu(c, cpu);
+	return cpu_has_hotplug(cpu);
 }
 
 void free_initmem(void)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:31   ` Russell King
  (?)
@ 2023-11-07 17:48     ` Palmer Dabbelt
  -1 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:06 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> From: James Morse <james.morse@arm.com>
>
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
>
> This allows topology_init() to be removed.
>
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
>
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>  * Add note about initialisation order change.
> ---
>  arch/riscv/Kconfig        |  1 +
>  arch/riscv/kernel/setup.c | 19 ++++---------------
>  2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index eaa15a20e6ae..264aa466aec3 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -69,6 +69,7 @@ config RISCV
>  	select GENERIC_ARCH_TOPOLOGY
>  	select GENERIC_ATOMIC64 if !64BIT
>  	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> +	select GENERIC_CPU_DEVICES
>  	select GENERIC_EARLY_IOREMAP
>  	select GENERIC_ENTRY
>  	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 0624f44d43ec..f8875ae1b0aa 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
>  #endif
>  ;
>  unsigned long boot_cpu_hartid;
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
>
>  /*
>   * Place kernel memory regions on the resource tree so that
> @@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -static int __init topology_init(void)
> +int arch_register_cpu(int cpu)
>  {
> -	int i, ret;
> +	struct cpu *c = &per_cpu(cpu_devices, cpu);
>
> -	for_each_possible_cpu(i) {
> -		struct cpu *cpu = &per_cpu(cpu_devices, i);
> -
> -		cpu->hotpluggable = cpu_has_hotplug(i);
> -		ret = register_cpu(cpu, i);
> -		if (unlikely(ret))
> -			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
> -			       __func__, i, ret);
> -	}
> -
> -	return 0;
> +	c->hotpluggable = cpu_has_hotplug(cpu);
> +	return register_cpu(c, cpu);
>  }
> -subsys_initcall(topology_init);
>
>  void free_initmem(void)
>  {

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 17:48     ` Palmer Dabbelt
  0 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:06 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> From: James Morse <james.morse@arm.com>
>
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
>
> This allows topology_init() to be removed.
>
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
>
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>  * Add note about initialisation order change.
> ---
>  arch/riscv/Kconfig        |  1 +
>  arch/riscv/kernel/setup.c | 19 ++++---------------
>  2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index eaa15a20e6ae..264aa466aec3 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -69,6 +69,7 @@ config RISCV
>  	select GENERIC_ARCH_TOPOLOGY
>  	select GENERIC_ATOMIC64 if !64BIT
>  	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> +	select GENERIC_CPU_DEVICES
>  	select GENERIC_EARLY_IOREMAP
>  	select GENERIC_ENTRY
>  	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 0624f44d43ec..f8875ae1b0aa 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
>  #endif
>  ;
>  unsigned long boot_cpu_hartid;
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
>
>  /*
>   * Place kernel memory regions on the resource tree so that
> @@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -static int __init topology_init(void)
> +int arch_register_cpu(int cpu)
>  {
> -	int i, ret;
> +	struct cpu *c = &per_cpu(cpu_devices, cpu);
>
> -	for_each_possible_cpu(i) {
> -		struct cpu *cpu = &per_cpu(cpu_devices, i);
> -
> -		cpu->hotpluggable = cpu_has_hotplug(i);
> -		ret = register_cpu(cpu, i);
> -		if (unlikely(ret))
> -			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
> -			       __func__, i, ret);
> -	}
> -
> -	return 0;
> +	c->hotpluggable = cpu_has_hotplug(cpu);
> +	return register_cpu(c, cpu);
>  }
> -subsys_initcall(topology_init);
>
>  void free_initmem(void)
>  {

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-07 17:48     ` Palmer Dabbelt
  0 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:06 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> From: James Morse <james.morse@arm.com>
>
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
>
> This allows topology_init() to be removed.
>
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
>
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>  * Add note about initialisation order change.
> ---
>  arch/riscv/Kconfig        |  1 +
>  arch/riscv/kernel/setup.c | 19 ++++---------------
>  2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index eaa15a20e6ae..264aa466aec3 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -69,6 +69,7 @@ config RISCV
>  	select GENERIC_ARCH_TOPOLOGY
>  	select GENERIC_ATOMIC64 if !64BIT
>  	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> +	select GENERIC_CPU_DEVICES
>  	select GENERIC_EARLY_IOREMAP
>  	select GENERIC_ENTRY
>  	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 0624f44d43ec..f8875ae1b0aa 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
>  #endif
>  ;
>  unsigned long boot_cpu_hartid;
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
>
>  /*
>   * Place kernel memory regions on the resource tree so that
> @@ -295,23 +294,13 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -static int __init topology_init(void)
> +int arch_register_cpu(int cpu)
>  {
> -	int i, ret;
> +	struct cpu *c = &per_cpu(cpu_devices, cpu);
>
> -	for_each_possible_cpu(i) {
> -		struct cpu *cpu = &per_cpu(cpu_devices, i);
> -
> -		cpu->hotpluggable = cpu_has_hotplug(i);
> -		ret = register_cpu(cpu, i);
> -		if (unlikely(ret))
> -			pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
> -			       __func__, i, ret);
> -	}
> -
> -	return 0;
> +	c->hotpluggable = cpu_has_hotplug(cpu);
> +	return register_cpu(c, cpu);
>  }
> -subsys_initcall(topology_init);
>
>  void free_initmem(void)
>  {

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:31   ` Russell King (Oracle)
  (?)
@ 2023-11-07 17:48     ` Palmer Dabbelt
  -1 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:11 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  arch/riscv/kernel/setup.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index f8875ae1b0aa..168f0db63d53 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = &per_cpu(cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu_has_hotplug(cpu);
> -	return register_cpu(c, cpu);
> +	return cpu_has_hotplug(cpu);
>  }
>
>  void free_initmem(void)

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 17:48     ` Palmer Dabbelt
  0 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:11 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  arch/riscv/kernel/setup.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index f8875ae1b0aa..168f0db63d53 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = &per_cpu(cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu_has_hotplug(cpu);
> -	return register_cpu(c, cpu);
> +	return cpu_has_hotplug(cpu);
>  }
>
>  void free_initmem(void)

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-07 17:48     ` Palmer Dabbelt
  0 siblings, 0 replies; 258+ messages in thread
From: Palmer Dabbelt @ 2023-11-07 17:48 UTC (permalink / raw)
  To: rmk+kernel
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, salil.mehta, jean-philippe,
	jianyong.wu, justin.he, james.morse, Paul Walmsley, aou

On Tue, 07 Nov 2023 02:31:11 PST (-0800), rmk+kernel@armlinux.org.uk wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  arch/riscv/kernel/setup.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index f8875ae1b0aa..168f0db63d53 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -294,12 +294,9 @@ void __init setup_arch(char **cmdline_p)
>  	riscv_set_dma_cache_alignment();
>  }
>
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = &per_cpu(cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu_has_hotplug(cpu);
> -	return register_cpu(c, cpu);
> +	return cpu_has_hotplug(cpu);
>  }
>
>  void free_initmem(void)

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-09  9:43     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09  9:43 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -
>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-09  9:43     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09  9:43 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -
>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-09  9:43     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09  9:43 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -
>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-09 10:09     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

Hi Russell,

On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().

What do you actually mean about when ACPI is disabled this work would be 
done by cpu_dev_register_generic()? Is the work means register the cpu?

I'm not quite understand that, and how about when ACPI is enabled, which 
function do this work?

> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
                                              ^ nit: can't be
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks,
Shaoqin

> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 9ea22e165acd..34b48f660b6b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> -	for_each_possible_cpu(i) {
> +	for_each_present_cpu(i) {
>   		if (register_cpu(&per_cpu(cpu_devices, i), i))
>   			panic("Failed to register CPU device");
>   	}


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:09     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

Hi Russell,

On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().

What do you actually mean about when ACPI is disabled this work would be 
done by cpu_dev_register_generic()? Is the work means register the cpu?

I'm not quite understand that, and how about when ACPI is enabled, which 
function do this work?

> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
                                              ^ nit: can't be
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks,
Shaoqin

> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 9ea22e165acd..34b48f660b6b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> -	for_each_possible_cpu(i) {
> +	for_each_present_cpu(i) {
>   		if (register_cpu(&per_cpu(cpu_devices, i), i))
>   			panic("Failed to register CPU device");
>   	}


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:09     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

Hi Russell,

On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().

What do you actually mean about when ACPI is disabled this work would be 
done by cpu_dev_register_generic()? Is the work means register the cpu?

I'm not quite understand that, and how about when ACPI is enabled, which 
function do this work?

> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
                                              ^ nit: can't be
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks,
Shaoqin

> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 9ea22e165acd..34b48f660b6b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -533,7 +533,7 @@ static void __init cpu_dev_register_generic(void)
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> -	for_each_possible_cpu(i) {
> +	for_each_present_cpu(i) {
>   		if (register_cpu(&per_cpu(cpu_devices, i), i))
>   			panic("Failed to register CPU device");
>   	}


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-09 10:13     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 34b48f660b6b..579064fda97b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
>   EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
>   
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
> +DEFINE_PER_CPU(struct cpu, cpu_devices);
> +
> +int __weak arch_register_cpu(int cpu)
> +{
> +	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
> +}
>   #endif
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -#ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> +	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
> +		return;
> +
>   	for_each_present_cpu(i) {
> -		if (register_cpu(&per_cpu(cpu_devices, i), i))
> +		if (arch_register_cpu(i))
>   			panic("Failed to register CPU device");
>   	}
> -#endif
>   }
>   
>   #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index fc8094419084..1e982d63eae8 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
>   extern ssize_t arch_cpu_release(const char *, size_t);
>   #endif
>   
> +#ifdef CONFIG_GENERIC_CPU_DEVICES
> +DECLARE_PER_CPU(struct cpu, cpu_devices);
> +#endif
> +
>   /*
>    * These states are not related to the core CPU hotplug mechanism. They are
>    * used by various (sub)architectures to track internal state

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-09 10:13     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 34b48f660b6b..579064fda97b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
>   EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
>   
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
> +DEFINE_PER_CPU(struct cpu, cpu_devices);
> +
> +int __weak arch_register_cpu(int cpu)
> +{
> +	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
> +}
>   #endif
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -#ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> +	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
> +		return;
> +
>   	for_each_present_cpu(i) {
> -		if (register_cpu(&per_cpu(cpu_devices, i), i))
> +		if (arch_register_cpu(i))
>   			panic("Failed to register CPU device");
>   	}
> -#endif
>   }
>   
>   #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index fc8094419084..1e982d63eae8 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
>   extern ssize_t arch_cpu_release(const char *, size_t);
>   #endif
>   
> +#ifdef CONFIG_GENERIC_CPU_DEVICES
> +DECLARE_PER_CPU(struct cpu, cpu_devices);
> +#endif
> +
>   /*
>    * These states are not related to the core CPU hotplug mechanism. They are
>    * used by various (sub)architectures to track internal state

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-09 10:13     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



On 11/7/23 18:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 34b48f660b6b..579064fda97b 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -525,19 +525,25 @@ bool cpu_is_hotpluggable(unsigned int cpu)
>   EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
>   
>   #ifdef CONFIG_GENERIC_CPU_DEVICES
> -static DEFINE_PER_CPU(struct cpu, cpu_devices);
> +DEFINE_PER_CPU(struct cpu, cpu_devices);
> +
> +int __weak arch_register_cpu(int cpu)
> +{
> +	return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
> +}
>   #endif
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -#ifdef CONFIG_GENERIC_CPU_DEVICES
>   	int i;
>   
> +	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
> +		return;
> +
>   	for_each_present_cpu(i) {
> -		if (register_cpu(&per_cpu(cpu_devices, i), i))
> +		if (arch_register_cpu(i))
>   			panic("Failed to register CPU device");
>   	}
> -#endif
>   }
>   
>   #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index fc8094419084..1e982d63eae8 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -88,6 +88,10 @@ extern ssize_t arch_cpu_probe(const char *, size_t);
>   extern ssize_t arch_cpu_release(const char *, size_t);
>   #endif
>   
> +#ifdef CONFIG_GENERIC_CPU_DEVICES
> +DECLARE_PER_CPU(struct cpu, cpu_devices);
> +#endif
> +
>   /*
>    * These states are not related to the core CPU hotplug mechanism. They are
>    * used by various (sub)architectures to track internal state

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
  2023-11-09 10:09     ` Shaoqin Huang
  (?)
@ 2023-11-09 10:29       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-09 10:29 UTC (permalink / raw)
  To: Shaoqin Huang
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren

On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
> Hi Russell,
> 
> On 11/7/23 18:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Three of the five ACPI architectures create sysfs entries using
> > register_cpu() for present CPUs, whereas arm64, riscv and all
> > GENERIC_CPU_DEVICES do this for possible CPUs.
> > 
> > Registering a CPU is what causes them to show up in sysfs.
> > 
> > It makes very little sense to register all possible CPUs. Registering
> > a CPU is what triggers the udev notifications allowing user-space to
> > react to newly added CPUs.
> > 
> > To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> > it to use for_each_present_cpu(). Making the ACPI architectures use
> > GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> > cpu_register() logic, before moving it into the ACPI processor driver.
> > When ACPI is disabled this work would be done by
> > cpu_dev_register_generic().
> 
> What do you actually mean about when ACPI is disabled this work would be

Firstly, please note that "you" is not appropriate here. This is James'
commit message, not mine.

> done by cpu_dev_register_generic()? Is the work means register the cpu?

When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
cpu_dev_register_generic() will call arch_register_cpu() for each present
CPU after this commit, rather than for each _possible_ CPU (which is the
actual code change here.)

> I'm not quite understand that, and how about when ACPI is enabled, which
> function do this work?

This is what happens later in the series.

"drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
with architectures using GENERIC_CPU_DEVICES. Then in:

"ACPI: processor: Register all CPUs from acpi_processor_get_info()"
which is not part of this series, this adds a call to arch_register_cpu()
in the ACPI code, and disables this path via a test for !acpi_disabled.

Essentially, this path gets used to register the present CPUs when
firmware (ACPI) isn't going to be registering the present CPUs.

I've changed this to:

"It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

"To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu().

"Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
step to centralise their register_cpu() logic, before moving it into the
ACPI processor driver. When we add support for register CPUs from ACPI
in a later patch, we will avoid registering CPUs in this path."

which I hope makes it clearer.

> > After this change, openrisc and hexagon systems that use the max_cpus
> > command line argument would not see the other CPUs present in sysfs.
> > This should not be a problem as these CPUs can't bre brought online as
>                                              ^ nit: can't be

Thanks, I'll fix that.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:29       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-09 10:29 UTC (permalink / raw)
  To: Shaoqin Huang
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren

On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
> Hi Russell,
> 
> On 11/7/23 18:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Three of the five ACPI architectures create sysfs entries using
> > register_cpu() for present CPUs, whereas arm64, riscv and all
> > GENERIC_CPU_DEVICES do this for possible CPUs.
> > 
> > Registering a CPU is what causes them to show up in sysfs.
> > 
> > It makes very little sense to register all possible CPUs. Registering
> > a CPU is what triggers the udev notifications allowing user-space to
> > react to newly added CPUs.
> > 
> > To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> > it to use for_each_present_cpu(). Making the ACPI architectures use
> > GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> > cpu_register() logic, before moving it into the ACPI processor driver.
> > When ACPI is disabled this work would be done by
> > cpu_dev_register_generic().
> 
> What do you actually mean about when ACPI is disabled this work would be

Firstly, please note that "you" is not appropriate here. This is James'
commit message, not mine.

> done by cpu_dev_register_generic()? Is the work means register the cpu?

When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
cpu_dev_register_generic() will call arch_register_cpu() for each present
CPU after this commit, rather than for each _possible_ CPU (which is the
actual code change here.)

> I'm not quite understand that, and how about when ACPI is enabled, which
> function do this work?

This is what happens later in the series.

"drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
with architectures using GENERIC_CPU_DEVICES. Then in:

"ACPI: processor: Register all CPUs from acpi_processor_get_info()"
which is not part of this series, this adds a call to arch_register_cpu()
in the ACPI code, and disables this path via a test for !acpi_disabled.

Essentially, this path gets used to register the present CPUs when
firmware (ACPI) isn't going to be registering the present CPUs.

I've changed this to:

"It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

"To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu().

"Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
step to centralise their register_cpu() logic, before moving it into the
ACPI processor driver. When we add support for register CPUs from ACPI
in a later patch, we will avoid registering CPUs in this path."

which I hope makes it clearer.

> > After this change, openrisc and hexagon systems that use the max_cpus
> > command line argument would not see the other CPUs present in sysfs.
> > This should not be a problem as these CPUs can't bre brought online as
>                                              ^ nit: can't be

Thanks, I'll fix that.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:29       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-09 10:29 UTC (permalink / raw)
  To: Shaoqin Huang
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren

On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
> Hi Russell,
> 
> On 11/7/23 18:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Three of the five ACPI architectures create sysfs entries using
> > register_cpu() for present CPUs, whereas arm64, riscv and all
> > GENERIC_CPU_DEVICES do this for possible CPUs.
> > 
> > Registering a CPU is what causes them to show up in sysfs.
> > 
> > It makes very little sense to register all possible CPUs. Registering
> > a CPU is what triggers the udev notifications allowing user-space to
> > react to newly added CPUs.
> > 
> > To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> > it to use for_each_present_cpu(). Making the ACPI architectures use
> > GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> > cpu_register() logic, before moving it into the ACPI processor driver.
> > When ACPI is disabled this work would be done by
> > cpu_dev_register_generic().
> 
> What do you actually mean about when ACPI is disabled this work would be

Firstly, please note that "you" is not appropriate here. This is James'
commit message, not mine.

> done by cpu_dev_register_generic()? Is the work means register the cpu?

When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
cpu_dev_register_generic() will call arch_register_cpu() for each present
CPU after this commit, rather than for each _possible_ CPU (which is the
actual code change here.)

> I'm not quite understand that, and how about when ACPI is enabled, which
> function do this work?

This is what happens later in the series.

"drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
with architectures using GENERIC_CPU_DEVICES. Then in:

"ACPI: processor: Register all CPUs from acpi_processor_get_info()"
which is not part of this series, this adds a call to arch_register_cpu()
in the ACPI code, and disables this path via a test for !acpi_disabled.

Essentially, this path gets used to register the present CPUs when
firmware (ACPI) isn't going to be registering the present CPUs.

I've changed this to:

"It makes very little sense to register all possible CPUs. Registering
a CPU is what triggers the udev notifications allowing user-space to
react to newly added CPUs.

"To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
it to use for_each_present_cpu().

"Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
step to centralise their register_cpu() logic, before moving it into the
ACPI processor driver. When we add support for register CPUs from ACPI
in a later patch, we will avoid registering CPUs in this path."

which I hope makes it clearer.

> > After this change, openrisc and hexagon systems that use the max_cpus
> > command line argument would not see the other CPUs present in sysfs.
> > This should not be a problem as these CPUs can't bre brought online as
>                                              ^ nit: can't be

Thanks, I'll fix that.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-09 10:51     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:51 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:29, 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>
> ---
> 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(-)
> 
> 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)
>   {

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-09 10:51     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:51 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:29, 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>
> ---
> 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(-)
> 
> 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)
>   {

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-09 10:51     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:51 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:29, 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>
> ---
> 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(-)
> 
> 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)
>   {

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
  2023-11-09 10:29       ` Russell King (Oracle)
  (?)
@ 2023-11-09 10:59         ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:59 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren



On 11/9/23 18:29, Russell King (Oracle) wrote:
> On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
>> Hi Russell,
>>
>> On 11/7/23 18:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Three of the five ACPI architectures create sysfs entries using
>>> register_cpu() for present CPUs, whereas arm64, riscv and all
>>> GENERIC_CPU_DEVICES do this for possible CPUs.
>>>
>>> Registering a CPU is what causes them to show up in sysfs.
>>>
>>> It makes very little sense to register all possible CPUs. Registering
>>> a CPU is what triggers the udev notifications allowing user-space to
>>> react to newly added CPUs.
>>>
>>> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
>>> it to use for_each_present_cpu(). Making the ACPI architectures use
>>> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
>>> cpu_register() logic, before moving it into the ACPI processor driver.
>>> When ACPI is disabled this work would be done by
>>> cpu_dev_register_generic().
>>
>> What do you actually mean about when ACPI is disabled this work would be
> 
> Firstly, please note that "you" is not appropriate here. This is James'
> commit message, not mine.
> 

Oh, Sorry for that.

>> done by cpu_dev_register_generic()? Is the work means register the cpu?
> 
> When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
> cpu_dev_register_generic() will call arch_register_cpu() for each present
> CPU after this commit, rather than for each _possible_ CPU (which is the
> actual code change here.)
> 
>> I'm not quite understand that, and how about when ACPI is enabled, which
>> function do this work?
> 
> This is what happens later in the series.
> 
> "drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
> adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
> with architectures using GENERIC_CPU_DEVICES. Then in:
> 
> "ACPI: processor: Register all CPUs from acpi_processor_get_info()"
> which is not part of this series, this adds a call to arch_register_cpu()
> in the ACPI code, and disables this path via a test for !acpi_disabled.
> 
> Essentially, this path gets used to register the present CPUs when
> firmware (ACPI) isn't going to be registering the present CPUs.
> 
> I've changed this to:
> 
> "It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> "To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu().
> 
> "Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
> step to centralise their register_cpu() logic, before moving it into the
> ACPI processor driver. When we add support for register CPUs from ACPI
> in a later patch, we will avoid registering CPUs in this path."
> 
> which I hope makes it clearer.
> 

Thanks for your great explanation. Change commit message to this makes 
me understand well.

Thanks,
Shaoqin

>>> After this change, openrisc and hexagon systems that use the max_cpus
>>> command line argument would not see the other CPUs present in sysfs.
>>> This should not be a problem as these CPUs can't bre brought online as
>>                                               ^ nit: can't be
> 
> Thanks, I'll fix that.
> 


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:59         ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:59 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren



On 11/9/23 18:29, Russell King (Oracle) wrote:
> On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
>> Hi Russell,
>>
>> On 11/7/23 18:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Three of the five ACPI architectures create sysfs entries using
>>> register_cpu() for present CPUs, whereas arm64, riscv and all
>>> GENERIC_CPU_DEVICES do this for possible CPUs.
>>>
>>> Registering a CPU is what causes them to show up in sysfs.
>>>
>>> It makes very little sense to register all possible CPUs. Registering
>>> a CPU is what triggers the udev notifications allowing user-space to
>>> react to newly added CPUs.
>>>
>>> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
>>> it to use for_each_present_cpu(). Making the ACPI architectures use
>>> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
>>> cpu_register() logic, before moving it into the ACPI processor driver.
>>> When ACPI is disabled this work would be done by
>>> cpu_dev_register_generic().
>>
>> What do you actually mean about when ACPI is disabled this work would be
> 
> Firstly, please note that "you" is not appropriate here. This is James'
> commit message, not mine.
> 

Oh, Sorry for that.

>> done by cpu_dev_register_generic()? Is the work means register the cpu?
> 
> When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
> cpu_dev_register_generic() will call arch_register_cpu() for each present
> CPU after this commit, rather than for each _possible_ CPU (which is the
> actual code change here.)
> 
>> I'm not quite understand that, and how about when ACPI is enabled, which
>> function do this work?
> 
> This is what happens later in the series.
> 
> "drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
> adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
> with architectures using GENERIC_CPU_DEVICES. Then in:
> 
> "ACPI: processor: Register all CPUs from acpi_processor_get_info()"
> which is not part of this series, this adds a call to arch_register_cpu()
> in the ACPI code, and disables this path via a test for !acpi_disabled.
> 
> Essentially, this path gets used to register the present CPUs when
> firmware (ACPI) isn't going to be registering the present CPUs.
> 
> I've changed this to:
> 
> "It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> "To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu().
> 
> "Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
> step to centralise their register_cpu() logic, before moving it into the
> ACPI processor driver. When we add support for register CPUs from ACPI
> in a later patch, we will avoid registering CPUs in this path."
> 
> which I hope makes it clearer.
> 

Thanks for your great explanation. Change commit message to this makes 
me understand well.

Thanks,
Shaoqin

>>> After this change, openrisc and hexagon systems that use the max_cpus
>>> command line argument would not see the other CPUs present in sysfs.
>>> This should not be a problem as these CPUs can't bre brought online as
>>                                               ^ nit: can't be
> 
> Thanks, I'll fix that.
> 


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-09 10:59         ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-09 10:59 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Guo Ren



On 11/9/23 18:29, Russell King (Oracle) wrote:
> On Thu, Nov 09, 2023 at 06:09:32PM +0800, Shaoqin Huang wrote:
>> Hi Russell,
>>
>> On 11/7/23 18:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Three of the five ACPI architectures create sysfs entries using
>>> register_cpu() for present CPUs, whereas arm64, riscv and all
>>> GENERIC_CPU_DEVICES do this for possible CPUs.
>>>
>>> Registering a CPU is what causes them to show up in sysfs.
>>>
>>> It makes very little sense to register all possible CPUs. Registering
>>> a CPU is what triggers the udev notifications allowing user-space to
>>> react to newly added CPUs.
>>>
>>> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
>>> it to use for_each_present_cpu(). Making the ACPI architectures use
>>> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
>>> cpu_register() logic, before moving it into the ACPI processor driver.
>>> When ACPI is disabled this work would be done by
>>> cpu_dev_register_generic().
>>
>> What do you actually mean about when ACPI is disabled this work would be
> 
> Firstly, please note that "you" is not appropriate here. This is James'
> commit message, not mine.
> 

Oh, Sorry for that.

>> done by cpu_dev_register_generic()? Is the work means register the cpu?
> 
> When ACPI is disabled _and_ CONFIG_GENERIC_CPU_DEVICES is enabled, then
> cpu_dev_register_generic() will call arch_register_cpu() for each present
> CPU after this commit, rather than for each _possible_ CPU (which is the
> actual code change here.)
> 
>> I'm not quite understand that, and how about when ACPI is enabled, which
>> function do this work?
> 
> This is what happens later in the series.
> 
> "drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden"
> adds a test for CONFIG_GENERIC_CPU_DEVICES, so this will only be used
> with architectures using GENERIC_CPU_DEVICES. Then in:
> 
> "ACPI: processor: Register all CPUs from acpi_processor_get_info()"
> which is not part of this series, this adds a call to arch_register_cpu()
> in the ACPI code, and disables this path via a test for !acpi_disabled.
> 
> Essentially, this path gets used to register the present CPUs when
> firmware (ACPI) isn't going to be registering the present CPUs.
> 
> I've changed this to:
> 
> "It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> "To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu().
> 
> "Making the ACPI architectures use GENERIC_CPU_DEVICES is a pre-requisite
> step to centralise their register_cpu() logic, before moving it into the
> ACPI processor driver. When we add support for register CPUs from ACPI
> in a later patch, we will avoid registering CPUs in this path."
> 
> which I hope makes it clearer.
> 

Thanks for your great explanation. Change commit message to this makes 
me understand well.

Thanks,
Shaoqin

>>> After this change, openrisc and hexagon systems that use the max_cpus
>>> command line argument would not see the other CPUs present in sysfs.
>>> This should not be a problem as these CPUs can't bre brought online as
>>                                               ^ nit: can't be
> 
> Thanks, I'll fix that.
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-10  3:27     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:27 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



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@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.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


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-10  3:27     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:27 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



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@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-10  3:27     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:27 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra



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@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-10  3:35     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:35 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 221ffbeb1c9b..82b6a76125f5 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -	int i;
> +	int i, ret;
>   
>   	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
>   		return;
>   
>   	for_each_present_cpu(i) {
> -		if (arch_register_cpu(i))
> -			panic("Failed to register CPU device");
> +		ret = arch_register_cpu(i);
> +		if (ret)
> +			pr_warn("register_cpu %d failed (%d)\n", i, ret);
>   	}
>   }
>   

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-10  3:35     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:35 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 221ffbeb1c9b..82b6a76125f5 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -	int i;
> +	int i, ret;
>   
>   	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
>   		return;
>   
>   	for_each_present_cpu(i) {
> -		if (arch_register_cpu(i))
> -			panic("Failed to register CPU device");
> +		ret = arch_register_cpu(i);
> +		if (ret)
> +			pr_warn("register_cpu %d failed (%d)\n", i, ret);
>   	}
>   }
>   

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-10  3:35     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:35 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou



On 11/7/23 18:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 221ffbeb1c9b..82b6a76125f5 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -551,14 +551,15 @@ void __weak arch_unregister_cpu(int num)
>   
>   static void __init cpu_dev_register_generic(void)
>   {
> -	int i;
> +	int i, ret;
>   
>   	if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES))
>   		return;
>   
>   	for_each_present_cpu(i) {
> -		if (arch_register_cpu(i))
> -			panic("Failed to register CPU device");
> +		ret = arch_register_cpu(i);
> +		if (ret)
> +			pr_warn("register_cpu %d failed (%d)\n", i, ret);
>   	}
>   }
>   

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-10  3:36     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:36 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> 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)
>   {

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-10  3:36     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:36 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> 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)
>   {

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-10  3:36     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:36 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) 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>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
> 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)
>   {

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-10  3:37     ` Shaoqin Huang
  -1 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>   	return false;
>   }
>   
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>   {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>   }
>   
>   static void dump_kernel_offset(void)

-- 
Shaoqin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-10  3:37     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>   	return false;
>   }
>   
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>   {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>   }
>   
>   static void dump_kernel_offset(void)

-- 
Shaoqin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-10  3:37     ` Shaoqin Huang
  0 siblings, 0 replies; 258+ messages in thread
From: Shaoqin Huang @ 2023-11-10  3:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon



On 11/7/23 18:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>   	return false;
>   }
>   
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>   {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>   }
>   
>   static void dump_kernel_offset(void)

-- 
Shaoqin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:03     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-13  0:03     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-13  0:03     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:04     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.
> ---
>   drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
>   1 file changed, 26 insertions(+), 12 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-13  0:04     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.
> ---
>   drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
>   1 file changed, 26 insertions(+), 12 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-13  0:04     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.
> ---
>   drivers/base/arch_topology.c | 38 ++++++++++++++++++++++++------------
>   1 file changed, 26 insertions(+), 12 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
  2023-11-07 10:29   ` Russell King (Oracle)
  (?)
@ 2023-11-13  0:08     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:08 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-13  0:08     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:08 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-13  0:08     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:08 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
  2023-11-07 10:29   ` Russell King (Oracle)
  (?)
@ 2023-11-13  0:11     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:11 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-13  0:11     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:11 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-13  0:11     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:11 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:29, Russell King (Oracle) wrote:
> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 2 --
>   1 file changed, 2 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:29     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:29 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 

With the following nits addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -

Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
x86 and loongarch because they're not called from a module?

>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

Thanks,
Gavin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13  0:29     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:29 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 

With the following nits addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -

Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
x86 and loongarch because they're not called from a module?

>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

Thanks,
Gavin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13  0:29     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:29 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Rafael J. Wysocki, Len Brown, Paul Walmsley, Palmer Dabbelt,
	Albert Ou

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>     HOTPLUG_CPU isn't.
> Changes since RFC v3:
>   * Dropped ia64 changes
> ---
>   arch/loongarch/Kconfig        |  1 +
>   arch/x86/Kconfig              |  1 +
>   drivers/acpi/Kconfig          |  1 -
>   drivers/acpi/acpi_processor.c | 18 ------------------
>   4 files changed, 2 insertions(+), 19 deletions(-)
> 

With the following nits addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d889a0b97bc1..64620e90c12c 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -5,6 +5,7 @@ config LOONGARCH
>   	select ACPI
>   	select ACPI_GENERIC_GSI if ACPI
>   	select ACPI_MCFG if ACPI
> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_PPTT if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>   	select ARCH_BINFMT_ELF_STATE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 3762f41bb092..dbdcfc708369 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -59,6 +59,7 @@ config X86
>   	#
>   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ARCH_32BIT_OFF_T			if X86_32
>   	select ARCH_CLOCKSOURCE_INIT
>   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index f819e760ff19..a3acfc750fce 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>   	bool
>   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>   	select ACPI_CONTAINER
> -	default y
>   
>   config ACPI_PROCESSOR_AGGREGATOR
>   	tristate "Processor Aggregator"
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 0f5218e361df..4fe2ef54088c 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>   
>   /* Initialization */
>   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> -int __weak acpi_map_cpu(acpi_handle handle,
> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak acpi_unmap_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -int __weak arch_register_cpu(int cpu)
> -{
> -	return -ENODEV;
> -}
> -
> -void __weak arch_unregister_cpu(int cpu) {}
> -

Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
x86 and loongarch because they're not called from a module?

>   static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>   {
>   	unsigned long long sta;

Thanks,
Gavin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:37     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().
> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-13  0:37     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().
> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 06/22] drivers: base: Use present CPUs in GENERIC_CPU_DEVICES
@ 2023-11-13  0:37     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:37 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Three of the five ACPI architectures create sysfs entries using
> register_cpu() for present CPUs, whereas arm64, riscv and all
> GENERIC_CPU_DEVICES do this for possible CPUs.
> 
> Registering a CPU is what causes them to show up in sysfs.
> 
> It makes very little sense to register all possible CPUs. Registering
> a CPU is what triggers the udev notifications allowing user-space to
> react to newly added CPUs.
> 
> To allow all five ACPI architectures to use GENERIC_CPU_DEVICES, change
> it to use for_each_present_cpu(). Making the ACPI architectures use
> GENERIC_CPU_DEVICES is a pre-requisite step to centralise their
> cpu_register() logic, before moving it into the ACPI processor driver.
> When ACPI is disabled this work would be done by
> cpu_dev_register_generic().
> 
> Of the ACPI architectures that register possible CPUs, arm64 and riscv
> do not support making possible CPUs present as they use the weak 'always
> fails' version of arch_register_cpu().
> 
> Only two of the eight architectures that use GENERIC_CPU_DEVICES have a
> distinction between present and possible CPUs.
> 
> The following architectures use GENERIC_CPU_DEVICES but are not SMP,
> so possible == present:
>   * m68k
>   * microblaze
>   * nios2
> 
> The following architectures use GENERIC_CPU_DEVICES and consider
> possible == present:
>   * csky: setup_smp()
>   * processor_probe() sets possible for all CPUs and present for all CPUs
>     except the boot cpu, which will have been done by
>     init/main.c::start_kernel().
> 
> um appears to be a subarchitecture of x86.
> 
> The remaining architecture using GENERIC_CPU_DEVICES are:
>   * openrisc and hexagon:
>     where smp_init_cpus() makes all CPUs < NR_CPUS possible,
>     whereas smp_prepare_cpus() only makes CPUs < setup_max_cpus present.
> 
> After this change, openrisc and hexagon systems that use the max_cpus
> command line argument would not see the other CPUs present in sysfs.
> This should not be a problem as these CPUs can't bre brought online as
> _cpu_up() checks cpu_present().
> 
> After this change, only CPUs which are present appear in sysfs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:42     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:42 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-13  0:42     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:42 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-13  0:42     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:42 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20:29, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC:
>   * Dropped __init from x86/ia64 arch_register_cpu()
> Changes since RFC v2:
>   * Dropped unnecessary Loongarch asm/cpu.h changes
> ---
>   drivers/base/cpu.c  | 14 ++++++++++----
>   include/linux/cpu.h |  4 ++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-13  0:45     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:45 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/7/23 20:29, 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>
> ---
> 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>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-13  0:45     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:45 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/7/23 20:29, 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>
> ---
> 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>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-13  0:45     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:45 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/7/23 20:29, 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>
> ---
> 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>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-13  0:56     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:56 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20: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@armlinux.org.uk>
> ---
>   drivers/base/cpu.c  | 11 ++++++++++-
>   include/linux/cpu.h |  1 +
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-13  0:56     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:56 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20: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@armlinux.org.uk>
> ---
>   drivers/base/cpu.c  | 11 ++++++++++-
>   include/linux/cpu.h |  1 +
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-13  0:56     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:56 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Peter Zijlstra

On 11/7/23 20: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@armlinux.org.uk>
> ---
>   drivers/base/cpu.c  | 11 ++++++++++-
>   include/linux/cpu.h |  1 +
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-13  0:58     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:58 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki



On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> NUMA systems require the node descriptions to be ready before CPUs are
> registered. This is so that the node symlinks can be created in sysfs.
> 
> Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> are registered by arch code, instead of cpu_dev_init().
> 
> Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> can use GENERIC_CPU_DEVICES.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Note: Jonathan's comment still needs addressing - see
>    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> ---
>   drivers/base/init.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

With Jonathan's comments addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-13  0:58     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:58 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki



On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> NUMA systems require the node descriptions to be ready before CPUs are
> registered. This is so that the node symlinks can be created in sysfs.
> 
> Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> are registered by arch code, instead of cpu_dev_init().
> 
> Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> can use GENERIC_CPU_DEVICES.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Note: Jonathan's comment still needs addressing - see
>    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> ---
>   drivers/base/init.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

With Jonathan's comments addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-13  0:58     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  0:58 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki



On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> NUMA systems require the node descriptions to be ready before CPUs are
> registered. This is so that the node symlinks can be created in sysfs.
> 
> Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> are registered by arch code, instead of cpu_dev_init().
> 
> Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> can use GENERIC_CPU_DEVICES.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Note: Jonathan's comment still needs addressing - see
>    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> ---
>   drivers/base/init.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

With Jonathan's comments addressed:

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-13  4:03     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-13  4:03     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-13  4:03     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:03 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>
> ---
>   drivers/base/cpu.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:04     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> can remove some redundant code.
> 
> node_dev_init() will walk through the nodes calling register_one_node()
> on each. This will trickle down to __register_one_node() which walks
> all present CPUs, calling register_cpu_under_node() on each.
> 
> register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> will return NULL until the CPU is registered using register_cpu(). This
> now happens _after_ node_dev_init().
> 
> Therefore, calling register_cpu_under_node() from __register_one_node()
> becomes a no-op, and can be removed.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/node.c | 7 -------
>   1 file changed, 7 deletions(-)
> 

__register_one_node() can be called in memory hot add path either. In that path,
a new NUMA node can be presented and becomes online. Does this become a problem
after the logic of associating CPU with newly added NUMA node?

Thanks,
Gavin

> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 493d533f8375..4d5ac7cf8757 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
>   int __register_one_node(int nid)
>   {
>   	int error;
> -	int cpu;
>   
>   	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
>   	if (!node_devices[nid])
> @@ -875,12 +874,6 @@ int __register_one_node(int nid)
>   
>   	error = register_node(node_devices[nid], nid);
>   
> -	/* link cpu under this node */
> -	for_each_present_cpu(cpu) {
> -		if (cpu_to_node(cpu) == nid)
> -			register_cpu_under_node(cpu, nid);
> -	}
> -
>   	INIT_LIST_HEAD(&node_devices[nid]->access_list);
>   	node_init_caches(nid);
>   


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-13  4:04     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> can remove some redundant code.
> 
> node_dev_init() will walk through the nodes calling register_one_node()
> on each. This will trickle down to __register_one_node() which walks
> all present CPUs, calling register_cpu_under_node() on each.
> 
> register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> will return NULL until the CPU is registered using register_cpu(). This
> now happens _after_ node_dev_init().
> 
> Therefore, calling register_cpu_under_node() from __register_one_node()
> becomes a no-op, and can be removed.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/node.c | 7 -------
>   1 file changed, 7 deletions(-)
> 

__register_one_node() can be called in memory hot add path either. In that path,
a new NUMA node can be presented and becomes online. Does this become a problem
after the logic of associating CPU with newly added NUMA node?

Thanks,
Gavin

> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 493d533f8375..4d5ac7cf8757 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
>   int __register_one_node(int nid)
>   {
>   	int error;
> -	int cpu;
>   
>   	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
>   	if (!node_devices[nid])
> @@ -875,12 +874,6 @@ int __register_one_node(int nid)
>   
>   	error = register_node(node_devices[nid], nid);
>   
> -	/* link cpu under this node */
> -	for_each_present_cpu(cpu) {
> -		if (cpu_to_node(cpu) == nid)
> -			register_cpu_under_node(cpu, nid);
> -	}
> -
>   	INIT_LIST_HEAD(&node_devices[nid]->access_list);
>   	node_init_caches(nid);
>   


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-13  4:04     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:04 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> can remove some redundant code.
> 
> node_dev_init() will walk through the nodes calling register_one_node()
> on each. This will trickle down to __register_one_node() which walks
> all present CPUs, calling register_cpu_under_node() on each.
> 
> register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> will return NULL until the CPU is registered using register_cpu(). This
> now happens _after_ node_dev_init().
> 
> Therefore, calling register_cpu_under_node() from __register_one_node()
> becomes a no-op, and can be removed.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/base/node.c | 7 -------
>   1 file changed, 7 deletions(-)
> 

__register_one_node() can be called in memory hot add path either. In that path,
a new NUMA node can be presented and becomes online. Does this become a problem
after the logic of associating CPU with newly added NUMA node?

Thanks,
Gavin

> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 493d533f8375..4d5ac7cf8757 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -867,7 +867,6 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
>   int __register_one_node(int nid)
>   {
>   	int error;
> -	int cpu;
>   
>   	node_devices[nid] = kzalloc(sizeof(struct node), GFP_KERNEL);
>   	if (!node_devices[nid])
> @@ -875,12 +874,6 @@ int __register_one_node(int nid)
>   
>   	error = register_node(node_devices[nid], nid);
>   
> -	/* link cpu under this node */
> -	for_each_present_cpu(cpu) {
> -		if (cpu_to_node(cpu) == nid)
> -			register_cpu_under_node(cpu, nid);
> -	}
> -
>   	INIT_LIST_HEAD(&node_devices[nid]->access_list);
>   	node_init_caches(nid);
>   


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-13  4:07     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:07 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

On 11/7/23 20:30, Russell King (Oracle) 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>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-13  4:07     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:07 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

On 11/7/23 20:30, Russell King (Oracle) 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>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-13  4:07     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:07 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon

On 11/7/23 20:30, Russell King (Oracle) 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>
> ---
> 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(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:09     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon


On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-13  4:09     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon


On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-13  4:09     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:09 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Catalin Marinas, Will Deacon


On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/arm64/kernel/setup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-13  4:13     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ----
> Changes since RFC:
>   * Fixed the second copy of arch_register_cpu() used for non-hotplug
> Changes since RFC v2:
>   * Remove duplicate of the weak generic arch_register_cpu(), spotted
>     by Jonathan Cameron. Add note about initialisation order change.
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/Kconfig           |  1 +
>   arch/x86/include/asm/cpu.h |  4 ----
>   arch/x86/kernel/topology.c | 27 ++++-----------------------
>   3 files changed, 5 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:13     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ----
> Changes since RFC:
>   * Fixed the second copy of arch_register_cpu() used for non-hotplug
> Changes since RFC v2:
>   * Remove duplicate of the weak generic arch_register_cpu(), spotted
>     by Jonathan Cameron. Add note about initialisation order change.
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/Kconfig           |  1 +
>   arch/x86/include/asm/cpu.h |  4 ----
>   arch/x86/kernel/topology.c | 27 ++++-----------------------
>   3 files changed, 5 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:13     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:13 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ----
> Changes since RFC:
>   * Fixed the second copy of arch_register_cpu() used for non-hotplug
> Changes since RFC v2:
>   * Remove duplicate of the weak generic arch_register_cpu(), spotted
>     by Jonathan Cameron. Add note about initialisation order change.
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/Kconfig           |  1 +
>   arch/x86/include/asm/cpu.h |  4 ----
>   arch/x86/kernel/topology.c | 27 ++++-----------------------
>   3 files changed, 5 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:16     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:16 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/kernel/topology.c | 5 -----
>   1 file changed, 5 deletions(-)
> 

PATCH[16/22] can be folded to PATCH[15/22] since arch_unregister_cpu() was just
added in PATCH[15/22]. Anyway, the changes make sense to me.

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index c2ed3145a93b..211863cb5b81 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
>   	c->hotpluggable = cpu > 0;
>   	return register_cpu(c, cpu);
>   }
> -
> -void arch_unregister_cpu(int num)
> -{
> -	unregister_cpu(&per_cpu(cpu_devices, num));
> -}
>   #endif /* CONFIG_HOTPLUG_CPU */


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-13  4:16     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:16 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/kernel/topology.c | 5 -----
>   1 file changed, 5 deletions(-)
> 

PATCH[16/22] can be folded to PATCH[15/22] since arch_unregister_cpu() was just
added in PATCH[15/22]. Anyway, the changes make sense to me.

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index c2ed3145a93b..211863cb5b81 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
>   	c->hotpluggable = cpu > 0;
>   	return register_cpu(c, cpu);
>   }
> -
> -void arch_unregister_cpu(int num)
> -{
> -	unregister_cpu(&per_cpu(cpu_devices, num));
> -}
>   #endif /* CONFIG_HOTPLUG_CPU */


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-13  4:16     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:16 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v3:
>   * Adapt to removal of EXPORT_SYMBOL()s
> ---
>   arch/x86/kernel/topology.c | 5 -----
>   1 file changed, 5 deletions(-)
> 

PATCH[16/22] can be folded to PATCH[15/22] since arch_unregister_cpu() was just
added in PATCH[15/22]. Anyway, the changes make sense to me.

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index c2ed3145a93b..211863cb5b81 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -43,9 +43,4 @@ int arch_register_cpu(int cpu)
>   	c->hotpluggable = cpu > 0;
>   	return register_cpu(c, cpu);
>   }
> -
> -void arch_unregister_cpu(int num)
> -{
> -	unregister_cpu(&per_cpu(cpu_devices, num));
> -}
>   #endif /* CONFIG_HOTPLUG_CPU */


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:18     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:18 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:18     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:18 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:18     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:18 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

On 11/7/23 20:30, Russell King (Oracle) wrote:
> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/x86/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-13  4:20     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:20 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>    io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>    hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Explain the change in behaviour in the patch description
>     (highlighted by Jonathan Cameron - thanks.) Add note about
>     initialisation order change.
> ---
>   arch/loongarch/Kconfig           |  1 +
>   arch/loongarch/kernel/topology.c | 29 ++---------------------------
>   2 files changed, 3 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:20     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:20 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>    io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>    hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Explain the change in behaviour in the patch description
>     (highlighted by Jonathan Cameron - thanks.) Add note about
>     initialisation order change.
> ---
>   arch/loongarch/Kconfig           |  1 +
>   arch/loongarch/kernel/topology.c | 29 ++---------------------------
>   2 files changed, 3 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:20     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:20 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:30, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>    io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>    hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Explain the change in behaviour in the patch description
>     (highlighted by Jonathan Cameron - thanks.) Add note about
>     initialisation order change.
> ---
>   arch/loongarch/Kconfig           |  1 +
>   arch/loongarch/kernel/topology.c | 29 ++---------------------------
>   2 files changed, 3 insertions(+), 27 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:31   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:22     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:22 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:22     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:22 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:22     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:22 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Huacai Chen, WANG Xuerui

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/loongarch/kernel/topology.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:31   ` Russell King
  (?)
@ 2023-11-13  4:23     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:23 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Add note about initialisation order change.
> ---
>   arch/riscv/Kconfig        |  1 +
>   arch/riscv/kernel/setup.c | 19 ++++---------------
>   2 files changed, 5 insertions(+), 15 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:23     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:23 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Add note about initialisation order change.
> ---
>   arch/riscv/Kconfig        |  1 +
>   arch/riscv/kernel/setup.c | 19 ++++---------------
>   2 files changed, 5 insertions(+), 15 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 21/22] riscv: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-13  4:23     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:23 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Changes since RFC v2:
>   * Add note about initialisation order change.
> ---
>   arch/riscv/Kconfig        |  1 +
>   arch/riscv/kernel/setup.c | 19 ++++---------------
>   2 files changed, 5 insertions(+), 15 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:31   ` Russell King (Oracle)
  (?)
@ 2023-11-13  4:24     ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:24 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/riscv/kernel/setup.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:24     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:24 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/riscv/kernel/setup.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-13  4:24     ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13  4:24 UTC (permalink / raw)
  To: Russell King (Oracle),
	linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Paul Walmsley, Palmer Dabbelt, Albert Ou

On 11/7/23 20:31, Russell King (Oracle) wrote:
> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>   arch/riscv/kernel/setup.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-13  0:58     ` Gavin Shan
  (?)
@ 2023-11-13  8:00       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:00 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:

That needs James' input, which is why I made the note on the patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-13  8:00       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:00 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:

That needs James' input, which is why I made the note on the patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-13  8:00       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:00 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:

That needs James' input, which is why I made the note on the patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-13  0:29     ` Gavin Shan
  (?)
@ 2023-11-13  8:56       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:56 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
> On 11/7/23 20:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Neither arm64 nor riscv support physical hotadd of CPUs that were not
> > present at boot. For arm64 much of the platform description is in static
> > tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> > which is backed by a firmware interface to turn CPUs on and off.
> > 
> > acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> > and removing CPUs that were not present at boot. arm64 systems that do this
> > are not supported as there is currently insufficient information in the
> > platform description. (e.g. did the GICR get removed too?)
> > 
> > arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> > to prevent CPUs that were not described as present at boot from being
> > added to the system. Similarly, riscv relies on the same check in
> > map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> > definitions of acpi_map_cpu() and arch_register_cpu().
> > 
> > Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> > CPUs present. Neither arm64 nor riscv support this.
> > 
> > Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> > selecting it on the other three ACPI architectures. This allows the weak
> > definitions of some symbols to be removed.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Changes since RFC:
> >   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
> >     HOTPLUG_CPU isn't.
> > Changes since RFC v3:
> >   * Dropped ia64 changes
> > ---
> >   arch/loongarch/Kconfig        |  1 +
> >   arch/x86/Kconfig              |  1 +
> >   drivers/acpi/Kconfig          |  1 -
> >   drivers/acpi/acpi_processor.c | 18 ------------------
> >   4 files changed, 2 insertions(+), 19 deletions(-)
> > 
> 
> With the following nits addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> 
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index d889a0b97bc1..64620e90c12c 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > @@ -5,6 +5,7 @@ config LOONGARCH
> >   	select ACPI
> >   	select ACPI_GENERIC_GSI if ACPI
> >   	select ACPI_MCFG if ACPI
> > +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_PPTT if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> >   	select ARCH_BINFMT_ELF_STATE
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 3762f41bb092..dbdcfc708369 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -59,6 +59,7 @@ config X86
> >   	#
> >   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> > +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ARCH_32BIT_OFF_T			if X86_32
> >   	select ARCH_CLOCKSOURCE_INIT
> >   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index f819e760ff19..a3acfc750fce 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
> >   	bool
> >   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_CONTAINER
> > -	default y
> >   config ACPI_PROCESSOR_AGGREGATOR
> >   	tristate "Processor Aggregator"
> > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> > index 0f5218e361df..4fe2ef54088c 100644
> > --- a/drivers/acpi/acpi_processor.c
> > +++ b/drivers/acpi/acpi_processor.c
> > @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
> >   /* Initialization */
> >   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> > -int __weak acpi_map_cpu(acpi_handle handle,
> > -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak acpi_unmap_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak arch_register_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -void __weak arch_unregister_cpu(int cpu) {}
> > -
> 
> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
> x86 and loongarch because they're not called from a module?

I'm confused, and don't understand your comment. You've r-b the
previous two patches that remove the EXPORT_SYMBOL()s for
arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
So it seems your comment is already addressed, and thus makes no
sense.

Please clarify.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13  8:56       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:56 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
> On 11/7/23 20:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Neither arm64 nor riscv support physical hotadd of CPUs that were not
> > present at boot. For arm64 much of the platform description is in static
> > tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> > which is backed by a firmware interface to turn CPUs on and off.
> > 
> > acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> > and removing CPUs that were not present at boot. arm64 systems that do this
> > are not supported as there is currently insufficient information in the
> > platform description. (e.g. did the GICR get removed too?)
> > 
> > arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> > to prevent CPUs that were not described as present at boot from being
> > added to the system. Similarly, riscv relies on the same check in
> > map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> > definitions of acpi_map_cpu() and arch_register_cpu().
> > 
> > Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> > CPUs present. Neither arm64 nor riscv support this.
> > 
> > Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> > selecting it on the other three ACPI architectures. This allows the weak
> > definitions of some symbols to be removed.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Changes since RFC:
> >   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
> >     HOTPLUG_CPU isn't.
> > Changes since RFC v3:
> >   * Dropped ia64 changes
> > ---
> >   arch/loongarch/Kconfig        |  1 +
> >   arch/x86/Kconfig              |  1 +
> >   drivers/acpi/Kconfig          |  1 -
> >   drivers/acpi/acpi_processor.c | 18 ------------------
> >   4 files changed, 2 insertions(+), 19 deletions(-)
> > 
> 
> With the following nits addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> 
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index d889a0b97bc1..64620e90c12c 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > @@ -5,6 +5,7 @@ config LOONGARCH
> >   	select ACPI
> >   	select ACPI_GENERIC_GSI if ACPI
> >   	select ACPI_MCFG if ACPI
> > +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_PPTT if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> >   	select ARCH_BINFMT_ELF_STATE
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 3762f41bb092..dbdcfc708369 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -59,6 +59,7 @@ config X86
> >   	#
> >   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> > +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ARCH_32BIT_OFF_T			if X86_32
> >   	select ARCH_CLOCKSOURCE_INIT
> >   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index f819e760ff19..a3acfc750fce 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
> >   	bool
> >   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_CONTAINER
> > -	default y
> >   config ACPI_PROCESSOR_AGGREGATOR
> >   	tristate "Processor Aggregator"
> > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> > index 0f5218e361df..4fe2ef54088c 100644
> > --- a/drivers/acpi/acpi_processor.c
> > +++ b/drivers/acpi/acpi_processor.c
> > @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
> >   /* Initialization */
> >   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> > -int __weak acpi_map_cpu(acpi_handle handle,
> > -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak acpi_unmap_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak arch_register_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -void __weak arch_unregister_cpu(int cpu) {}
> > -
> 
> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
> x86 and loongarch because they're not called from a module?

I'm confused, and don't understand your comment. You've r-b the
previous two patches that remove the EXPORT_SYMBOL()s for
arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
So it seems your comment is already addressed, and thus makes no
sense.

Please clarify.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13  8:56       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-13  8:56 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
> On 11/7/23 20:29, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > Neither arm64 nor riscv support physical hotadd of CPUs that were not
> > present at boot. For arm64 much of the platform description is in static
> > tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> > which is backed by a firmware interface to turn CPUs on and off.
> > 
> > acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> > and removing CPUs that were not present at boot. arm64 systems that do this
> > are not supported as there is currently insufficient information in the
> > platform description. (e.g. did the GICR get removed too?)
> > 
> > arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> > to prevent CPUs that were not described as present at boot from being
> > added to the system. Similarly, riscv relies on the same check in
> > map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> > definitions of acpi_map_cpu() and arch_register_cpu().
> > 
> > Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> > CPUs present. Neither arm64 nor riscv support this.
> > 
> > Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> > selecting it on the other three ACPI architectures. This allows the weak
> > definitions of some symbols to be removed.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Changes since RFC:
> >   * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
> >     HOTPLUG_CPU isn't.
> > Changes since RFC v3:
> >   * Dropped ia64 changes
> > ---
> >   arch/loongarch/Kconfig        |  1 +
> >   arch/x86/Kconfig              |  1 +
> >   drivers/acpi/Kconfig          |  1 -
> >   drivers/acpi/acpi_processor.c | 18 ------------------
> >   4 files changed, 2 insertions(+), 19 deletions(-)
> > 
> 
> With the following nits addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> 
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index d889a0b97bc1..64620e90c12c 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > @@ -5,6 +5,7 @@ config LOONGARCH
> >   	select ACPI
> >   	select ACPI_GENERIC_GSI if ACPI
> >   	select ACPI_MCFG if ACPI
> > +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_PPTT if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> >   	select ARCH_BINFMT_ELF_STATE
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 3762f41bb092..dbdcfc708369 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -59,6 +59,7 @@ config X86
> >   	#
> >   	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
> >   	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
> > +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ARCH_32BIT_OFF_T			if X86_32
> >   	select ARCH_CLOCKSOURCE_INIT
> >   	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index f819e760ff19..a3acfc750fce 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
> >   	bool
> >   	depends on ACPI_PROCESSOR && HOTPLUG_CPU
> >   	select ACPI_CONTAINER
> > -	default y
> >   config ACPI_PROCESSOR_AGGREGATOR
> >   	tristate "Processor Aggregator"
> > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> > index 0f5218e361df..4fe2ef54088c 100644
> > --- a/drivers/acpi/acpi_processor.c
> > +++ b/drivers/acpi/acpi_processor.c
> > @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
> >   /* Initialization */
> >   #ifdef CONFIG_ACPI_HOTPLUG_CPU
> > -int __weak acpi_map_cpu(acpi_handle handle,
> > -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak acpi_unmap_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -int __weak arch_register_cpu(int cpu)
> > -{
> > -	return -ENODEV;
> > -}
> > -
> > -void __weak arch_unregister_cpu(int cpu) {}
> > -
> 
> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
> x86 and loongarch because they're not called from a module?

I'm confused, and don't understand your comment. You've r-b the
previous two patches that remove the EXPORT_SYMBOL()s for
arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
So it seems your comment is already addressed, and thus makes no
sense.

Please clarify.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-13  8:56       ` Russell King (Oracle)
  (?)
@ 2023-11-13 10:01         ` Gavin Shan
  -1 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13 10:01 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/13/23 18:56, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
>> On 11/7/23 20:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Neither arm64 nor riscv support physical hotadd of CPUs that were not
>>> present at boot. For arm64 much of the platform description is in static
>>> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
>>> which is backed by a firmware interface to turn CPUs on and off.
>>>
>>> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
>>> and removing CPUs that were not present at boot. arm64 systems that do this
>>> are not supported as there is currently insufficient information in the
>>> platform description. (e.g. did the GICR get removed too?)
>>>
>>> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
>>> to prevent CPUs that were not described as present at boot from being
>>> added to the system. Similarly, riscv relies on the same check in
>>> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
>>> definitions of acpi_map_cpu() and arch_register_cpu().
>>>
>>> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
>>> CPUs present. Neither arm64 nor riscv support this.
>>>
>>> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
>>> selecting it on the other three ACPI architectures. This allows the weak
>>> definitions of some symbols to be removed.
>>>
>>> Signed-off-by: James Morse <james.morse@arm.com>
>>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>>> ---
>>> Changes since RFC:
>>>    * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>>>      HOTPLUG_CPU isn't.
>>> Changes since RFC v3:
>>>    * Dropped ia64 changes
>>> ---
>>>    arch/loongarch/Kconfig        |  1 +
>>>    arch/x86/Kconfig              |  1 +
>>>    drivers/acpi/Kconfig          |  1 -
>>>    drivers/acpi/acpi_processor.c | 18 ------------------
>>>    4 files changed, 2 insertions(+), 19 deletions(-)
>>>
>>
>> With the following nits addressed:
>>
>> Reviewed-by: Gavin Shan <gshan@redhat.com>
>>
>>> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
>>> index d889a0b97bc1..64620e90c12c 100644
>>> --- a/arch/loongarch/Kconfig
>>> +++ b/arch/loongarch/Kconfig
>>> @@ -5,6 +5,7 @@ config LOONGARCH
>>>    	select ACPI
>>>    	select ACPI_GENERIC_GSI if ACPI
>>>    	select ACPI_MCFG if ACPI
>>> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_PPTT if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>>    	select ARCH_BINFMT_ELF_STATE
>>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>>> index 3762f41bb092..dbdcfc708369 100644
>>> --- a/arch/x86/Kconfig
>>> +++ b/arch/x86/Kconfig
>>> @@ -59,6 +59,7 @@ config X86
>>>    	#
>>>    	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ARCH_32BIT_OFF_T			if X86_32
>>>    	select ARCH_CLOCKSOURCE_INIT
>>>    	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>> index f819e760ff19..a3acfc750fce 100644
>>> --- a/drivers/acpi/Kconfig
>>> +++ b/drivers/acpi/Kconfig
>>> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>>>    	bool
>>>    	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_CONTAINER
>>> -	default y
>>>    config ACPI_PROCESSOR_AGGREGATOR
>>>    	tristate "Processor Aggregator"
>>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>>> index 0f5218e361df..4fe2ef54088c 100644
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>>>    /* Initialization */
>>>    #ifdef CONFIG_ACPI_HOTPLUG_CPU
>>> -int __weak acpi_map_cpu(acpi_handle handle,
>>> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak acpi_unmap_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak arch_register_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -void __weak arch_unregister_cpu(int cpu) {}
>>> -
>>
>> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
>> x86 and loongarch because they're not called from a module?
> 
> I'm confused, and don't understand your comment. You've r-b the
> previous two patches that remove the EXPORT_SYMBOL()s for
> arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
> So it seems your comment is already addressed, and thus makes no
> sense.
> 
> Please clarify.
> 

Exactly, I must be looking into wrong code when reviewing this patch.
Please ignore my comments and my r-b still valid. Sorry for the
unnecessary confusion.

Thanks,
Gavin


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13 10:01         ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13 10:01 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/13/23 18:56, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
>> On 11/7/23 20:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Neither arm64 nor riscv support physical hotadd of CPUs that were not
>>> present at boot. For arm64 much of the platform description is in static
>>> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
>>> which is backed by a firmware interface to turn CPUs on and off.
>>>
>>> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
>>> and removing CPUs that were not present at boot. arm64 systems that do this
>>> are not supported as there is currently insufficient information in the
>>> platform description. (e.g. did the GICR get removed too?)
>>>
>>> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
>>> to prevent CPUs that were not described as present at boot from being
>>> added to the system. Similarly, riscv relies on the same check in
>>> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
>>> definitions of acpi_map_cpu() and arch_register_cpu().
>>>
>>> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
>>> CPUs present. Neither arm64 nor riscv support this.
>>>
>>> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
>>> selecting it on the other three ACPI architectures. This allows the weak
>>> definitions of some symbols to be removed.
>>>
>>> Signed-off-by: James Morse <james.morse@arm.com>
>>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>>> ---
>>> Changes since RFC:
>>>    * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>>>      HOTPLUG_CPU isn't.
>>> Changes since RFC v3:
>>>    * Dropped ia64 changes
>>> ---
>>>    arch/loongarch/Kconfig        |  1 +
>>>    arch/x86/Kconfig              |  1 +
>>>    drivers/acpi/Kconfig          |  1 -
>>>    drivers/acpi/acpi_processor.c | 18 ------------------
>>>    4 files changed, 2 insertions(+), 19 deletions(-)
>>>
>>
>> With the following nits addressed:
>>
>> Reviewed-by: Gavin Shan <gshan@redhat.com>
>>
>>> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
>>> index d889a0b97bc1..64620e90c12c 100644
>>> --- a/arch/loongarch/Kconfig
>>> +++ b/arch/loongarch/Kconfig
>>> @@ -5,6 +5,7 @@ config LOONGARCH
>>>    	select ACPI
>>>    	select ACPI_GENERIC_GSI if ACPI
>>>    	select ACPI_MCFG if ACPI
>>> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_PPTT if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>>    	select ARCH_BINFMT_ELF_STATE
>>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>>> index 3762f41bb092..dbdcfc708369 100644
>>> --- a/arch/x86/Kconfig
>>> +++ b/arch/x86/Kconfig
>>> @@ -59,6 +59,7 @@ config X86
>>>    	#
>>>    	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ARCH_32BIT_OFF_T			if X86_32
>>>    	select ARCH_CLOCKSOURCE_INIT
>>>    	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>> index f819e760ff19..a3acfc750fce 100644
>>> --- a/drivers/acpi/Kconfig
>>> +++ b/drivers/acpi/Kconfig
>>> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>>>    	bool
>>>    	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_CONTAINER
>>> -	default y
>>>    config ACPI_PROCESSOR_AGGREGATOR
>>>    	tristate "Processor Aggregator"
>>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>>> index 0f5218e361df..4fe2ef54088c 100644
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>>>    /* Initialization */
>>>    #ifdef CONFIG_ACPI_HOTPLUG_CPU
>>> -int __weak acpi_map_cpu(acpi_handle handle,
>>> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak acpi_unmap_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak arch_register_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -void __weak arch_unregister_cpu(int cpu) {}
>>> -
>>
>> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
>> x86 and loongarch because they're not called from a module?
> 
> I'm confused, and don't understand your comment. You've r-b the
> previous two patches that remove the EXPORT_SYMBOL()s for
> arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
> So it seems your comment is already addressed, and thus makes no
> sense.
> 
> Please clarify.
> 

Exactly, I must be looking into wrong code when reviewing this patch.
Please ignore my comments and my r-b still valid. Sorry for the
unnecessary confusion.

Thanks,
Gavin


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-13 10:01         ` Gavin Shan
  0 siblings, 0 replies; 258+ messages in thread
From: Gavin Shan @ 2023-11-13 10:01 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou


On 11/13/23 18:56, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:29:39AM +1000, Gavin Shan wrote:
>> On 11/7/23 20:29, Russell King (Oracle) wrote:
>>> From: James Morse <james.morse@arm.com>
>>>
>>> Neither arm64 nor riscv support physical hotadd of CPUs that were not
>>> present at boot. For arm64 much of the platform description is in static
>>> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
>>> which is backed by a firmware interface to turn CPUs on and off.
>>>
>>> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
>>> and removing CPUs that were not present at boot. arm64 systems that do this
>>> are not supported as there is currently insufficient information in the
>>> platform description. (e.g. did the GICR get removed too?)
>>>
>>> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
>>> to prevent CPUs that were not described as present at boot from being
>>> added to the system. Similarly, riscv relies on the same check in
>>> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
>>> definitions of acpi_map_cpu() and arch_register_cpu().
>>>
>>> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
>>> CPUs present. Neither arm64 nor riscv support this.
>>>
>>> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
>>> selecting it on the other three ACPI architectures. This allows the weak
>>> definitions of some symbols to be removed.
>>>
>>> Signed-off-by: James Morse <james.morse@arm.com>
>>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>>> ---
>>> Changes since RFC:
>>>    * Expanded conditions to avoid ACPI_HOTPLUG_CPU being enabled when
>>>      HOTPLUG_CPU isn't.
>>> Changes since RFC v3:
>>>    * Dropped ia64 changes
>>> ---
>>>    arch/loongarch/Kconfig        |  1 +
>>>    arch/x86/Kconfig              |  1 +
>>>    drivers/acpi/Kconfig          |  1 -
>>>    drivers/acpi/acpi_processor.c | 18 ------------------
>>>    4 files changed, 2 insertions(+), 19 deletions(-)
>>>
>>
>> With the following nits addressed:
>>
>> Reviewed-by: Gavin Shan <gshan@redhat.com>
>>
>>> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
>>> index d889a0b97bc1..64620e90c12c 100644
>>> --- a/arch/loongarch/Kconfig
>>> +++ b/arch/loongarch/Kconfig
>>> @@ -5,6 +5,7 @@ config LOONGARCH
>>>    	select ACPI
>>>    	select ACPI_GENERIC_GSI if ACPI
>>>    	select ACPI_MCFG if ACPI
>>> +	select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_PPTT if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>>    	select ARCH_BINFMT_ELF_STATE
>>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>>> index 3762f41bb092..dbdcfc708369 100644
>>> --- a/arch/x86/Kconfig
>>> +++ b/arch/x86/Kconfig
>>> @@ -59,6 +59,7 @@ config X86
>>>    	#
>>>    	select ACPI_LEGACY_TABLES_LOOKUP	if ACPI
>>>    	select ACPI_SYSTEM_POWER_STATES_SUPPORT	if ACPI
>>> +	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ARCH_32BIT_OFF_T			if X86_32
>>>    	select ARCH_CLOCKSOURCE_INIT
>>>    	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>> index f819e760ff19..a3acfc750fce 100644
>>> --- a/drivers/acpi/Kconfig
>>> +++ b/drivers/acpi/Kconfig
>>> @@ -310,7 +310,6 @@ config ACPI_HOTPLUG_CPU
>>>    	bool
>>>    	depends on ACPI_PROCESSOR && HOTPLUG_CPU
>>>    	select ACPI_CONTAINER
>>> -	default y
>>>    config ACPI_PROCESSOR_AGGREGATOR
>>>    	tristate "Processor Aggregator"
>>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>>> index 0f5218e361df..4fe2ef54088c 100644
>>> --- a/drivers/acpi/acpi_processor.c
>>> +++ b/drivers/acpi/acpi_processor.c
>>> @@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
>>>    /* Initialization */
>>>    #ifdef CONFIG_ACPI_HOTPLUG_CPU
>>> -int __weak acpi_map_cpu(acpi_handle handle,
>>> -		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak acpi_unmap_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -int __weak arch_register_cpu(int cpu)
>>> -{
>>> -	return -ENODEV;
>>> -}
>>> -
>>> -void __weak arch_unregister_cpu(int cpu) {}
>>> -
>>
>> Since we're here, EXPORT_SYMBOL() can be dropped for these functions on
>> x86 and loongarch because they're not called from a module?
> 
> I'm confused, and don't understand your comment. You've r-b the
> previous two patches that remove the EXPORT_SYMBOL()s for
> arch_register_cpu() and arch_unregister_cpu() from x86 and loongarch.
> So it seems your comment is already addressed, and thus makes no
> sense.
> 
> Please clarify.
> 

Exactly, I must be looking into wrong code when reviewing this patch.
Please ignore my comments and my r-b still valid. Sorry for the
unnecessary confusion.

Thanks,
Gavin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
  2023-11-13  4:04     ` Gavin Shan
  (?)
@ 2023-11-15 10:11       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-15 10:11 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 02:04:32PM +1000, Gavin Shan wrote:
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> > can remove some redundant code.
> > 
> > node_dev_init() will walk through the nodes calling register_one_node()
> > on each. This will trickle down to __register_one_node() which walks
> > all present CPUs, calling register_cpu_under_node() on each.
> > 
> > register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> > will return NULL until the CPU is registered using register_cpu(). This
> > now happens _after_ node_dev_init().
> > 
> > Therefore, calling register_cpu_under_node() from __register_one_node()
> > becomes a no-op, and can be removed.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> >   drivers/base/node.c | 7 -------
> >   1 file changed, 7 deletions(-)
> > 
> 
> __register_one_node() can be called in memory hot add path either. In that path,
> a new NUMA node can be presented and becomes online. Does this become a problem
> after the logic of associating CPU with newly added NUMA node?

I guess this is where ordering matters.

As mentioned in the commit message, register_cpu_under_node() does
this:

        if (!node_online(nid))
                return 0;

        obj = get_cpu_device(cpu);
        if (!obj)
                return 0;

get_cpu_device() will return NULL if the CPU is not possible or is out
of range, or register_cpu() has not yet been called for this CPU, and
register_cpu() will call register_cpu_under_node().

I guess it is possible for a CPU it be present, but the node its
associated with would not be online, which means we end up with
register_cpu_under_node() returning on !node_online(nid) but we've
populated the CPU devices (thus get_cpu_device(cpu) would return
non-NULL).

Then when the numa node comes online, we do still need to call this
path, so this change is incorrect.

It came about trying to address Jonathan's comment for this patch:

https://lore.kernel.org/r/20230913163823.7880-7-james.morse@arm.com

I think my response to Jonathan is still correct - but didn't need
a code change. I'm dropping this patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-15 10:11       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-15 10:11 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 02:04:32PM +1000, Gavin Shan wrote:
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> > can remove some redundant code.
> > 
> > node_dev_init() will walk through the nodes calling register_one_node()
> > on each. This will trickle down to __register_one_node() which walks
> > all present CPUs, calling register_cpu_under_node() on each.
> > 
> > register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> > will return NULL until the CPU is registered using register_cpu(). This
> > now happens _after_ node_dev_init().
> > 
> > Therefore, calling register_cpu_under_node() from __register_one_node()
> > becomes a no-op, and can be removed.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> >   drivers/base/node.c | 7 -------
> >   1 file changed, 7 deletions(-)
> > 
> 
> __register_one_node() can be called in memory hot add path either. In that path,
> a new NUMA node can be presented and becomes online. Does this become a problem
> after the logic of associating CPU with newly added NUMA node?

I guess this is where ordering matters.

As mentioned in the commit message, register_cpu_under_node() does
this:

        if (!node_online(nid))
                return 0;

        obj = get_cpu_device(cpu);
        if (!obj)
                return 0;

get_cpu_device() will return NULL if the CPU is not possible or is out
of range, or register_cpu() has not yet been called for this CPU, and
register_cpu() will call register_cpu_under_node().

I guess it is possible for a CPU it be present, but the node its
associated with would not be online, which means we end up with
register_cpu_under_node() returning on !node_online(nid) but we've
populated the CPU devices (thus get_cpu_device(cpu) would return
non-NULL).

Then when the numa node comes online, we do still need to call this
path, so this change is incorrect.

It came about trying to address Jonathan's comment for this patch:

https://lore.kernel.org/r/20230913163823.7880-7-james.morse@arm.com

I think my response to Jonathan is still correct - but didn't need
a code change. I'm dropping this patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 11/22] drivers: base: remove unnecessary call to register_cpu_under_node()
@ 2023-11-15 10:11       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-15 10:11 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 02:04:32PM +1000, Gavin Shan wrote:
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > Since "drivers: base: Move cpu_dev_init() after node_dev_init()", we
> > can remove some redundant code.
> > 
> > node_dev_init() will walk through the nodes calling register_one_node()
> > on each. This will trickle down to __register_one_node() which walks
> > all present CPUs, calling register_cpu_under_node() on each.
> > 
> > register_cpu_under_node() will call get_cpu_device(cpu) for each, which
> > will return NULL until the CPU is registered using register_cpu(). This
> > now happens _after_ node_dev_init().
> > 
> > Therefore, calling register_cpu_under_node() from __register_one_node()
> > becomes a no-op, and can be removed.
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> >   drivers/base/node.c | 7 -------
> >   1 file changed, 7 deletions(-)
> > 
> 
> __register_one_node() can be called in memory hot add path either. In that path,
> a new NUMA node can be presented and becomes online. Does this become a problem
> after the logic of associating CPU with newly added NUMA node?

I guess this is where ordering matters.

As mentioned in the commit message, register_cpu_under_node() does
this:

        if (!node_online(nid))
                return 0;

        obj = get_cpu_device(cpu);
        if (!obj)
                return 0;

get_cpu_device() will return NULL if the CPU is not possible or is out
of range, or register_cpu() has not yet been called for this CPU, and
register_cpu() will call register_cpu_under_node().

I guess it is possible for a CPU it be present, but the node its
associated with would not be online, which means we end up with
register_cpu_under_node() returning on !node_online(nid) but we've
populated the CPU devices (thus get_cpu_device(cpu) would return
non-NULL).

Then when the numa node comes online, we do still need to call this
path, so this change is incorrect.

It came about trying to address Jonathan's comment for this patch:

https://lore.kernel.org/r/20230913163823.7880-7-james.morse@arm.com

I think my response to Jonathan is still correct - but didn't need
a code change. I'm dropping this patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-13  8:00       ` Russell King (Oracle)
  (?)
@ 2023-11-21 13:27         ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:27 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> > 
> > 
> > On 11/7/23 20:30, Russell King (Oracle) wrote:
> > > From: James Morse <james.morse@arm.com>
> > > 
> > > NUMA systems require the node descriptions to be ready before CPUs are
> > > registered. This is so that the node symlinks can be created in sysfs.
> > > 
> > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > are registered by arch code, instead of cpu_dev_init().
> > > 
> > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > can use GENERIC_CPU_DEVICES.
> > > 
> > > Signed-off-by: James Morse <james.morse@arm.com>
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > ---
> > > Note: Jonathan's comment still needs addressing - see
> > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > ---
> > >   drivers/base/init.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > 
> > With Jonathan's comments addressed:
> 
> That needs James' input, which is why I made the note on the patch.

I'm going to be posting the series without RFC soon, and it will be
with Jonathan's comment unaddressed - because as I've said several
times it needs James' input and we have sadly not yet received that.

Short of waiting until James can respond, I don't think there are
any other alternatives.

I do hope we can get this queued up for v6.8 though.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-21 13:27         ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:27 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> > 
> > 
> > On 11/7/23 20:30, Russell King (Oracle) wrote:
> > > From: James Morse <james.morse@arm.com>
> > > 
> > > NUMA systems require the node descriptions to be ready before CPUs are
> > > registered. This is so that the node symlinks can be created in sysfs.
> > > 
> > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > are registered by arch code, instead of cpu_dev_init().
> > > 
> > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > can use GENERIC_CPU_DEVICES.
> > > 
> > > Signed-off-by: James Morse <james.morse@arm.com>
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > ---
> > > Note: Jonathan's comment still needs addressing - see
> > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > ---
> > >   drivers/base/init.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > 
> > With Jonathan's comments addressed:
> 
> That needs James' input, which is why I made the note on the patch.

I'm going to be posting the series without RFC soon, and it will be
with Jonathan's comment unaddressed - because as I've said several
times it needs James' input and we have sadly not yet received that.

Short of waiting until James can respond, I don't think there are
any other alternatives.

I do hope we can get this queued up for v6.8 though.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-21 13:27         ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:27 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> > 
> > 
> > On 11/7/23 20:30, Russell King (Oracle) wrote:
> > > From: James Morse <james.morse@arm.com>
> > > 
> > > NUMA systems require the node descriptions to be ready before CPUs are
> > > registered. This is so that the node symlinks can be created in sysfs.
> > > 
> > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > are registered by arch code, instead of cpu_dev_init().
> > > 
> > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > can use GENERIC_CPU_DEVICES.
> > > 
> > > Signed-off-by: James Morse <james.morse@arm.com>
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > ---
> > > Note: Jonathan's comment still needs addressing - see
> > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > ---
> > >   drivers/base/init.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > 
> > With Jonathan's comments addressed:
> 
> That needs James' input, which is why I made the note on the patch.

I'm going to be posting the series without RFC soon, and it will be
with Jonathan's comment unaddressed - because as I've said several
times it needs James' input and we have sadly not yet received that.

Short of waiting until James can respond, I don't think there are
any other alternatives.

I do hope we can get this queued up for v6.8 though.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-21 13:33     ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:33 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, Nov 07, 2023 at 10:29:59AM +0000, Russell King 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>
> ---
> 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(-)
> 
> 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 */

I have previously asked the question whether we should provide a
stub weak function for the !HOTPLUG_CPU case for this, which would
alleviate the concerns around if (IS_ENABLED()) in some of the later
hotplug vCPU patches... which failed to get _any_ responses.

So, I'm now going to deem the comment I received about if (IS_ENABLED())
potentially causing issues to be unimportant, and thus there's no
need for a stub weak function. If we start getting compile errors,
then we can address the issue at that point. So far, however, the
kernel build bot has not identified that this as an issue... and it's
been chewing on this entire patch set for well over a month now.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-21 13:33     ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:33 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, Nov 07, 2023 at 10:29:59AM +0000, Russell King 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>
> ---
> 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(-)
> 
> 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 */

I have previously asked the question whether we should provide a
stub weak function for the !HOTPLUG_CPU case for this, which would
alleviate the concerns around if (IS_ENABLED()) in some of the later
hotplug vCPU patches... which failed to get _any_ responses.

So, I'm now going to deem the comment I received about if (IS_ENABLED())
potentially causing issues to be unimportant, and thus there's no
need for a stub weak function. If we start getting compile errors,
then we can address the issue at that point. So far, however, the
kernel build bot has not identified that this as an issue... and it's
been chewing on this entire patch set for well over a month now.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-21 13:33     ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-21 13:33 UTC (permalink / raw)
  To: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc
  Cc: Salil Mehta, Jean-Philippe Brucker, jianyong.wu, justin.he,
	James Morse, Greg Kroah-Hartman, Rafael J. Wysocki,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, Nov 07, 2023 at 10:29:59AM +0000, Russell King 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>
> ---
> 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(-)
> 
> 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 */

I have previously asked the question whether we should provide a
stub weak function for the !HOTPLUG_CPU case for this, which would
alleviate the concerns around if (IS_ENABLED()) in some of the later
hotplug vCPU patches... which failed to get _any_ responses.

So, I'm now going to deem the comment I received about if (IS_ENABLED())
potentially causing issues to be unimportant, and thus there's no
need for a stub weak function. If we start getting compile errors,
then we can address the issue at that point. So far, however, the
kernel build bot has not identified that this as an issue... and it's
been chewing on this entire patch set for well over a month now.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-21 13:27         ` Russell King (Oracle)
  (?)
@ 2023-11-28 13:55           ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 13:55 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 21 Nov 2023 13:27:08 +0000
"Russell King (Oracle)" <linux@armlinux.org.uk> wrote:

> On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:  
> > > 
> > > 
> > > On 11/7/23 20:30, Russell King (Oracle) wrote:  
> > > > From: James Morse <james.morse@arm.com>
> > > > 
> > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > 
> > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > are registered by arch code, instead of cpu_dev_init().
> > > > 
> > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > can use GENERIC_CPU_DEVICES.
> > > > 
> > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > ---
> > > > Note: Jonathan's comment still needs addressing - see
> > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > ---
> > > >   drivers/base/init.c | 2 +-
> > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > >   
> > > 
> > > With Jonathan's comments addressed:  
> > 
> > That needs James' input, which is why I made the note on the patch.  
> 
> I'm going to be posting the series without RFC soon, and it will be
> with Jonathan's comment unaddressed - because as I've said several
> times it needs James' input and we have sadly not yet received that.
> 
> Short of waiting until James can respond, I don't think there are
> any other alternatives.

In the interests of expediency I'm fine with that.  (To be honest I'd
forgotten I even made that comment ;)

Jonathan

> 
> I do hope we can get this queued up for v6.8 though.
> 


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-28 13:55           ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 13:55 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 21 Nov 2023 13:27:08 +0000
"Russell King (Oracle)" <linux@armlinux.org.uk> wrote:

> On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:  
> > > 
> > > 
> > > On 11/7/23 20:30, Russell King (Oracle) wrote:  
> > > > From: James Morse <james.morse@arm.com>
> > > > 
> > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > 
> > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > are registered by arch code, instead of cpu_dev_init().
> > > > 
> > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > can use GENERIC_CPU_DEVICES.
> > > > 
> > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > ---
> > > > Note: Jonathan's comment still needs addressing - see
> > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > ---
> > > >   drivers/base/init.c | 2 +-
> > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > >   
> > > 
> > > With Jonathan's comments addressed:  
> > 
> > That needs James' input, which is why I made the note on the patch.  
> 
> I'm going to be posting the series without RFC soon, and it will be
> with Jonathan's comment unaddressed - because as I've said several
> times it needs James' input and we have sadly not yet received that.
> 
> Short of waiting until James can respond, I don't think there are
> any other alternatives.

In the interests of expediency I'm fine with that.  (To be honest I'd
forgotten I even made that comment ;)

Jonathan

> 
> I do hope we can get this queued up for v6.8 though.
> 


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-28 13:55           ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 13:55 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 21 Nov 2023 13:27:08 +0000
"Russell King (Oracle)" <linux@armlinux.org.uk> wrote:

> On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:
> > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:  
> > > 
> > > 
> > > On 11/7/23 20:30, Russell King (Oracle) wrote:  
> > > > From: James Morse <james.morse@arm.com>
> > > > 
> > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > 
> > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > are registered by arch code, instead of cpu_dev_init().
> > > > 
> > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > can use GENERIC_CPU_DEVICES.
> > > > 
> > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > ---
> > > > Note: Jonathan's comment still needs addressing - see
> > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > ---
> > > >   drivers/base/init.c | 2 +-
> > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > >   
> > > 
> > > With Jonathan's comments addressed:  
> > 
> > That needs James' input, which is why I made the note on the patch.  
> 
> I'm going to be posting the series without RFC soon, and it will be
> with Jonathan's comment unaddressed - because as I've said several
> times it needs James' input and we have sadly not yet received that.
> 
> Short of waiting until James can respond, I don't think there are
> any other alternatives.

In the interests of expediency I'm fine with that.  (To be honest I'd
forgotten I even made that comment ;)

Jonathan

> 
> I do hope we can get this queued up for v6.8 though.
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-28 14:37     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:37 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 07 Nov 2023 10:29:23 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.

I'm not keen on squirting sysfs files in from code so
might be nice to do that anyway and use is_visible() / sysfs_update_group()
but that would be a job for another day if at all.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-28 14:37     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:37 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 07 Nov 2023 10:29:23 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.

I'm not keen on squirting sysfs files in from code so
might be nice to do that anyway and use is_visible() / sysfs_update_group()
but that would be a job for another day if at all.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-28 14:37     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:37 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 07 Nov 2023 10:29:23 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> register_cpu_capacity_sysctl() adds a property to sysfs that describes
> the CPUs capacity. This is done from a subsys_initcall() that assumes
> all possible CPUs are registered.
> 
> With CPU hotplug, possible CPUs aren't registered until they become
> present, (or for arm64 enabled). This leads to messages during boot:
> | register_cpu_capacity_sysctl: too early to get CPU1 device!
> and once these CPUs are added to the system, the file is missing.
> 
> Move this to a cpuhp callback, so that the file is created once
> CPUs are brought online. This covers CPUs that are added late by
> mechanisms like hotplug.
> One observable difference is the file is now missing for offline CPUs.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> If the offline CPUs thing is a problem for the tools that consume
> this value, we'd need to move cpu_capacity to be part of cpu.c's
> common_cpu_attr_groups.

I'm not keen on squirting sysfs files in from code so
might be nice to do that anyway and use is_visible() / sysfs_update_group()
but that would be a job for another day if at all.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-28 14:40     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:40 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:28 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Seems reasonable. FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> 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);


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-28 14:40     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:40 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:28 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Seems reasonable. FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> 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);


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-28 14:40     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:40 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:28 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> 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 <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Seems reasonable. FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> 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);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
  2023-11-07 10:29   ` Russell King (Oracle)
  (?)
@ 2023-11-28 14:42     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:42 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:33 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Would be 'novel' to have CPUs registered by a module.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-28 14:42     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:42 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:33 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Would be 'novel' to have CPUs registered by a module.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 03/22] x86/topology: remove arch_*register_cpu() exports
@ 2023-11-28 14:42     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:42 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:29:33 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Would be 'novel' to have CPUs registered by a module.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
  2023-11-07 10:29   ` Russell King (Oracle)
  (?)
@ 2023-11-28 14:43     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:43 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:29:38 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-28 14:43     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:43 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:29:38 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 04/22] Loongarch: remove arch_*register_cpu() exports
@ 2023-11-28 14:43     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:43 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:29:38 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> arch_register_cpu() and arch_unregister_cpu() are not used by anything
> that can be a module - they are used by drivers/base/cpu.c and
> drivers/acpi/acpi_processor.c, neither of which can be a module.
> 
> Remove the exports.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-28 14:46     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:46 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:29:44 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-28 14:46     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:46 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:29:44 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 05/22] ACPI: Move ACPI_HOTPLUG_CPU to be disabled on arm64 and riscv
@ 2023-11-28 14:46     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:46 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
	Len Brown, Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:29:44 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Neither arm64 nor riscv support physical hotadd of CPUs that were not
> present at boot. For arm64 much of the platform description is in static
> tables which do not have update methods. arm64 does support HOTPLUG_CPU,
> which is backed by a firmware interface to turn CPUs on and off.
> 
> acpi_processor_hotadd_init() and acpi_processor_remove() are for adding
> and removing CPUs that were not present at boot. arm64 systems that do this
> are not supported as there is currently insufficient information in the
> platform description. (e.g. did the GICR get removed too?)
> 
> arm64 currently relies on the MADT enabled flag check in map_gicc_mpidr()
> to prevent CPUs that were not described as present at boot from being
> added to the system. Similarly, riscv relies on the same check in
> map_rintc_hartid(). Both architectures also rely on the weak 'always fails'
> definitions of acpi_map_cpu() and arch_register_cpu().
> 
> Subsequent changes will redefine ACPI_HOTPLUG_CPU as making possible
> CPUs present. Neither arm64 nor riscv support this.
> 
> Disable ACPI_HOTPLUG_CPU for arm64 and riscv by removing 'default y' and
> selecting it on the other three ACPI architectures. This allows the weak
> definitions of some symbols to be removed.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
  2023-11-07 10:29   ` Russell King
  (?)
@ 2023-11-28 14:49     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:49 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:29:54 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-28 14:49     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:49 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:29:54 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 07/22] drivers: base: Allow parts of GENERIC_CPU_DEVICES to be overridden
@ 2023-11-28 14:49     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:49 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:29:54 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Architectures often have extra per-cpu work that needs doing
> before a CPU is registered, often to determine if a CPU is
> hotpluggable.
> 
> To allow the ACPI architectures to use GENERIC_CPU_DEVICES, move
> the cpu_register() call into arch_register_cpu(), which is made __weak
> so architectures with extra work can override it.
> This aligns with the way x86, ia64 and loongarch register hotplug CPUs
> when they become present.
> 
> Signed-off-by: James Morse <james.morse@arm.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
  2023-11-21 13:33     ` Russell King (Oracle)
  (?)
@ 2023-11-28 14:51       ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:51 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou


> > +
> > +#ifdef CONFIG_HOTPLUG_CPU
> > +void __weak arch_unregister_cpu(int num)
> > +{
> > +	unregister_cpu(&per_cpu(cpu_devices, num));
> > +}
> > +#endif /* CONFIG_HOTPLUG_CPU */  
> 
> I have previously asked the question whether we should provide a
> stub weak function for the !HOTPLUG_CPU case for this, which would
> alleviate the concerns around if (IS_ENABLED()) in some of the later
> hotplug vCPU patches... which failed to get _any_ responses.
> 
> So, I'm now going to deem the comment I received about if (IS_ENABLED())
> potentially causing issues to be unimportant, and thus there's no
> need for a stub weak function. If we start getting compile errors,
> then we can address the issue at that point. So far, however, the
> kernel build bot has not identified that this as an issue... and it's
> been chewing on this entire patch set for well over a month now.
> 

Make sense to fix this only if it's a real problem. 
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-28 14:51       ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:51 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou


> > +
> > +#ifdef CONFIG_HOTPLUG_CPU
> > +void __weak arch_unregister_cpu(int num)
> > +{
> > +	unregister_cpu(&per_cpu(cpu_devices, num));
> > +}
> > +#endif /* CONFIG_HOTPLUG_CPU */  
> 
> I have previously asked the question whether we should provide a
> stub weak function for the !HOTPLUG_CPU case for this, which would
> alleviate the concerns around if (IS_ENABLED()) in some of the later
> hotplug vCPU patches... which failed to get _any_ responses.
> 
> So, I'm now going to deem the comment I received about if (IS_ENABLED())
> potentially causing issues to be unimportant, and thus there's no
> need for a stub weak function. If we start getting compile errors,
> then we can address the issue at that point. So far, however, the
> kernel build bot has not identified that this as an issue... and it's
> been chewing on this entire patch set for well over a month now.
> 

Make sense to fix this only if it's a real problem. 
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 08/22] drivers: base: Implement weak arch_unregister_cpu()
@ 2023-11-28 14:51       ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:51 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou


> > +
> > +#ifdef CONFIG_HOTPLUG_CPU
> > +void __weak arch_unregister_cpu(int num)
> > +{
> > +	unregister_cpu(&per_cpu(cpu_devices, num));
> > +}
> > +#endif /* CONFIG_HOTPLUG_CPU */  
> 
> I have previously asked the question whether we should provide a
> stub weak function for the !HOTPLUG_CPU case for this, which would
> alleviate the concerns around if (IS_ENABLED()) in some of the later
> hotplug vCPU patches... which failed to get _any_ responses.
> 
> So, I'm now going to deem the comment I received about if (IS_ENABLED())
> potentially causing issues to be unimportant, and thus there's no
> need for a stub weak function. If we start getting compile errors,
> then we can address the issue at that point. So far, however, the
> kernel build bot has not identified that this as an issue... and it's
> been chewing on this entire patch set for well over a month now.
> 

Make sense to fix this only if it's a real problem. 
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-28 14:53     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:53 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:30:04 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> 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@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-28 14:53     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:53 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:30:04 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> 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@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 09/22] drivers: base: add arch_cpu_is_hotpluggable()
@ 2023-11-28 14:53     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 14:53 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Thomas Gleixner,
	Peter Zijlstra

On Tue, 07 Nov 2023 10:30:04 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> 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@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-28 13:55           ` Jonathan Cameron
  (?)
@ 2023-11-28 15:00             ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:00 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 28 Nov 2023 13:55:36 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Tue, 21 Nov 2023 13:27:08 +0000
> "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
> 
> > On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:  
> > > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:    
> > > > 
> > > > 
> > > > On 11/7/23 20:30, Russell King (Oracle) wrote:    
> > > > > From: James Morse <james.morse@arm.com>
> > > > > 
> > > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > > 
> > > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > > are registered by arch code, instead of cpu_dev_init().
> > > > > 
> > > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > > can use GENERIC_CPU_DEVICES.
> > > > > 
> > > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > > ---
> > > > > Note: Jonathan's comment still needs addressing - see
> > > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > > ---
> > > > >   drivers/base/init.c | 2 +-
> > > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >     
> > > > 
> > > > With Jonathan's comments addressed:    
> > > 
> > > That needs James' input, which is why I made the note on the patch.    
> > 
> > I'm going to be posting the series without RFC soon, and it will be
> > with Jonathan's comment unaddressed - because as I've said several
> > times it needs James' input and we have sadly not yet received that.
> > 
> > Short of waiting until James can respond, I don't think there are
> > any other alternatives.  
> 
> In the interests of expediency I'm fine with that.  (To be honest I'd
> forgotten I even made that comment ;)
>
 
Given what I was looking for was a 'nice to have' extra bit of info in the
patch description and I'm fine with the actual change even without that:

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> Jonathan
> 
> > 
> > I do hope we can get this queued up for v6.8 though.
*fingers crossed* !
> >   
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-28 15:00             ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:00 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 28 Nov 2023 13:55:36 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Tue, 21 Nov 2023 13:27:08 +0000
> "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
> 
> > On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:  
> > > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:    
> > > > 
> > > > 
> > > > On 11/7/23 20:30, Russell King (Oracle) wrote:    
> > > > > From: James Morse <james.morse@arm.com>
> > > > > 
> > > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > > 
> > > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > > are registered by arch code, instead of cpu_dev_init().
> > > > > 
> > > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > > can use GENERIC_CPU_DEVICES.
> > > > > 
> > > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > > ---
> > > > > Note: Jonathan's comment still needs addressing - see
> > > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > > ---
> > > > >   drivers/base/init.c | 2 +-
> > > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >     
> > > > 
> > > > With Jonathan's comments addressed:    
> > > 
> > > That needs James' input, which is why I made the note on the patch.    
> > 
> > I'm going to be posting the series without RFC soon, and it will be
> > with Jonathan's comment unaddressed - because as I've said several
> > times it needs James' input and we have sadly not yet received that.
> > 
> > Short of waiting until James can respond, I don't think there are
> > any other alternatives.  
> 
> In the interests of expediency I'm fine with that.  (To be honest I'd
> forgotten I even made that comment ;)
>
 
Given what I was looking for was a 'nice to have' extra bit of info in the
patch description and I'm fine with the actual change even without that:

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> Jonathan
> 
> > 
> > I do hope we can get this queued up for v6.8 though.
*fingers crossed* !
> >   
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-28 15:00             ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:00 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Gavin Shan, linux-pm, loongarch, linux-acpi, linux-arch,
	linux-kernel, linux-arm-kernel, linux-riscv, kvmarm, x86,
	linux-csky, linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, 28 Nov 2023 13:55:36 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Tue, 21 Nov 2023 13:27:08 +0000
> "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
> 
> > On Mon, Nov 13, 2023 at 08:00:19AM +0000, Russell King (Oracle) wrote:  
> > > On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:    
> > > > 
> > > > 
> > > > On 11/7/23 20:30, Russell King (Oracle) wrote:    
> > > > > From: James Morse <james.morse@arm.com>
> > > > > 
> > > > > NUMA systems require the node descriptions to be ready before CPUs are
> > > > > registered. This is so that the node symlinks can be created in sysfs.
> > > > > 
> > > > > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > > > > are registered by arch code, instead of cpu_dev_init().
> > > > > 
> > > > > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > > > > can use GENERIC_CPU_DEVICES.
> > > > > 
> > > > > Signed-off-by: James Morse <james.morse@arm.com>
> > > > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > > > ---
> > > > > Note: Jonathan's comment still needs addressing - see
> > > > >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > > > > ---
> > > > >   drivers/base/init.c | 2 +-
> > > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >     
> > > > 
> > > > With Jonathan's comments addressed:    
> > > 
> > > That needs James' input, which is why I made the note on the patch.    
> > 
> > I'm going to be posting the series without RFC soon, and it will be
> > with Jonathan's comment unaddressed - because as I've said several
> > times it needs James' input and we have sadly not yet received that.
> > 
> > Short of waiting until James can respond, I don't think there are
> > any other alternatives.  
> 
> In the interests of expediency I'm fine with that.  (To be honest I'd
> forgotten I even made that comment ;)
>
 
Given what I was looking for was a 'nice to have' extra bit of info in the
patch description and I'm fine with the actual change even without that:

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> Jonathan
> 
> > 
> > I do hope we can get this queued up for v6.8 though.
*fingers crossed* !
> >   
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-28 15:05     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:05 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:30:20 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>

I guess there may be paths later that were never exposed because of
this panic, but any such should be fixed rather than relying on this
big hammer.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-28 15:05     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:05 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:30:20 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>

I guess there may be paths later that were never exposed because of
this panic, but any such should be fixed rather than relying on this
big hammer.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 12/22] drivers: base: Print a warning instead of panic() when register_cpu() fails
@ 2023-11-28 15:05     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:05 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki, Paul Walmsley,
	Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:30:20 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> loongarch, mips, parisc, riscv and sh all print a warning if
> register_cpu() returns an error. Architectures that use
> GENERIC_CPU_DEVICES call panic() instead.
> 
> Errors in this path indicate something is wrong with the firmware
> description of the platform, but the kernel is able to keep running.
> 
> Downgrade this to a warning to make it easier to debug this issue.
> 
> This will allow architectures that switching over to GENERIC_CPU_DEVICES
> to drop their warning, but keep the existing behaviour.
> 
> 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>

I guess there may be paths later that were never exposed because of
this panic, but any such should be fixed rather than relying on this
big hammer.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-28 15:08     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:08 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

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)
>  {


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-28 15:08     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:08 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

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)
>  {


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-28 15:08     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:08 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

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)
>  {


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-28 15:11     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:11 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 07 Nov 2023 10:30:30 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Ah. Or previous patch needs a forwards reference to the tweaking
of it it here.

Maybe just smash the 2 together with a Co-developed: ?

I don't care that much so whatever works for you

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
 
> ---
>  arch/arm64/kernel/setup.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>  	return false;
>  }
>  
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>  {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>  }
>  
>  static void dump_kernel_offset(void)


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-28 15:11     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:11 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 07 Nov 2023 10:30:30 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Ah. Or previous patch needs a forwards reference to the tweaking
of it it here.

Maybe just smash the 2 together with a Co-developed: ?

I don't care that much so whatever works for you

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
 
> ---
>  arch/arm64/kernel/setup.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>  	return false;
>  }
>  
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>  {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>  }
>  
>  static void dump_kernel_offset(void)


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-28 15:11     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:11 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 07 Nov 2023 10:30:30 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Ah. Or previous patch needs a forwards reference to the tweaking
of it it here.

Maybe just smash the 2 together with a Co-developed: ?

I don't care that much so whatever works for you

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
 
> ---
>  arch/arm64/kernel/setup.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 165bd2c0dd5a..42c690bb2d60 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -402,13 +402,9 @@ static inline bool cpu_can_disable(unsigned int cpu)
>  	return false;
>  }
>  
> -int arch_register_cpu(int num)
> +bool arch_cpu_is_hotpluggable(int num)
>  {
> -	struct cpu *cpu = &per_cpu(cpu_devices, num);
> -
> -	cpu->hotpluggable = cpu_can_disable(num);
> -
> -	return register_cpu(cpu, num);
> +	return cpu_can_disable(num);
>  }
>  
>  static void dump_kernel_offset(void)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
  2023-11-28 15:08     ` Jonathan Cameron
  (?)
@ 2023-11-28 15:12       ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:12 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 28 Nov 2023 15:08:54 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> 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()
> 
As per comment on next patch I'm fine with this slight dance.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-28 15:12       ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:12 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 28 Nov 2023 15:08:54 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> 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()
> 
As per comment on next patch I'm fine with this slight dance.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 13/22] arm64: setup: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()
@ 2023-11-28 15:12       ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:12 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, 28 Nov 2023 15:08:54 +0000
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> 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()
> 
As per comment on next patch I'm fine with this slight dance.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-28 15:16     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:16 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:35 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
In perfect world, I'd have liked the structure squash done as a precursor
as then the patch would have been a little less noisy.

However, sometimes it's just not worth the effort.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-28 15:16     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:16 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:35 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
In perfect world, I'd have liked the structure squash done as a precursor
as then the patch would have been a little less noisy.

However, sometimes it's just not worth the effort.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 15/22] x86/topology: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-28 15:16     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:16 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:35 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> x86's struct cpus come from struct x86_cpu, which has no other members
> or users. Remove this and use the version defined by common code.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
In perfect world, I'd have liked the structure squash done as a precursor
as then the patch would have been a little less noisy.

However, sometimes it's just not worth the effort.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-28 15:17     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:17 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:40 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-28 15:17     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:17 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:40 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 16/22] x86/topology: use weak version of arch_unregister_cpu()
@ 2023-11-28 15:17     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:17 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:40 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Since the x86 version of arch_unregister_cpu() is the same as the weak
> version, drop the x86 specific version.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:30   ` Russell King (Oracle)
  (?)
@ 2023-11-28 15:18     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:18 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:45 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

As with earlier set of related changes, could squash this down to avoid
churn and use Co-developed or similar. Up to you though.

Maybe a forwards reference to this being a later change in the patch 15
description might be good though!
> ---
>  arch/x86/kernel/topology.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index 211863cb5b81..d42c28b8bfd8 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -36,11 +36,8 @@
>  #include <asm/cpu.h>
>  
>  #ifdef CONFIG_HOTPLUG_CPU
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu > 0;
> -	return register_cpu(c, cpu);
> +	return cpu > 0;
>  }
>  #endif /* CONFIG_HOTPLUG_CPU */


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:18     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:18 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:45 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

As with earlier set of related changes, could squash this down to avoid
churn and use Co-developed or similar. Up to you though.

Maybe a forwards reference to this being a later change in the patch 15
description might be good though!
> ---
>  arch/x86/kernel/topology.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index 211863cb5b81..d42c28b8bfd8 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -36,11 +36,8 @@
>  #include <asm/cpu.h>
>  
>  #ifdef CONFIG_HOTPLUG_CPU
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu > 0;
> -	return register_cpu(c, cpu);
> +	return cpu > 0;
>  }
>  #endif /* CONFIG_HOTPLUG_CPU */


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 17/22] x86/topology: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:18     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:18 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, 07 Nov 2023 10:30:45 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert x86 to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

As with earlier set of related changes, could squash this down to avoid
churn and use Co-developed or similar. Up to you though.

Maybe a forwards reference to this being a later change in the patch 15
description might be good though!
> ---
>  arch/x86/kernel/topology.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
> index 211863cb5b81..d42c28b8bfd8 100644
> --- a/arch/x86/kernel/topology.c
> +++ b/arch/x86/kernel/topology.c
> @@ -36,11 +36,8 @@
>  #include <asm/cpu.h>
>  
>  #ifdef CONFIG_HOTPLUG_CPU
> -int arch_register_cpu(int cpu)
> +bool arch_cpu_is_hotpluggable(int cpu)
>  {
> -	struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
> -
> -	c->hotpluggable = cpu > 0;
> -	return register_cpu(c, cpu);
> +	return cpu > 0;
>  }
>  #endif /* CONFIG_HOTPLUG_CPU */


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
  2023-11-07 10:30   ` Russell King
  (?)
@ 2023-11-28 15:19     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:19 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:30:51 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>   io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>   hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-28 15:19     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:19 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:30:51 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>   io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>   hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 18/22] LoongArch: Switch over to GENERIC_CPU_DEVICES
@ 2023-11-28 15:19     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:19 UTC (permalink / raw)
  To: Russell King
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:30:51 +0000
Russell King <rmk+kernel@armlinux.org.uk> wrote:

> From: James Morse <james.morse@arm.com>
> 
> Now that GENERIC_CPU_DEVICES calls arch_register_cpu(), which can be
> overridden by the arch code, switch over to this to allow common code
> to choose when the register_cpu() call is made.
> 
> This allows topology_init() to be removed.
> 
> This is an intermediate step to the logic being moved to drivers/acpi,
> where GENERIC_CPU_DEVICES will do the work when booting with acpi=off.
> 
> This is a subtle change. Originally:
> - on boot, topology_init() would have marked present CPUs that
>   io_master() is true for as hotplug-incapable.
> - if a CPU is hotplugged that is an io_master(), it can later be
>   hot-unplugged.
> 
> The new behaviour is that any CPU that io_master() is true for will
> now always be marked as hotplug-incapable, thus even if it was
> hotplugged, it can no longer be hot-unplugged.
> 
> 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>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:31   ` Russell King (Oracle)
  (?)
@ 2023-11-28 15:20     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:20 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:31:01 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:20     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:20 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:31:01 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:20     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:20 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Huacai Chen, WANG Xuerui

On Tue, 07 Nov 2023 10:31:01 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert loongarch to use the arch_cpu_is_hotpluggable() helper rather
> than arch_register_cpu(). Also remove the export as nothing should be
> using arch_register_cpu() outside of the core kernel/acpi code.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
  2023-11-07 10:31   ` Russell King (Oracle)
  (?)
@ 2023-11-28 15:21     ` Jonathan Cameron
  -1 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:21 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:31:11 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks for driving this forwards.

Jonathan

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:21     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:21 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:31:11 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks for driving this forwards.

Jonathan

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 22/22] riscv: convert to use arch_cpu_is_hotpluggable()
@ 2023-11-28 15:21     ` Jonathan Cameron
  0 siblings, 0 replies; 258+ messages in thread
From: Jonathan Cameron @ 2023-11-28 15:21 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Paul Walmsley, Palmer Dabbelt, Albert Ou

On Tue, 07 Nov 2023 10:31:11 +0000
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> Convert riscv to use the arch_cpu_is_hotpluggable() helper rather than
> arch_register_cpu().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks for driving this forwards.

Jonathan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
  2023-11-28 14:37     ` Jonathan Cameron
  (?)
@ 2023-11-28 15:41       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, Nov 28, 2023 at 02:37:22PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:23 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > register_cpu_capacity_sysctl() adds a property to sysfs that describes
> > the CPUs capacity. This is done from a subsys_initcall() that assumes
> > all possible CPUs are registered.
> > 
> > With CPU hotplug, possible CPUs aren't registered until they become
> > present, (or for arm64 enabled). This leads to messages during boot:
> > | register_cpu_capacity_sysctl: too early to get CPU1 device!
> > and once these CPUs are added to the system, the file is missing.
> > 
> > Move this to a cpuhp callback, so that the file is created once
> > CPUs are brought online. This covers CPUs that are added late by
> > mechanisms like hotplug.
> > One observable difference is the file is now missing for offline CPUs.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > ---
> > If the offline CPUs thing is a problem for the tools that consume
> > this value, we'd need to move cpu_capacity to be part of cpu.c's
> > common_cpu_attr_groups.
> 
> I'm not keen on squirting sysfs files in from code so
> might be nice to do that anyway and use is_visible() / sysfs_update_group()
> but that would be a job for another day if at all.

I'm doing my best, but it's really not helped by the dysfunctional
nature of some parts of the kernel community. I have now decided that
this is not possible to implement. So while it's a nice idea, I don't
think we'll ever see it.

As I mentioned on the 14th November, complete with a patch (and got no
response from anyone):
> Looking into doing this, the easy bit is adding the attribute group
> with an appropriate .is_visible dependent on cpu_present(), but we
> need to be able to call sysfs_update_groups() when the state of the
> .is_visible() changes.
>
> Given the comment in sysfs_update_groups() about "if an error occurs",
> rather than making this part of common_cpu_attr_groups, would it be
> better that it's part of its own set of groups, thus limiting the
> damage from a possible error? I suspect, however, that any error at
> that point means that the system is rather fatally wounded.
>
> This is what I have so far to implement your idea, less the necessary
> sysfs_update_groups() call when we need to change the visibility of
> the attributes.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-28 15:41       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, Nov 28, 2023 at 02:37:22PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:23 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > register_cpu_capacity_sysctl() adds a property to sysfs that describes
> > the CPUs capacity. This is done from a subsys_initcall() that assumes
> > all possible CPUs are registered.
> > 
> > With CPU hotplug, possible CPUs aren't registered until they become
> > present, (or for arm64 enabled). This leads to messages during boot:
> > | register_cpu_capacity_sysctl: too early to get CPU1 device!
> > and once these CPUs are added to the system, the file is missing.
> > 
> > Move this to a cpuhp callback, so that the file is created once
> > CPUs are brought online. This covers CPUs that are added late by
> > mechanisms like hotplug.
> > One observable difference is the file is now missing for offline CPUs.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > ---
> > If the offline CPUs thing is a problem for the tools that consume
> > this value, we'd need to move cpu_capacity to be part of cpu.c's
> > common_cpu_attr_groups.
> 
> I'm not keen on squirting sysfs files in from code so
> might be nice to do that anyway and use is_visible() / sysfs_update_group()
> but that would be a job for another day if at all.

I'm doing my best, but it's really not helped by the dysfunctional
nature of some parts of the kernel community. I have now decided that
this is not possible to implement. So while it's a nice idea, I don't
think we'll ever see it.

As I mentioned on the 14th November, complete with a patch (and got no
response from anyone):
> Looking into doing this, the easy bit is adding the attribute group
> with an appropriate .is_visible dependent on cpu_present(), but we
> need to be able to call sysfs_update_groups() when the state of the
> .is_visible() changes.
>
> Given the comment in sysfs_update_groups() about "if an error occurs",
> rather than making this part of common_cpu_attr_groups, would it be
> better that it's part of its own set of groups, thus limiting the
> damage from a possible error? I suspect, however, that any error at
> that point means that the system is rather fatally wounded.
>
> This is what I have so far to implement your idea, less the necessary
> sysfs_update_groups() call when we need to change the visibility of
> the attributes.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 01/22] arch_topology: Make register_cpu_capacity_sysctl() tolerant to late CPUs
@ 2023-11-28 15:41       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Sudeep Holla, Greg Kroah-Hartman, Rafael J. Wysocki

On Tue, Nov 28, 2023 at 02:37:22PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:23 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > register_cpu_capacity_sysctl() adds a property to sysfs that describes
> > the CPUs capacity. This is done from a subsys_initcall() that assumes
> > all possible CPUs are registered.
> > 
> > With CPU hotplug, possible CPUs aren't registered until they become
> > present, (or for arm64 enabled). This leads to messages during boot:
> > | register_cpu_capacity_sysctl: too early to get CPU1 device!
> > and once these CPUs are added to the system, the file is missing.
> > 
> > Move this to a cpuhp callback, so that the file is created once
> > CPUs are brought online. This covers CPUs that are added late by
> > mechanisms like hotplug.
> > One observable difference is the file is now missing for offline CPUs.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > ---
> > If the offline CPUs thing is a problem for the tools that consume
> > this value, we'd need to move cpu_capacity to be part of cpu.c's
> > common_cpu_attr_groups.
> 
> I'm not keen on squirting sysfs files in from code so
> might be nice to do that anyway and use is_visible() / sysfs_update_group()
> but that would be a job for another day if at all.

I'm doing my best, but it's really not helped by the dysfunctional
nature of some parts of the kernel community. I have now decided that
this is not possible to implement. So while it's a nice idea, I don't
think we'll ever see it.

As I mentioned on the 14th November, complete with a patch (and got no
response from anyone):
> Looking into doing this, the easy bit is adding the attribute group
> with an appropriate .is_visible dependent on cpu_present(), but we
> need to be able to call sysfs_update_groups() when the state of the
> .is_visible() changes.
>
> Given the comment in sysfs_update_groups() about "if an error occurs",
> rather than making this part of common_cpu_attr_groups, would it be
> better that it's part of its own set of groups, thus limiting the
> damage from a possible error? I suspect, however, that any error at
> that point means that the system is rather fatally wounded.
>
> This is what I have so far to implement your idea, less the necessary
> sysfs_update_groups() call when we need to change the visibility of
> the attributes.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
  2023-11-28 14:40     ` Jonathan Cameron
  (?)
@ 2023-11-28 15:42       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, Nov 28, 2023 at 02:40:59PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:28 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > 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 <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> Seems reasonable. FWIW
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks, however this has already been merged into the tip tree since
Rafael suggested sending it separately.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-28 15:42       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, Nov 28, 2023 at 02:40:59PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:28 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > 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 <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> Seems reasonable. FWIW
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks, however this has already been merged into the tip tree since
Rafael suggested sending it separately.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 02/22] x86: intel_epb: Don't rely on link order
@ 2023-11-28 15:42       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-28 15:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin

On Tue, Nov 28, 2023 at 02:40:59PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:29:28 +0000
> Russell King <rmk+kernel@armlinux.org.uk> wrote:
> 
> > From: James Morse <james.morse@arm.com>
> > 
> > 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 <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> Seems reasonable. FWIW
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks, however this has already been merged into the tip tree since
Rafael suggested sending it separately.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
  2023-11-28 15:11     ` Jonathan Cameron
  (?)
@ 2023-11-30 12:09       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, Nov 28, 2023 at 03:11:15PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:30:30 +0000
> "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:
> 
> > Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> > arch_register_cpu().
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Ah. Or previous patch needs a forwards reference to the tweaking
> of it it here.
> 
> Maybe just smash the 2 together with a Co-developed: ?

I wanted to keep the two separate to preserve the authorship of the
individual patches, so I'll take the former. Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-30 12:09       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, Nov 28, 2023 at 03:11:15PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:30:30 +0000
> "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:
> 
> > Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> > arch_register_cpu().
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Ah. Or previous patch needs a forwards reference to the tweaking
> of it it here.
> 
> Maybe just smash the 2 together with a Co-developed: ?

I wanted to keep the two separate to preserve the authorship of the
individual patches, so I'll take the former. Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 14/22] arm64: convert to arch_cpu_is_hotpluggable()
@ 2023-11-30 12:09       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Catalin Marinas, Will Deacon

On Tue, Nov 28, 2023 at 03:11:15PM +0000, Jonathan Cameron wrote:
> On Tue, 07 Nov 2023 10:30:30 +0000
> "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:
> 
> > Convert arm64 to use the arch_cpu_is_hotpluggable() helper rather than
> > arch_register_cpu().
> > 
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> Ah. Or previous patch needs a forwards reference to the tweaking
> of it it here.
> 
> Maybe just smash the 2 together with a Co-developed: ?

I wanted to keep the two separate to preserve the authorship of the
individual patches, so I'll take the former. Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
  2023-11-13  0:58     ` Gavin Shan
  (?)
@ 2023-11-30 12:17       ` Russell King (Oracle)
  -1 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:17 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>

Can I assume, given Jonathan's reply later in this sub-thread, that you
are happy for me to add your r-b without the referred comment having
been addressed - Jonathan says tit was a "nice to have" and he's fine
without the requested change.

See https://lore.kernel.org/r/20231128150017.000069eb@Huawei.com

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-30 12:17       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:17 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>

Can I assume, given Jonathan's reply later in this sub-thread, that you
are happy for me to add your r-b without the referred comment having
been addressed - Jonathan says tit was a "nice to have" and he's fine
without the requested change.

See https://lore.kernel.org/r/20231128150017.000069eb@Huawei.com

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 258+ messages in thread

* Re: [PATCH RFC 10/22] drivers: base: Move cpu_dev_init() after node_dev_init()
@ 2023-11-30 12:17       ` Russell King (Oracle)
  0 siblings, 0 replies; 258+ messages in thread
From: Russell King (Oracle) @ 2023-11-30 12:17 UTC (permalink / raw)
  To: Gavin Shan
  Cc: linux-pm, loongarch, linux-acpi, linux-arch, linux-kernel,
	linux-arm-kernel, linux-riscv, kvmarm, x86, linux-csky,
	linux-doc, linux-ia64, linux-parisc, Salil Mehta,
	Jean-Philippe Brucker, jianyong.wu, justin.he, James Morse,
	Greg Kroah-Hartman, Rafael J. Wysocki

On Mon, Nov 13, 2023 at 10:58:46AM +1000, Gavin Shan wrote:
> 
> 
> On 11/7/23 20:30, Russell King (Oracle) wrote:
> > From: James Morse <james.morse@arm.com>
> > 
> > NUMA systems require the node descriptions to be ready before CPUs are
> > registered. This is so that the node symlinks can be created in sysfs.
> > 
> > Currently no NUMA platform uses GENERIC_CPU_DEVICES, meaning that CPUs
> > are registered by arch code, instead of cpu_dev_init().
> > 
> > Move cpu_dev_init() after node_dev_init() so that NUMA architectures
> > can use GENERIC_CPU_DEVICES.
> > 
> > Signed-off-by: James Morse <james.morse@arm.com>
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > Note: Jonathan's comment still needs addressing - see
> >    https://lore.kernel.org/r/20230914121612.00006ac7@Huawei.com
> > ---
> >   drivers/base/init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> With Jonathan's comments addressed:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>

Can I assume, given Jonathan's reply later in this sub-thread, that you
are happy for me to add your r-b without the referred comment having
been addressed - Jonathan says tit was a "nice to have" and he's fine
without the requested change.

See https://lore.kernel.org/r/20231128150017.000069eb@Huawei.com

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 258+ messages in thread

end of thread, other threads:[~2023-11-30 12:17 UTC | newest]

Thread overview: 258+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 10:28 [PATCH RFC 00/22] Initial cleanups for vCPU hotplug Russell King (Oracle)
2023-11-07 10:28 ` Russell King (Oracle)
2023-11-07 10:28 ` 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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-13  0:04   ` Gavin Shan
2023-11-13  0:04     ` Gavin Shan
2023-11-13  0:04     ` Gavin Shan
2023-11-28 14:37   ` Jonathan Cameron
2023-11-28 14:37     ` Jonathan Cameron
2023-11-28 14:37     ` Jonathan Cameron
2023-11-28 15:41     ` Russell King (Oracle)
2023-11-28 15:41       ` Russell King (Oracle)
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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-13  0:03   ` Gavin Shan
2023-11-13  0:03     ` Gavin Shan
2023-11-13  0:03     ` Gavin Shan
2023-11-28 14:40   ` Jonathan Cameron
2023-11-28 14:40     ` Jonathan Cameron
2023-11-28 14:40     ` Jonathan Cameron
2023-11-28 15:42     ` Russell King (Oracle)
2023-11-28 15:42       ` Russell King (Oracle)
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-07 10:29   ` Russell King (Oracle)
2023-11-07 10:29   ` Russell King (Oracle)
2023-11-13  0:08   ` Gavin Shan
2023-11-13  0:08     ` Gavin Shan
2023-11-13  0:08     ` Gavin Shan
2023-11-28 14:42   ` Jonathan Cameron
2023-11-28 14:42     ` Jonathan Cameron
2023-11-28 14:42     ` Jonathan Cameron
2023-11-07 10:29 ` [PATCH RFC 04/22] Loongarch: " Russell King (Oracle)
2023-11-07 10:29   ` Russell King (Oracle)
2023-11-07 10:29   ` Russell King (Oracle)
2023-11-13  0:11   ` Gavin Shan
2023-11-13  0:11     ` Gavin Shan
2023-11-13  0:11     ` Gavin Shan
2023-11-28 14:43   ` Jonathan Cameron
2023-11-28 14:43     ` Jonathan Cameron
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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-09  9:43   ` Shaoqin Huang
2023-11-09  9:43     ` Shaoqin Huang
2023-11-09  9:43     ` Shaoqin Huang
2023-11-13  0:29   ` Gavin Shan
2023-11-13  0:29     ` Gavin Shan
2023-11-13  0:29     ` Gavin Shan
2023-11-13  8:56     ` Russell King (Oracle)
2023-11-13  8:56       ` Russell King (Oracle)
2023-11-13  8:56       ` Russell King (Oracle)
2023-11-13 10:01       ` Gavin Shan
2023-11-13 10:01         ` Gavin Shan
2023-11-13 10:01         ` Gavin Shan
2023-11-28 14:46   ` Jonathan Cameron
2023-11-28 14:46     ` Jonathan Cameron
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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-09 10:09   ` Shaoqin Huang
2023-11-09 10:09     ` Shaoqin Huang
2023-11-09 10:09     ` Shaoqin Huang
2023-11-09 10:29     ` Russell King (Oracle)
2023-11-09 10:29       ` Russell King (Oracle)
2023-11-09 10:29       ` Russell King (Oracle)
2023-11-09 10:59       ` Shaoqin Huang
2023-11-09 10:59         ` Shaoqin Huang
2023-11-09 10:59         ` Shaoqin Huang
2023-11-13  0:37   ` Gavin Shan
2023-11-13  0:37     ` Gavin Shan
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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-09 10:13   ` Shaoqin Huang
2023-11-09 10:13     ` Shaoqin Huang
2023-11-09 10:13     ` Shaoqin Huang
2023-11-13  0:42   ` Gavin Shan
2023-11-13  0:42     ` Gavin Shan
2023-11-13  0:42     ` Gavin Shan
2023-11-28 14:49   ` Jonathan Cameron
2023-11-28 14:49     ` Jonathan Cameron
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-07 10:29   ` Russell King
2023-11-07 10:29   ` Russell King
2023-11-09 10:51   ` Shaoqin Huang
2023-11-09 10:51     ` Shaoqin Huang
2023-11-09 10:51     ` Shaoqin Huang
2023-11-13  0:45   ` Gavin Shan
2023-11-13  0:45     ` Gavin Shan
2023-11-13  0:45     ` Gavin Shan
2023-11-21 13:33   ` Russell King (Oracle)
2023-11-21 13:33     ` Russell King (Oracle)
2023-11-21 13:33     ` Russell King (Oracle)
2023-11-28 14:51     ` Jonathan Cameron
2023-11-28 14:51       ` Jonathan Cameron
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-07 10:30   ` Russell King (Oracle)
2023-11-07 10:30   ` Russell King (Oracle)
2023-11-10  3:27   ` Shaoqin Huang
2023-11-10  3:27     ` Shaoqin Huang
2023-11-10  3:27     ` Shaoqin Huang
2023-11-13  0:56   ` Gavin Shan
2023-11-13  0:56     ` Gavin Shan
2023-11-13  0:56     ` Gavin Shan
2023-11-28 14:53   ` Jonathan Cameron
2023-11-28 14:53     ` Jonathan Cameron
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-07 10:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-13  0:58   ` Gavin Shan
2023-11-13  0:58     ` Gavin Shan
2023-11-13  0:58     ` Gavin Shan
2023-11-13  8:00     ` Russell King (Oracle)
2023-11-13  8:00       ` Russell King (Oracle)
2023-11-13  8:00       ` Russell King (Oracle)
2023-11-21 13:27       ` Russell King (Oracle)
2023-11-21 13:27         ` Russell King (Oracle)
2023-11-21 13:27         ` Russell King (Oracle)
2023-11-28 13:55         ` Jonathan Cameron
2023-11-28 13:55           ` Jonathan Cameron
2023-11-28 13:55           ` Jonathan Cameron
2023-11-28 15:00           ` Jonathan Cameron
2023-11-28 15:00             ` Jonathan Cameron
2023-11-28 15:00             ` Jonathan Cameron
2023-11-30 12:17     ` Russell King (Oracle)
2023-11-30 12:17       ` Russell King (Oracle)
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-07 10:30   ` Russell King (Oracle)
2023-11-07 10:30   ` Russell King (Oracle)
2023-11-13  4:04   ` Gavin Shan
2023-11-13  4:04     ` Gavin Shan
2023-11-13  4:04     ` Gavin Shan
2023-11-15 10:11     ` Russell King (Oracle)
2023-11-15 10:11       ` Russell King (Oracle)
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-07 10:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-10  3:35   ` Shaoqin Huang
2023-11-10  3:35     ` Shaoqin Huang
2023-11-10  3:35     ` Shaoqin Huang
2023-11-13  4:03   ` Gavin Shan
2023-11-13  4:03     ` Gavin Shan
2023-11-13  4:03     ` Gavin Shan
2023-11-28 15:05   ` Jonathan Cameron
2023-11-28 15:05     ` Jonathan Cameron
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-07 10:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-10  3:36   ` Shaoqin Huang
2023-11-10  3:36     ` Shaoqin Huang
2023-11-10  3:36     ` Shaoqin Huang
2023-11-13  4:07   ` Gavin Shan
2023-11-13  4:07     ` Gavin Shan
2023-11-13  4:07     ` Gavin Shan
2023-11-28 15:08   ` Jonathan Cameron
2023-11-28 15:08     ` Jonathan Cameron
2023-11-28 15:08     ` Jonathan Cameron
2023-11-28 15:12     ` Jonathan Cameron
2023-11-28 15:12       ` Jonathan Cameron
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-07 10:30   ` Russell King (Oracle)
2023-11-07 10:30   ` Russell King (Oracle)
2023-11-10  3:37   ` Shaoqin Huang
2023-11-10  3:37     ` Shaoqin Huang
2023-11-10  3:37     ` Shaoqin Huang
2023-11-13  4:09   ` Gavin Shan
2023-11-13  4:09     ` Gavin Shan
2023-11-13  4:09     ` Gavin Shan
2023-11-28 15:11   ` Jonathan Cameron
2023-11-28 15:11     ` Jonathan Cameron
2023-11-28 15:11     ` Jonathan Cameron
2023-11-30 12:09     ` Russell King (Oracle)
2023-11-30 12:09       ` Russell King (Oracle)
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-07 10:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-13  4:13   ` Gavin Shan
2023-11-13  4:13     ` Gavin Shan
2023-11-13  4:13     ` Gavin Shan
2023-11-28 15:16   ` Jonathan Cameron
2023-11-28 15:16     ` Jonathan Cameron
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-07 10:30   ` Russell King (Oracle)
2023-11-07 10:30   ` Russell King (Oracle)
2023-11-13  4:16   ` Gavin Shan
2023-11-13  4:16     ` Gavin Shan
2023-11-13  4:16     ` Gavin Shan
2023-11-28 15:17   ` Jonathan Cameron
2023-11-28 15:17     ` Jonathan Cameron
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-07 10:30   ` Russell King (Oracle)
2023-11-07 10:30   ` Russell King (Oracle)
2023-11-13  4:18   ` Gavin Shan
2023-11-13  4:18     ` Gavin Shan
2023-11-13  4:18     ` Gavin Shan
2023-11-28 15:18   ` Jonathan Cameron
2023-11-28 15:18     ` Jonathan Cameron
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-07 10:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-13  4:20   ` Gavin Shan
2023-11-13  4:20     ` Gavin Shan
2023-11-13  4:20     ` Gavin Shan
2023-11-28 15:19   ` Jonathan Cameron
2023-11-28 15:19     ` Jonathan Cameron
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:30   ` Russell King
2023-11-07 10:30   ` Russell King
2023-11-07 10:31 ` [PATCH RFC 20/22] LoongArch: convert to use arch_cpu_is_hotpluggable() Russell King (Oracle)
2023-11-07 10:31   ` Russell King (Oracle)
2023-11-07 10:31   ` Russell King (Oracle)
2023-11-13  4:22   ` Gavin Shan
2023-11-13  4:22     ` Gavin Shan
2023-11-13  4:22     ` Gavin Shan
2023-11-28 15:20   ` Jonathan Cameron
2023-11-28 15:20     ` Jonathan Cameron
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 10:31   ` Russell King
2023-11-07 10:31   ` Russell King
2023-11-07 17:48   ` Palmer Dabbelt
2023-11-07 17:48     ` Palmer Dabbelt
2023-11-07 17:48     ` Palmer Dabbelt
2023-11-13  4:23   ` Gavin Shan
2023-11-13  4:23     ` Gavin Shan
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 10:31   ` Russell King (Oracle)
2023-11-07 10:31   ` Russell King (Oracle)
2023-11-07 17:48   ` Palmer Dabbelt
2023-11-07 17:48     ` Palmer Dabbelt
2023-11-07 17:48     ` Palmer Dabbelt
2023-11-13  4:24   ` Gavin Shan
2023-11-13  4:24     ` Gavin Shan
2023-11-13  4:24     ` Gavin Shan
2023-11-28 15:21   ` Jonathan Cameron
2023-11-28 15:21     ` Jonathan Cameron
2023-11-28 15:21     ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.