A small set of SMP/CPU hotplug updates:

- Reverse the order of iteration when freezing secondary CPUs for
     hibernation.
 
     This avoids that drivers like the Intel uncore performance counter have
     to transfer the assignement of handling the per package uncore events
     for every CPU in a package, which is a considerable speedup on larger
     systems.
 
   - Add a missing destroy_work_on_stack() invocation in smp_call_on_cpu()
     to prevent debug objects to emit a false positive warning when the
     stack is freed.
 
   - Small cleanups in comments and a str_plural() conversion
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmaUNnYTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYocjbEACqfc8EkTEJczAMbAaq7Nq7jYGRt5e8
 UyWpbnT1re63TAiGUEAr7pPJd6ucXAwPOHBt0V+j1HIr2UsaGT2/cfnlSipR68xh
 UmqPxXpuba+JeZDS0Bf6gRXKYBogVWFgjP8cp+f9IKr6xMgwJc7ujB9mX0YKmIgz
 bDoaFS+NFSD1ZS7tuidLqfU9UmJYRDRhyZg124HwDXG20zHR2CHgP4QQ2bHOvxZU
 LKbdjoHBmGtkLomS+R1UxsT+onsnE0c1EN37LX0mUE5L1YbUTcbZlXLLG7T35jOO
 rvai+EKVbA2KUAtrM/LZ8WZ0Lt5DTjMrouyzv6of7N2WljijdlxMb04sXl7kdng+
 rohRfDB6yNhQhEnDx6fd+IP/JCpPCctCmkN/QbvMBfnRnTe1yNg/gmnWaY3RAHNM
 GBifAxSEosMn7AMnSs/or6DAVNHVxI3Ms+r4Xb/o1JvGx7PXiBULh1Nww5WdxmBl
 IraXNR/R0qXUokXmNtJrq3aG/SepKWAc0BJJc3b6zA9tf5rsizTaxetTVZLS6jOX
 /DHJOOgAlLRDZdE53YpdL3HVVTdM/BDSM0xpMO7uxdJ4laJ9s+7dFGk9KXxu24qM
 6dIG6hn7D9XT0q05sP+r7qO0ygIe0Qorg5bA+xgvpYdPNrVfQpjzkj5jwkspvk+l
 5/gpTUmVm8Vwhw==
 =M4eq
 -----END PGP SIGNATURE-----

Merge tag 'smp-core-2024-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug updates from Thomas Gleixner:
 "A small set of SMP/CPU hotplug updates:

   - Reverse the order of iteration when freezing secondary CPUs for
     hibernation.

     This avoids that drivers like the Intel uncore performance counter
     have to transfer the assignement of handling the per package uncore
     events for every CPU in a package, which is a considerable speedup
     on larger systems.

   - Add a missing destroy_work_on_stack() invocation in
     smp_call_on_cpu() to prevent debug objects to emit a false positive
     warning when the stack is freed.

   - Small cleanups in comments and a str_plural() conversion"

* tag 'smp-core-2024-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  smp: Add missing destroy_work_on_stack() call in smp_call_on_cpu()
  cpu/hotplug: Reverse order of iteration in freeze_secondary_cpus()
  smp: Use str_plural() to fix Coccinelle warnings
  cpu/hotplug: Fix typo in comment
This commit is contained in:
Linus Torvalds 2024-07-15 14:55:30 -07:00
commit 0eff0491e7
3 changed files with 6 additions and 5 deletions

View File

@ -27,7 +27,7 @@
* startup callbacks sequentially from CPUHP_OFFLINE + 1 to CPUHP_ONLINE
* during a CPU online operation. During a CPU offline operation the
* installed teardown callbacks are invoked in the reverse order from
* CPU_ONLINE - 1 down to CPUHP_OFFLINE.
* CPUHP_ONLINE - 1 down to CPUHP_OFFLINE.
*
* The state space has three sections: PREPARE, STARTING and ONLINE.
*

View File

@ -1894,8 +1894,8 @@ int freeze_secondary_cpus(int primary)
cpumask_clear(frozen_cpus);
pr_info("Disabling non-boot CPUs ...\n");
for_each_online_cpu(cpu) {
if (cpu == primary)
for (cpu = nr_cpu_ids - 1; cpu >= 0; cpu--) {
if (!cpu_online(cpu) || cpu == primary)
continue;
if (pm_wakeup_pending()) {

View File

@ -25,6 +25,7 @@
#include <linux/nmi.h>
#include <linux/sched/debug.h>
#include <linux/jump_label.h>
#include <linux/string_choices.h>
#include <trace/events/ipi.h>
#define CREATE_TRACE_POINTS
@ -982,8 +983,7 @@ void __init smp_init(void)
num_nodes = num_online_nodes();
num_cpus = num_online_cpus();
pr_info("Brought up %d node%s, %d CPU%s\n",
num_nodes, (num_nodes > 1 ? "s" : ""),
num_cpus, (num_cpus > 1 ? "s" : ""));
num_nodes, str_plural(num_nodes), num_cpus, str_plural(num_cpus));
/* Any cleanup work */
smp_cpus_done(setup_max_cpus);
@ -1119,6 +1119,7 @@ int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
queue_work_on(cpu, system_wq, &sscs.work);
wait_for_completion(&sscs.done);
destroy_work_on_stack(&sscs.work);
return sscs.ret;
}