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

[Xen-changelog] [xen stable-4.1] x86: fix CMCI injection



commit ab01d96364683bb10619b794611b9244ba5ea227
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 8 13:59:02 2013 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 8 13:59:02 2013 +0100

    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.
    
    Reported-by: Yongjie Ren <yongjie.ren@xxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Tested-by: Yongjie Ren <yongjie.ren@xxxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
    master changeset: 2f8c55ccefe49bb526df0eaf5fa9b7b788422208
    master date: 2013-02-26 10:15:56 +0100
---
 xen/arch/x86/cpu/mcheck/mce.c |   10 +++-------
 xen/arch/x86/io_apic.c        |    4 ++--
 xen/arch/x86/smp.c            |    5 +++++
 xen/include/asm-x86/smp.h     |    3 ++-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 73b8316..8a1c19c 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1253,12 +1253,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))
@@ -1541,7 +1535,9 @@ long do_mca(XEN_GUEST_HANDLE(xen_mc_t) u_xen_mc)
             if ( !cmci_support )
                 return x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
-            on_selected_cpus(&cpumap, x86_cmci_inject, NULL, 1);
+            if ( cpu_isset(smp_processor_id(), cpumap) )
+                send_IPI_self(CMCI_APIC_VECTOR);
+            send_IPI_mask(&cpumap, CMCI_APIC_VECTOR);
             break;
         default:
             return x86_mcerr("Wrong mca type\n", -EINVAL);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 423a55a..fb762b8 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -530,7 +530,7 @@ fastcall void smp_irq_move_cleanup_interrupt(struct 
cpu_user_regs *regs)
          * to myself.
          */
         if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
             goto unlock;
         }
         __get_cpu_var(vector_irq)[vector] = -1;
@@ -556,7 +556,7 @@ static void send_cleanup_vector(struct irq_cfg *cfg)
 
     cpus_and(cleanup_mask, cfg->old_cpu_mask, cpu_online_map);
     cfg->move_cleanup_count = cpus_weight(cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+    send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
     cfg->move_in_progress = 0;
 }
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 88cc9a0..8de4ea2 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -43,6 +43,11 @@ void send_IPI_mask(const cpumask_t *mask, int vector)
     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:
  *
diff --git a/xen/include/asm-x86/smp.h b/xen/include/asm-x86/smp.h
index ba8fa8a..3a7b18b 100644
--- a/xen/include/asm-x86/smp.h
+++ b/xen/include/asm-x86/smp.h
@@ -30,7 +30,8 @@ DECLARE_PER_CPU(cpumask_t, cpu_core_map);
 
 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);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.1

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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