Skip to contentSkip to conversation

cpu-hotplug: provide prototypes for arch CPU registration

PATCH Applied Russell King (Oracle) 7 participants 10 messages Sep 25, 2023 – Oct 11, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpu-hotplug: provide prototypes for arch CPU registration

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions.

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

 arch/x86/include/asm/cpu.h  | 2 --
 arch/x86/kernel/topology.c  | 2 +-
 include/linux/cpu.h         | 2 ++
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/cpu.h +0 -2
index 3a233ebff712..25050d953eee 100644
@@ -28,8 +28,6 @@ struct x86_cpu {
 };
 
 #ifdef CONFIG_HOTPLUG_CPU
-extern int arch_register_cpu(int num);
-extern void arch_unregister_cpu(int);
 extern void soft_restart_cpu(void);
 #endif
 
arch/x86/kernel/topology.c +1 -1
index ca004e2e4469..0bab03130033 100644
@@ -54,7 +54,7 @@ void arch_unregister_cpu(int num)
 EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
-static int __init arch_register_cpu(int num)
+int __init arch_register_cpu(int num)
 {
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
include/linux/cpu.h +2 -0
index 0abd60a7987b..eb768a866fe3 100644
@@ -80,6 +80,8 @@ extern __printf(4, 5)
 struct device *cpu_device_create(struct device *parent, void *drvdata,
 				 const struct attribute_group **groups,
 				 const char *fmt, ...);
+extern int arch_register_cpu(int cpu);
+extern void arch_unregister_cpu(int cpu);
 #ifdef CONFIG_HOTPLUG_CPU
 extern void unregister_cpu(struct cpu *cpu);
 extern ssize_t arch_cpu_probe(const char *, size_t);
Signature · 1 line
2.30.2
#1 lore raw

Hi Russell,

Quoted 15 lines · Russell King (Oracle)

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions.

Quoted 9 lines

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

  arch/x86/include/asm/cpu.h  | 2 --
  arch/x86/kernel/topology.c  | 2 +-
  include/linux/cpu.h         | 2 ++
  3 files changed, 3 insertions(+), 3 deletions(-)

In Linux 6.6.rc3, the prototypes are still existing in arch/ia64/include/asm/cpu.h. They may have been dropped in other ia64 or x86 git repository, which this patch bases on.

In the commit message, 'static' from one of ia64's arch_register_cpu() definitions is removed, but there is no changes related to ia64 in this patch. I guess that's probably x86?

Quoted 18 lines
arch/x86/include/asm/cpu.h +0 -2
index 3a233ebff712..25050d953eee 100644
@@ -28,8 +28,6 @@ struct x86_cpu {
  };
 
  #ifdef CONFIG_HOTPLUG_CPU
-extern int arch_register_cpu(int num);
-extern void arch_unregister_cpu(int);
  extern void soft_restart_cpu(void);
  #endif
 
arch/x86/kernel/topology.c +0 -0
index ca004e2e4469..0bab03130033 100644

arch/x86/kernel/topology.c void arch_unregister_cpu(int num) · line 60

Quoted 8 lines
arch/x86/kernel/topology.c +1 -1
@@ -54,7 +54,7 @@ void arch_unregister_cpu(int num)
  EXPORT_SYMBOL(arch_unregister_cpu);
  #else /* CONFIG_HOTPLUG_CPU */
 
-static int __init arch_register_cpu(int num)
+int __init arch_register_cpu(int num)
  {
  	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
  }

I think arch/ia64/kernel/topology.c may need same change, as stated in the commit log. In linux 6.6.rc3, 'static' exists in arch/ia64/kernel/topology.c::arch_register_cpu(). Again, your patch may have been based on other git repository.

include/linux/cpu.h extern __printf(4, 5) · line 87

Quoted 13 lines
include/linux/cpu.h +2 -0
index 0abd60a7987b..eb768a866fe3 100644
@@ -80,6 +80,8 @@ extern __printf(4, 5)
  struct device *cpu_device_create(struct device *parent, void *drvdata,
  				 const struct attribute_group **groups,
  				 const char *fmt, ...);
+extern int arch_register_cpu(int cpu);
+extern void arch_unregister_cpu(int cpu);
  #ifdef CONFIG_HOTPLUG_CPU
  extern void unregister_cpu(struct cpu *cpu);
  extern ssize_t arch_cpu_probe(const char *, size_t);

Thanks,
Gavin

#2 lore raw
Quoted 22 lines · Gavin Shan

Hi Russell,

Quoted 19 lines · Russell King (Oracle)

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions.

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

Quoted 7 lines
Quoted 5 lines
  arch/x86/include/asm/cpu.h  | 2 --
  arch/x86/kernel/topology.c  | 2 +-
  include/linux/cpu.h         | 2 ++
  3 files changed, 3 insertions(+), 3 deletions(-)

In Linux 6.6.rc3, the prototypes are still existing in arch/ia64/include/asm/cpu.h.

Correct, but I have been told that IA64 has been removed, so I removed those changes from my patch.

Quoted 2 lines

They may have been dropped in other ia64 or x86 git repository, which this patch bases on.

I have no idea which repository they have been dropped from. I only know what tglx told me, and despite asking the question, I never got any answer. So I've done the best I can with this patch. If kernel devs want to state things in vague terms, and then go silent when asked questions to elaborate, then that leads to guessing.

Maybe someone else should adapt this patch to apply to whatever tree it is going to end up being applied to - because I have no idea _which_ tree it'll end up being applied to.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw
Quoted 43 lines · Russell King (Oracle)
Quoted 22 lines · Gavin Shan

Hi Russell,

Quoted 19 lines · Russell King (Oracle)

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions.

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

Quoted 7 lines
Quoted 5 lines
  arch/x86/include/asm/cpu.h  | 2 --
  arch/x86/kernel/topology.c  | 2 +-
  include/linux/cpu.h         | 2 ++
  3 files changed, 3 insertions(+), 3 deletions(-)

In Linux 6.6.rc3, the prototypes are still existing in arch/ia64/include/asm/cpu.h.

Correct, but I have been told that IA64 has been removed, so I removed those changes from my patch.

Quoted 2 lines

They may have been dropped in other ia64 or x86 git repository, which this patch bases on.

I have no idea which repository they have been dropped from. I only know what tglx told me, and despite asking the question, I never got any answer. So I've done the best I can with this patch. If kernel devs want to state things in vague terms, and then go silent when asked questions to elaborate, then that leads to guessing.

Quoted 3 lines

Maybe someone else should adapt this patch to apply to whatever tree it is going to end up being applied to - because I have no idea _which_ tree it'll end up being applied to.

So, is this how the Linux community is now dysfunctional?

Someone sends a patch.
Thomas reviews, says it's a good idea and provides some feedback. Author asks questions, gets ignored.
Author sends a patch taking in to account that previous feedback. Someone else replies, contradicting the previous feedback. Nothing else happens.

What a bloody sorry state of affairs.

Makes me wonder what the point of trying to contribute to the Linux kernel outside of the areas I actually maintain anymore is.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#4 lore raw
Quoted 6 lines · Russell King (Oracle)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

If this is RFC v2, we put "RFC v2" in the subject, then people know you
are sending a newer version. People are busy, and your patch could be skipped if it appears the same as a previous one.

#5 lore raw
Quoted 10 lines · Xin Li
Quoted 6 lines · Russell King (Oracle)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

If this is RFC v2, we put "RFC v2" in the subject, then people know you are sending a newer version.

Sorry, but this is yet another illustration why the kernel process is broken. Clearly, people do NOT bother reading what is actually written, but instead make up in their minds something completely different.

This is *NOT* RFC v2. This is RFC v2:

https://lore.kernel.org/all/[email protected]/

And what I wrote was "changes **** SINCE **** RFC v2". For those who find English difficult, this means that what follows is the list of changes that are in THIS posting that WERE NOT IN THE PREVIOUS POSTING which was RFC v2.

Thanks for making me even more frustrated than I was.

Quoted 2 lines

People are busy, and your patch could be
skipped if it appears the same as a previous one.

Yet another reason why the kernel process is just completely broken. "appears to be". Even when the changes are spelled out. Yes, right, people don't have time to read. If that's the case, then it's a waste of time adding a change log. It's a waste of time to add a commit message. In fact, it's a total waste of time trying to contribute to a rotten-to-the-core open source project that Linux seems to have turned into.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#6 lore raw
In reply to Russell King (Oracle)

Okay, I give up. 15 days, still no real progress. I don't see any point in submitting any further patches for the kernel outside of those areas that I maintain. Clearly no one cares enough to bother (a) properly reviewing the patch, (b) applying the patch that Thomas thought "makes tons of sense."

If patches that "makes tons of sense" just get ignored, then what does the future of the kernel hold? Crap, that's what, utter crap.

As I said, it seems that the Linux kernel process is basically totally broken and rotten. If a six line patch that "makes tons of sense" can't be applied, then there's basically no hope what so ever.

FFS.

Quoted 67 lines · Russell King (Oracle)

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions.

---
Changes since RFC v2:
- drop ia64 changes, as ia64 has already been removed.

 arch/x86/include/asm/cpu.h  | 2 --
 arch/x86/kernel/topology.c  | 2 +-
 include/linux/cpu.h         | 2 ++
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/cpu.h +0 -2
index 3a233ebff712..25050d953eee 100644
@@ -28,8 +28,6 @@ struct x86_cpu {
 };
 
 #ifdef CONFIG_HOTPLUG_CPU
-extern int arch_register_cpu(int num);
-extern void arch_unregister_cpu(int);
 extern void soft_restart_cpu(void);
 #endif
 
arch/x86/kernel/topology.c +1 -1
index ca004e2e4469..0bab03130033 100644
@@ -54,7 +54,7 @@ void arch_unregister_cpu(int num)
 EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
-static int __init arch_register_cpu(int num)
+int __init arch_register_cpu(int num)
 {
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
include/linux/cpu.h +2 -0
index 0abd60a7987b..eb768a866fe3 100644
@@ -80,6 +80,8 @@ extern __printf(4, 5)
 struct device *cpu_device_create(struct device *parent, void *drvdata,
 				 const struct attribute_group **groups,
 				 const char *fmt, ...);
+extern int arch_register_cpu(int cpu);
+extern void arch_unregister_cpu(int cpu);
 #ifdef CONFIG_HOTPLUG_CPU
 extern void unregister_cpu(struct cpu *cpu);
 extern ssize_t arch_cpu_probe(const char *, size_t);
Signature · 1 line
2.30.2
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#7 lore raw
Quoted 6 lines · Russell King

Okay, I give up. 15 days, still no real progress. I don't see any point in submitting any further patches for the kernel outside of those areas that I maintain. Clearly no one cares enough to bother (a) properly reviewing the patch, (b) applying the patch that Thomas thought "makes tons of sense."

Quoted 6 lines

If patches that "makes tons of sense" just get ignored, then what does the future of the kernel hold? Crap, that's what, utter crap.

As I said, it seems that the Linux kernel process is basically totally broken and rotten. If a six line patch that "makes tons of sense" can't be applied, then there's basically no hope what so ever.

Oh well. I usually try to keep track of such stuff, but this one fell through the cracks.

Shit happens and we are all human, no?

Sorry for the wrong information about ia64. The removal did not happen because someone stepped up as a possible maintainer.

Thanks,

tglx

#8 lore raw

Hello Thomas,

st 11. 10. 2023 v 14:06 odesílatel Thomas Gleixner <[email protected]> napsal:

Quoted 4 lines

Sorry for the wrong information about ia64. The removal did not happen because someone stepped up as a possible maintainer.

Does that mean that the removal patch will be reverted soon in asm-generic and linux-next? Both have no ia64 as of now, and there are already a few patches without ia64 part (e,g,
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git/commit/?id=2fd0ebad27bcd4c8fc61c61a98d4283c47054bcf).
Without the revert, patches affecting ia64 will conflict.

I am the person who volunteered to maintain the architecture. If the removal was indeed cancelled, me and Frank Scheiner can start testing and reviewing patches affecting ia64.

Thanks,

Tomas

#9 lore raw

[tip: smp/urgent] cpu-hotplug: Provide prototypes for arch CPU registration

In reply to Russell King (Oracle)
The following commit has been merged into the smp/urgent branch of tip:

The following commit has been merged into the smp/urgent branch of tip:

Commit-ID:     c4dd854f740c21ae8dd9903fc67969c5497cb14b
Gitweb:        https://git.kernel.org/tip/c4dd854f740c21ae8dd9903fc67969c5497cb14b
Author:        Russell King (Oracle) <[email protected]>
AuthorDate:    Mon, 25 Sep 2023 17:28:39 +01:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Wed, 11 Oct 2023 14:27:37 +02:00

cpu-hotplug: Provide prototypes for arch CPU registration

Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros.

Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, do the job once for everyone.

Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and therefore remove the 'static' from one of ia64's arch_register_cpu() definitions.

[ tglx: Bring back the ia64 part and remove the ACPI prototypes ]

---
 arch/ia64/include/asm/cpu.h   | 5 -----
 arch/ia64/kernel/topology.c   | 2 +-
 arch/x86/include/asm/cpu.h    | 2 --
 arch/x86/kernel/topology.c    | 2 +-
 drivers/acpi/acpi_processor.c | 1 +
 include/acpi/processor.h      | 5 -----
 include/linux/cpu.h           | 2 ++
 7 files changed, 5 insertions(+), 14 deletions(-)
arch/ia64/include/asm/cpu.h +0 -5
index db125df..642d716 100644
@@ -15,9 +15,4 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_devices);
 
 DECLARE_PER_CPU(int, cpu_state);
 
-#ifdef CONFIG_HOTPLUG_CPU
-extern int arch_register_cpu(int num);
-extern void arch_unregister_cpu(int);
-#endif
-
 #endif /* _ASM_IA64_CPU_H_ */
arch/ia64/kernel/topology.c +1 -1
index 94a848b..741863a 100644
@@ -59,7 +59,7 @@ void __ref arch_unregister_cpu(int num)
 }
 EXPORT_SYMBOL(arch_unregister_cpu);
 #else
-static int __init arch_register_cpu(int num)
+int __init arch_register_cpu(int num)
 {
 	return register_cpu(&sysfs_cpus[num].cpu, num);
 }
arch/x86/include/asm/cpu.h +0 -2
index 3a233eb..25050d9 100644
@@ -28,8 +28,6 @@ struct x86_cpu {
 };
 
 #ifdef CONFIG_HOTPLUG_CPU
-extern int arch_register_cpu(int num);
-extern void arch_unregister_cpu(int);
 extern void soft_restart_cpu(void);
 #endif
 
arch/x86/kernel/topology.c +1 -1
index ca004e2..0bab031 100644
@@ -54,7 +54,7 @@ void arch_unregister_cpu(int num)
 EXPORT_SYMBOL(arch_unregister_cpu);
 #else /* CONFIG_HOTPLUG_CPU */
 
-static int __init arch_register_cpu(int num)
+int __init arch_register_cpu(int num)
 {
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
 }
drivers/acpi/acpi_processor.c +1 -0
index c711db8..0f5218e 100644
@@ -12,6 +12,7 @@
 #define pr_fmt(fmt) "ACPI: " fmt
 
 #include <linux/acpi.h>
+#include <linux/cpu.h>
 #include <linux/device.h>
 #include <linux/dmi.h>
 #include <linux/kernel.h>
include/acpi/processor.h +0 -5
index 94181fe..3f34ebb 100644
@@ -465,9 +465,4 @@ extern int acpi_processor_ffh_lpi_probe(unsigned int cpu);
 extern int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi);
 #endif
 
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-extern int arch_register_cpu(int cpu);
-extern void arch_unregister_cpu(int cpu);
-#endif
-
 #endif
include/linux/cpu.h +2 -0
index 0abd60a..eb768a8 100644
@@ -80,6 +80,8 @@ extern __printf(4, 5)
 struct device *cpu_device_create(struct device *parent, void *drvdata,
 				 const struct attribute_group **groups,
 				 const char *fmt, ...);
+extern int arch_register_cpu(int cpu);
+extern void arch_unregister_cpu(int cpu);
 #ifdef CONFIG_HOTPLUG_CPU
 extern void unregister_cpu(struct cpu *cpu);
 extern ssize_t arch_cpu_probe(const char *, size_t);