[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86: always park offline CPUs



commit b0597289ebf89cda98d57f80014c633b9be18140
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 21 09:57:22 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 21 09:57:22 2026 +0200

    x86: always park offline CPUs
    
    While on AMD (or Hygon) CPUs the situation isn't as bad wrt broadcasting
    of #MC, some "multicast" can still happen. Therefore the reasoning to park
    CPUs rather than fully offlining them applies everywhere.
    
    Don't retain the dependency on the "mce=" cmdline option either: That
    option may best be dropped as well, as not enabling MCE will result in a
    shutdown when #MC would otherwise be raised.
    
    Drop the global variable, using a #define (just like common code does)
    instead. Outside of common code, simplify expressions / code accordingly.
    (In common code we still have to cater for x86 wanting it different from
    everyone else.)
    
    Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpu_idle.c      | 4 ++--
 xen/arch/x86/cpu/common.c         | 3 ---
 xen/arch/x86/cpu/mcheck/mce.c     | 9 +--------
 xen/arch/x86/genapic/x2apic.c     | 6 +-----
 xen/arch/x86/include/asm/percpu.h | 2 +-
 xen/arch/x86/include/asm/smp.h    | 6 ------
 xen/arch/x86/mpparse.c            | 8 ++------
 xen/arch/x86/setup.c              | 3 +--
 xen/arch/x86/smp.c                | 4 +---
 xen/arch/x86/smpboot.c            | 4 +---
 xen/include/xen/percpu.h          | 2 +-
 11 files changed, 11 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 1a749fabd2..56b22a2ff3 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -436,7 +436,7 @@ static void cf_check dump_cx(unsigned char key)
 
         if ( cpu_online(cpu) )
             print_acpi_power(cpu, power);
-        else if ( park_offline_cpus )
+        else
             printk("CPU%u parked in state %u (C%u)\n", cpu,
                    power->last_state ? power->last_state->idx : 1,
                    power->last_state ? power->last_state->type : 1);
@@ -1360,7 +1360,7 @@ long set_cx_pminfo(uint32_t acpi_id, struct 
xen_processor_power *power)
          * If we've just learned of more available C states, wake the CPU if
          * it's parked, so it can go back to sleep in perhaps a deeper state.
          */
-        if ( park_offline_cpus && apic_id != BAD_APICID )
+        if ( apic_id != BAD_APICID )
         {
             unsigned long flags;
 
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index d045ed6b41..43785d19cc 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -443,9 +443,6 @@ void __init early_cpu_init(bool verbose)
         * here.
         */
 
-       if (!(c->vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
-               park_offline_cpus = opt_mce;
-
        /*
         * If nominal freq isn't available, use highest, thus causing NOW()
         * output to move more slowly.  See preset_tsc_scale().
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 64fa66f026..1888f22d15 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -716,15 +716,8 @@ static int cf_check cpu_callback(
         rc = cpu_bank_alloc(cpu);
         break;
 
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        if ( !park_offline_cpus )
-            cpu_bank_free(cpu);
-        break;
-
     case CPU_REMOVE:
-        if ( park_offline_cpus )
-            cpu_bank_free(cpu);
+        cpu_bank_free(cpu);
         break;
     }
 
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 5f2765cf14..ca88593d0f 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -181,12 +181,8 @@ static int cf_check update_clusterinfo(
              !cond_alloc_cpumask_var(&per_cpu(scratch_mask, cpu)) )
             err = -ENOMEM;
         break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
+
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) ||
-             system_state == SYS_STATE_suspend )
-            break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
             cpumask_clear_cpu(cpu, per_cpu(cluster_cpus, cpu));
diff --git a/xen/arch/x86/include/asm/percpu.h 
b/xen/arch/x86/include/asm/percpu.h
index 34f589f990..fe3df03c4c 100644
--- a/xen/arch/x86/include/asm/percpu.h
+++ b/xen/arch/x86/include/asm/percpu.h
@@ -1,7 +1,7 @@
 #ifndef __X86_PERCPU_H__
 #define __X86_PERCPU_H__
 
-#define PARK_OFFLINE_CPUS_VAR
+#define park_offline_cpus true
 
 /*
  * Force uses of per_cpu() with an invalid area to attempt to access the
diff --git a/xen/arch/x86/include/asm/smp.h b/xen/arch/x86/include/asm/smp.h
index 3f16e62696..572b39b01c 100644
--- a/xen/arch/x86/include/asm/smp.h
+++ b/xen/arch/x86/include/asm/smp.h
@@ -25,12 +25,6 @@ DECLARE_PER_CPU(cpumask_var_t, scratch_cpumask);
 DECLARE_PER_CPU(cpumask_var_t, hpet_scratch_cpumask);
 DECLARE_PER_CPU(cpumask_var_t, send_ipi_cpumask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-extern bool park_offline_cpus;
-
 void smp_send_nmi_allbutself(void);
 
 void send_IPI_mask(const cpumask_t *mask, int vector);
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index 1b41aa573f..3cea519152 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -80,16 +80,12 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
        printk(XENLOG_INFO "SMP: Allowing %u CPUs (%d hotplug CPUs)\n",
               max_cpus, max_t(int, max_cpus - num_processors, 0));
 
-       if (!park_offline_cpus)
-               tot_cpus = max_cpus;
        nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
        if (nr_cpu_ids < num_processors)
        {
                unaccounted_cpus = true;
-               if (park_offline_cpus)
-                       printk(XENLOG_WARNING
-                              "SMP: Cannot bring up %u further CPUs\n",
-                              num_processors - nr_cpu_ids);
+               printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
+                      num_processors - nr_cpu_ids);
        }
 
 #ifndef nr_cpumask_bits
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7d71fea6c0..a636e3205c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2144,8 +2144,7 @@ void asmlinkage __init noreturn __start_xen(void)
             /* Set up node_to_cpumask based on cpu_to_node[]. */
             numa_add_cpu(i);
 
-            if ( (park_offline_cpus || num_online_cpus() < max_cpus) &&
-                 !cpu_online(i) )
+            if ( !cpu_online(i) )
             {
                 ret = cpu_up(i);
                 if ( ret != 0 )
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 7936294f5f..ae4e5a66d7 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -92,9 +92,7 @@ void send_IPI_mask(const cpumask_t *mask, int vector)
     if ( system_state > SYS_STATE_smp_boot &&
          !unaccounted_cpus && !disabled_cpus && !cpu_in_hotplug_context() &&
          /* NB: get_cpu_maps lock requires enabled interrupts. */
-         local_irq_is_enabled() && (cpus_locked = get_cpu_maps()) &&
-         (park_offline_cpus ||
-          cpumask_equal(&cpu_online_map, &cpu_present_map)) )
+         local_irq_is_enabled() && (cpus_locked = get_cpu_maps()) )
         cpumask_or(scratch, mask, cpumask_of(smp_processor_id()));
     else
     {
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index cede2b886f..fb73989232 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -67,8 +67,6 @@ DEFINE_PER_CPU_READ_MOSTLY(struct stubs, stubs);
 cpumask_t cpu_online_map __read_mostly;
 EXPORT_SYMBOL(cpu_online_map);
 
-bool __read_mostly park_offline_cpus;
-
 unsigned int __read_mostly nr_sockets;
 cpumask_t **__read_mostly socket_cpumask;
 static cpumask_t *secondary_socket_cpumask;
@@ -1151,7 +1149,7 @@ static int cf_check cpu_smpboot_callback(
         break;
     case CPU_UP_CANCELED:
     case CPU_DEAD:
-        cpu_smpboot_free(cpu, !park_offline_cpus);
+        cpu_smpboot_free(cpu, false);
         break;
     case CPU_REMOVE:
         cpu_smpboot_free(cpu, true);
diff --git a/xen/include/xen/percpu.h b/xen/include/xen/percpu.h
index d324671b5b..88f332caab 100644
--- a/xen/include/xen/percpu.h
+++ b/xen/include/xen/percpu.h
@@ -36,7 +36,7 @@
 #include <xen/types.h>
 #include <asm/current.h>
 
-#ifndef PARK_OFFLINE_CPUS_VAR
+#if !defined(PARK_OFFLINE_CPUS_VAR) && !defined(park_offline_cpus)
 /*
  * Do we, for platform reasons, need to actually keep CPUs online when we
  * would otherwise prefer them to be off?
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.