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

[Xen-devel] [PATCH v2 3/4] xen/mce: always re-initialize 'severity_cpu' in mcheck_cmn_handler()



mcheck_cmn_handler() does not always set 'severity_cpu' to override
its value taken from previous rounds of MC handling, which will
interfere the current round of MC handling. Always re-initialize it to
clear the historical value.

Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index a2e9668..d1bc642 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -449,13 +449,25 @@ static int mce_urgent_action(const struct cpu_user_regs 
*regs,
 void mcheck_cmn_handler(const struct cpu_user_regs *regs)
 {
     static DEFINE_MCE_BARRIER(mce_trap_bar);
-    static atomic_t severity_cpu = ATOMIC_INIT(-1);
+    static DEFINE_MCE_BARRIER(mce_handler_init_bar);
+    static atomic_t severity_cpu;
     struct mca_banks *bankmask = mca_allbanks;
     struct mca_banks *clear_bank = __get_cpu_var(mce_clear_banks);
     uint64_t gstatus;
     mctelem_cookie_t mctc = NULL;
     struct mca_summary bs;
 
+    /*
+     * Re-initialize severity_cpu to clear historical information
+     * taken from previous rounds of MC handling. Besides this
+     * initialization, severity_cpu is not always set below to
+     * override the previous value, so the re-initialization is
+     * necessary.
+     */
+    mce_barrier_enter(&mce_handler_init_bar);
+    atomic_set(&severity_cpu, -1);
+    mce_barrier_exit(&mce_handler_init_bar);
+
     mce_spin_lock(&mce_logout_lock);
 
     if (clear_bank != NULL) {
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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