]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86: track when in #MC context
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 26 Feb 2020 16:38:11 +0000 (17:38 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2020 16:38:11 +0000 (17:38 +0100)
Add helpers to track when executing in #MC handler context. This is
modeled after the in_irq helpers.

Note that there are no users of in_mce_handler() introduced by the
change, further users will be added by followup changes.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/mcheck/mce.c
xen/include/asm-x86/hardirq.h

index d61e582af3e094d06dc8803ced53ab9a39674234..e5bd4f542ce9b3242e1ea68a63fde9d0fc4b8720 100644 (file)
@@ -93,7 +93,9 @@ void x86_mce_vector_register(x86_mce_vector_t hdlr)
 
 void do_machine_check(const struct cpu_user_regs *regs)
 {
+    mce_enter();
     _machine_check_vector(regs);
+    mce_exit();
 }
 
 /*
index 069e48fce9b42dd5986b4f3af21a102120b4f759..276e3419d7783234095db4f7d717764c3866befa 100644 (file)
@@ -8,6 +8,7 @@ typedef struct {
        unsigned int __softirq_pending;
        unsigned int __local_irq_count;
        unsigned int nmi_count;
+       unsigned int mce_count;
        bool_t __mwait_wakeup;
 } __cacheline_aligned irq_cpustat_t;
 
@@ -23,6 +24,11 @@ typedef struct {
 #define nmi_enter()            (nmi_count(smp_processor_id())++)
 #define nmi_exit()             (nmi_count(smp_processor_id())--)
 
+#define mce_count(cpu)         __IRQ_STAT(cpu, mce_count)
+#define in_mce_handler()       (mce_count(smp_processor_id()) != 0)
+#define mce_enter()            (mce_count(smp_processor_id())++)
+#define mce_exit()             (mce_count(smp_processor_id())--)
+
 void ack_bad_irq(unsigned int irq);
 
 extern void apic_intr_init(void);