Skip to contentSkip to conversation

x86: fix CMCI injection

PATCH In review Jan Beulich 4 participants 6 messages Feb 25, 2013 – Mar 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix CMCI injection

This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it).

In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code.

xen/arch/x86/cpu/mcheck/mce.c +7 -8
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
 unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;
 
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
@@ -1198,12 +1199,6 @@ static void x86_mc_mceinject(void *data)
     __asm__ __volatile__("int $0x12");
 }
 
-static void x86_cmci_inject(void *data)
-{
-    printk("Simulating CMCI on cpu %d\n", smp_processor_id());
-    __asm__ __volatile__("int $0xf7");
-}
-
 #if BITS_PER_LONG == 64
 
 #define ID2COOKIE(id) ((mctelem_cookie_t)(id))
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
             on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
             break;
         case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )
                 ret = x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
             else
-                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
+            {
+                if ( cpumask_test_cpu(smp_processor_id(), cpumap) )
+                    send_IPI_self(cmci_apic_vector);
+                send_IPI_mask(cpumap, cmci_apic_vector);
+            }
             break;
         default:
             ret = x86_mcerr("Wrong mca type\n", -EINVAL);
xen/arch/x86/cpu/mcheck/mce.h +2 -0
@@ -37,6 +37,8 @@ enum mcheck_type {
 	mcheck_intel
 };
 
+extern uint8_t cmci_apic_vector;
+
 /* Init functions */
 enum mcheck_type amd_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
xen/arch/x86/cpu/mcheck/mce_intel.c +0 -1
@@ -644,7 +644,6 @@ static void intel_init_cmci(struct cpuin
 {
     u32 l, apic;
     int cpu = smp_processor_id();
-    static uint8_t cmci_apic_vector;
 
     if (!mce_available(c) || !cmci_support) {
         if (opt_cpu_info)
xen/arch/x86/irq.c +2 -2
@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c
          * to myself.
          */
         if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
             TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
                      irq, vector, smp_processor_id());
             goto unlock;
@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i
 
     cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
     desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
     desc->arch.move_in_progress = 0;
 }
xen/arch/x86/smp.c +5 -0
@@ -38,6 +38,11 @@ void send_IPI_mask(const cpumask_t *mask
     genapic->send_IPI_mask(mask, vector);
 }
 
+void send_IPI_self(int vector)
+{
+    genapic->send_IPI_self(vector);
+}
+
 /*
  *	Some notes on x86 processor bugs affecting SMP operation:
  *
xen/include/asm-x86/smp.h +2 -1
@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_
 
 void smp_send_nmi_allbutself(void);
 
-void  send_IPI_mask(const cpumask_t *mask, int vector);
+void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_self(int vector);
 
 extern void (*mtrr_hook) (void);
 

x86: fix CMCI injection

This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it).

In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code.

xen/arch/x86/cpu/mcheck/mce.c +7 -8
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
 unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;
 
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
@@ -1198,12 +1199,6 @@ static void x86_mc_mceinject(void *data)
     __asm__ __volatile__("int $0x12");
 }
 
-static void x86_cmci_inject(void *data)
-{
-    printk("Simulating CMCI on cpu %d\n", smp_processor_id());
-    __asm__ __volatile__("int $0xf7");
-}
-
 #if BITS_PER_LONG == 64
 
 #define ID2COOKIE(id) ((mctelem_cookie_t)(id))
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
             on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
             break;
         case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )
                 ret = x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
             else
-                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
+            {
+                if ( cpumask_test_cpu(smp_processor_id(), cpumap) )
+                    send_IPI_self(cmci_apic_vector);
+                send_IPI_mask(cpumap, cmci_apic_vector);
+            }
             break;
         default:
             ret = x86_mcerr("Wrong mca type\n", -EINVAL);
xen/arch/x86/cpu/mcheck/mce.h +2 -0
@@ -37,6 +37,8 @@ enum mcheck_type {
 	mcheck_intel
 };
 
+extern uint8_t cmci_apic_vector;
+
 /* Init functions */
 enum mcheck_type amd_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
xen/arch/x86/cpu/mcheck/mce_intel.c +0 -1
@@ -644,7 +644,6 @@ static void intel_init_cmci(struct cpuin
 {
     u32 l, apic;
     int cpu = smp_processor_id();
-    static uint8_t cmci_apic_vector;
 
     if (!mce_available(c) || !cmci_support) {
         if (opt_cpu_info)
xen/arch/x86/irq.c +2 -2
@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c
          * to myself.
          */
         if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
             TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
                      irq, vector, smp_processor_id());
             goto unlock;
@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i
 
     cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
     desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
     desc->arch.move_in_progress = 0;
 }
xen/arch/x86/smp.c +5 -0
@@ -38,6 +38,11 @@ void send_IPI_mask(const cpumask_t *mask
     genapic->send_IPI_mask(mask, vector);
 }
 
+void send_IPI_self(int vector)
+{
+    genapic->send_IPI_self(vector);
+}
+
 /*
  *	Some notes on x86 processor bugs affecting SMP operation:
  *
xen/include/asm-x86/smp.h +2 -1
@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_
 
 void smp_send_nmi_allbutself(void);
 
-void  send_IPI_mask(const cpumask_t *mask, int vector);
+void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_self(int vector);
 
 extern void (*mtrr_hook) (void);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Tested-by on v1 1/1
#1 lore raw

Best Regards,
Yongjie (Jay)

Quoted 132 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 26, 2013 12:49 AM
To: xen-devel
Cc: Liu, Jinsong; Ren, Yongjie
Subject: [PATCH] x86: fix CMCI injection

This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it).

In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code.

xen/arch/x86/cpu/mcheck/mce.c +1 -6
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
 unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;
 
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
@@ -1198,12 +1199,6 @@ static void x86_mc_mceinject(void *data)
     __asm__ __volatile__("int $0x12");
 }
 
-static void x86_cmci_inject(void *data)
-{
-    printk("Simulating CMCI on cpu %d\n", smp_processor_id());
-    __asm__ __volatile__("int $0xf7");
-}
-
 #if BITS_PER_LONG == 64
 
 #define ID2COOKIE(id) ((mctelem_cookie_t)(id))
@@ -1479,11 +1474,15 @@ long

do_mca(XEN_GUEST_HANDLE_PARAM(xen_m

             on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
             break;
         case XEN_MC_INJECT_TYPE_CMCI:
xen/arch/x86/cpu/mcheck/mce.c +6 -2
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )
                 ret = x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
             else
-                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
+            {
+                if ( cpumask_test_cpu(smp_processor_id(), cpumap) )
+                    send_IPI_self(cmci_apic_vector);
+                send_IPI_mask(cpumap, cmci_apic_vector);
+            }
             break;
         default:
             ret = x86_mcerr("Wrong mca type\n", -EINVAL);
xen/arch/x86/cpu/mcheck/mce.h +2 -0
@@ -37,6 +37,8 @@ enum mcheck_type {
 	mcheck_intel
 };
 
+extern uint8_t cmci_apic_vector;
+
 /* Init functions */
 enum mcheck_type amd_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
xen/arch/x86/cpu/mcheck/mce_intel.c +0 -1
@@ -644,7 +644,6 @@ static void intel_init_cmci(struct cpuin
 {
     u32 l, apic;
     int cpu = smp_processor_id();
-    static uint8_t cmci_apic_vector;
 
     if (!mce_available(c) || !cmci_support) {
         if (opt_cpu_info)
xen/arch/x86/irq.c +2 -2
@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c
          * to myself.
          */
         if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
             TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
                      irq, vector, smp_processor_id());
             goto unlock;
@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i
 
     cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask,
 &cpu_online_map);
     desc->arch.move_cleanup_count =
 cpumask_weight(&cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask,
 IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
     desc->arch.move_in_progress = 0;

}

xen/arch/x86/smp.c +5 -0
@@ -38,6 +38,11 @@ void send_IPI_mask(const cpumask_t *mask
     genapic->send_IPI_mask(mask, vector);
 }
 
+void send_IPI_self(int vector)
+{
+    genapic->send_IPI_self(vector);
+}
+
 /*
  *	Some notes on x86 processor bugs affecting SMP operation:
  *
xen/include/asm-x86/smp.h +2 -1
@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_
 
 void smp_send_nmi_allbutself(void);
 
-void  send_IPI_mask(const cpumask_t *mask, int vector);
+void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_self(int vector);
 
 extern void (*mtrr_hook) (void);
 
Acked-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich

This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it).

In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code.

Quoted 114 lines
xen/arch/x86/cpu/mcheck/mce.c +7 -8
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
 bool_t is_mc_panic;
 unsigned int __read_mostly nr_mce_banks;
 unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;
 
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
 DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
@@ -1198,12 +1199,6 @@ static void x86_mc_mceinject(void *data)
     __asm__ __volatile__("int $0x12");
 }
 
-static void x86_cmci_inject(void *data)
-{
-    printk("Simulating CMCI on cpu %d\n", smp_processor_id());
-    __asm__ __volatile__("int $0xf7");
-}
-
 #if BITS_PER_LONG == 64
 
 #define ID2COOKIE(id) ((mctelem_cookie_t)(id))
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
             on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
             break;
         case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )
                 ret = x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
             else
-                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
+            {
+                if ( cpumask_test_cpu(smp_processor_id(), cpumap) )
+                    send_IPI_self(cmci_apic_vector);
+                send_IPI_mask(cpumap, cmci_apic_vector);
+            }
             break;
         default:
             ret = x86_mcerr("Wrong mca type\n", -EINVAL);
xen/arch/x86/cpu/mcheck/mce.h +0 -0
@@ -37,6 +37,8 @@ enum mcheck_type {

mcheck_intel
};

xen/arch/x86/cpu/mcheck/mce.h +2 -0
+extern uint8_t cmci_apic_vector;
+
 /* Init functions */
 enum mcheck_type amd_mcheck_init(struct cpuinfo_x86 *c);
 enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
xen/arch/x86/cpu/mcheck/mce_intel.c +0 -1
@@ -644,7 +644,6 @@ static void intel_init_cmci(struct cpuin
 {
     u32 l, apic;
     int cpu = smp_processor_id();
-    static uint8_t cmci_apic_vector;
 
     if (!mce_available(c) || !cmci_support) {
         if (opt_cpu_info)
xen/arch/x86/irq.c +2 -2
@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c
          * to myself.
          */
         if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
             TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
                      irq, vector, smp_processor_id());
             goto unlock;
@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i
 
     cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
     desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
     desc->arch.move_in_progress = 0;
 }
xen/arch/x86/smp.c +5 -0
@@ -38,6 +38,11 @@ void send_IPI_mask(const cpumask_t *mask
     genapic->send_IPI_mask(mask, vector);
 }
 
+void send_IPI_self(int vector)
+{
+    genapic->send_IPI_self(vector);
+}
+
 /*
  * Some notes on x86 processor bugs affecting SMP operation:
  *
xen/include/asm-x86/smp.h +2 -1
@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_
 
 void smp_send_nmi_allbutself(void);
 
-void  send_IPI_mask(const cpumask_t *mask, int vector);
+void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_self(int vector);
 
 extern void (*mtrr_hook) (void);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 8 lines · Keir Fraser
Quoted 6 lines · Jan Beulich

This fixes the wrong use of literal vector 0xF7 with an "int" instruction (invalidated by 25113:14609be41f36) and the fact that doing the injection via a software interrupt was never valid anyway (because cmci_interrupt() acks the LAPIC, which does the wrong thing if the interrupt didn't get delivered though it).

Quoted 7 lines
Quoted 5 lines

In order to do latter, the patch introduces send_IPI_self(), at once removing two opend coded uses of "genapic" in the IRQ handling code.

One nit inline.

Quoted 23 lines
Quoted 23 lines
xen/arch/x86/cpu/mcheck/mce.c +1 -6
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
  bool_t is_mc_panic;
  unsigned int __read_mostly nr_mce_banks;
  unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;
 
  DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, poll_bankmask);
  DEFINE_PER_CPU_READ_MOSTLY(struct mca_banks *, no_cmci_banks);
@@ -1198,12 +1199,6 @@ static void x86_mc_mceinject(void *data)
      __asm__ __volatile__("int $0x12");
  }
 
-static void x86_cmci_inject(void *data)
-{
-    printk("Simulating CMCI on cpu %d\n", smp_processor_id());
-    __asm__ __volatile__("int $0xf7");
-}
-
  #if BITS_PER_LONG == 64
 
Quoted 7 lines

xen/arch/x86/cpu/mcheck/mce.c long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m · line 1477

Quoted 7 lines
xen/arch/x86/cpu/mcheck/mce.c +1 -1
  #define ID2COOKIE(id) ((mctelem_cookie_t)(id))
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
              on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
              break;
          case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )

cmci_apic_vector is uninitialized here when the platform does not support CMCI.

Christoph

Quoted 81 lines
Quoted 81 lines
xen/arch/x86/cpu/mcheck/mce.c +5 -1
                  ret = x86_mcerr(
                      "No CMCI supported in platform\n", -EINVAL);
              else
-                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
+            {
+                if ( cpumask_test_cpu(smp_processor_id(), cpumap) )
+                    send_IPI_self(cmci_apic_vector);
+                send_IPI_mask(cpumap, cmci_apic_vector);
+            }
              break;
          default:
              ret = x86_mcerr("Wrong mca type\n", -EINVAL);
xen/arch/x86/cpu/mcheck/mce.h +0 -0
@@ -37,6 +37,8 @@ enum mcheck_type {

mcheck_intel
};

xen/arch/x86/cpu/mcheck/mce.h +2 -0
+extern uint8_t cmci_apic_vector;
+
  /* Init functions */
  enum mcheck_type amd_mcheck_init(struct cpuinfo_x86 *c);
  enum mcheck_type intel_mcheck_init(struct cpuinfo_x86 *c, bool_t bsp);
xen/arch/x86/cpu/mcheck/mce_intel.c +0 -1
@@ -644,7 +644,6 @@ static void intel_init_cmci(struct cpuin
  {
      u32 l, apic;
      int cpu = smp_processor_id();
-    static uint8_t cmci_apic_vector;
 
      if (!mce_available(c) || !cmci_support) {
          if (opt_cpu_info)
xen/arch/x86/irq.c +2 -2
@@ -646,7 +646,7 @@ void irq_move_cleanup_interrupt(struct c
           * to myself.
           */
          if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
              TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
                       irq, vector, smp_processor_id());
              goto unlock;
@@ -692,7 +692,7 @@ static void send_cleanup_vector(struct i
 
      cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
      desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
      desc->arch.move_in_progress = 0;
  }
xen/arch/x86/smp.c +5 -0
@@ -38,6 +38,11 @@ void send_IPI_mask(const cpumask_t *mask
      genapic->send_IPI_mask(mask, vector);
  }
 
+void send_IPI_self(int vector)
+{
+    genapic->send_IPI_self(vector);
+}
+
  /*
   * Some notes on x86 processor bugs affecting SMP operation:
   *
xen/include/asm-x86/smp.h +2 -1
@@ -29,7 +29,8 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_
 
  void smp_send_nmi_allbutself(void);
 
-void  send_IPI_mask(const cpumask_t *mask, int vector);
+void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_self(int vector);
 
  extern void (*mtrr_hook) (void);
 
#4 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Egger Christoph
Quoted 8 lines · Keir Fraser
Quoted 7 lines · Jan Beulich
xen/arch/x86/cpu/mcheck/mce.c +1 -0
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
  bool_t is_mc_panic;
  unsigned int __read_mostly nr_mce_banks;
  unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;

...

Quoted 9 lines
Quoted 6 lines

xen/arch/x86/cpu/mcheck/mce.c long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m · line 1477

Quoted 6 lines
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
              on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
              break;
          case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )

cmci_apic_vector is uninitialized here when the platform does not support CMCI.

How that? It's zero in that case (just like any other global variable without explicit initializer), which is exactly what the conditional tests for.

Jan

#5 lore raw
Quoted 21 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Egger Christoph
Quoted 8 lines · Keir Fraser
Quoted 7 lines · Jan Beulich
xen/arch/x86/cpu/mcheck/mce.c +1 -0
@@ -34,6 +34,7 @@ bool_t __read_mostly mce_broadcast = 0;
   bool_t is_mc_panic;
   unsigned int __read_mostly nr_mce_banks;
   unsigned int __read_mostly firstbank;
+uint8_t __read_mostly cmci_apic_vector;

...

Quoted 9 lines
Quoted 6 lines

xen/arch/x86/cpu/mcheck/mce.c long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m · line 1477

Quoted 6 lines
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1479,11 +1474,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_m
               on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
               break;
           case XEN_MC_INJECT_TYPE_CMCI:
-            if ( !cmci_support )
+            if ( !cmci_apic_vector )

cmci_apic_vector is uninitialized here when the platform does not support CMCI.

Quoted 3 lines

How that? It's zero in that case (just like any other global variable without explicit initializer), which is exactly what the conditional tests for.

umm... right. Sorry for the noise.

Christoph