From patchwork Thu Apr 6 12:33:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9667085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DB36601EB for ; Thu, 6 Apr 2017 12:36:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3856828535 for ; Thu, 6 Apr 2017 12:36:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C00A28584; Thu, 6 Apr 2017 12:36:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB13D28535 for ; Thu, 6 Apr 2017 12:36:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw6c5-0007nn-8s; Thu, 06 Apr 2017 12:34:09 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw6c4-0007mv-5e for xen-devel@lists.xen.org; Thu, 06 Apr 2017 12:34:08 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 02/D0-01912-FB536E85; Thu, 06 Apr 2017 12:34:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeJIrShJLcpLzFFi42Jpa+sQ0d1l+iz CoGetocWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnHkxRe2gqfcFQeOXmZpYOzn6mLk4mARuMUk MfnFP3YQR0hgOqPE19lHWLsYOTkkBHgljiybAWUHSOxo2sMMUdTLKHGh/wwzSIJNQF9ixeODY EUiAtIS1z5fZgSxmQWqJaatPMcGYgsLeErMPPEDrJ5FQFWiv3UPO4jNK2Arse3LLyaIBfISF6 6eYgGxOQXsJI70/wWzhYBqVnb+Y5nAyLeAkWEVo0ZxalFZapGuoaleUlFmekZJbmJmjq6hgal ebmpxcWJ6ak5iUrFecn7uJkZgqDAAwQ7Ghu2ehxglOZiURHkVfJ5ECPEl5adUZiQWZ8QXleak Fh9ilOHgUJLgTeF4FiEkWJSanlqRlpkDDFqYtAQHj5IIbwoXUJq3uCAxtzgzHSJ1ilGX49HV9 ++ZhFjy8vNSpcR55/MAFQmAFGWU5sGNgEXQJUZZKWFeRqCjhHgKUotyM0tQ5V8xinMwKgnzdg gCTeHJzCuB2/QK6AgmoCN8bj0FOaIkESEl1cDoXjXld98H6S8Fexg2X7x0c5av/Cu346VpMiv N1aInflvPWxpW49A+05PHdOU2gZOvlHzWt57xCPO7tMTWosqj9FPaodlzrresc5V+abY0N7jr U83qUO5zF5UjYxd0819boSz83XIzH+fZO/eu7H2b2XNaLThvJ7PjRs6s4JYFe49bcUrqtisps RRnJBpqMRcVJwIAaDPzaZsCAAA= X-Env-Sender: haozhong.zhang@intel.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1491482033!70892879!2 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31434 invoked from network); 6 Apr 2017 12:34:02 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-10.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 6 Apr 2017 12:34:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491482042; x=1523018042; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=m6qjUtngQkaYIUvIflAjlACeiYLMmmsPp0sE3tGHU2Q=; b=HcPPXh3po4jFfMl6GJ1gPRJc9c20lp/NF3yc8BrECn0PnOXPdYPxQwHY GlrufzP8vdAgp0iaXEuIsGfIjQF/8A==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2017 05:33:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.37,159,1488873600"; d="scan'208"; a="1151979763" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.153]) by fmsmga002.fm.intel.com with ESMTP; 06 Apr 2017 05:33:53 -0700 From: Haozhong Zhang To: xen-devel@lists.xen.org Date: Thu, 6 Apr 2017 20:33:41 +0800 Message-Id: <20170406123343.23423-3-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170406123343.23423-1-haozhong.zhang@intel.com> References: <20170406123343.23423-1-haozhong.zhang@intel.com> Cc: Andrew Cooper , Jan Beulich , Haozhong Zhang Subject: [Xen-devel] [PATCH v2 2/4] xen/mce: make 'severity_cpu' private to its users X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current 'severity_cpu' is used by both mcheck_cmn_handler() and mce_softirq(). If MC# happens during mce_softirq(), the values set in mcheck_cmn_handler() and mce_softirq() may interfere with each other. Use private 'severity_cpu' for each function to fix this issue. Signed-off-by: Haozhong Zhang Reviewed-by: Jan Beulich --- xen/arch/x86/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 437d155..a2e9668 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -182,7 +182,6 @@ void mce_need_clearbank_register(mce_need_clearbank_t cbfunc) */ static DEFINE_SPINLOCK(mce_logout_lock); -static atomic_t severity_cpu = ATOMIC_INIT(-1); static atomic_t found_error = ATOMIC_INIT(0); static cpumask_t mce_fatal_cpus; @@ -450,6 +449,7 @@ 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); struct mca_banks *bankmask = mca_allbanks; struct mca_banks *clear_bank = __get_cpu_var(mce_clear_banks); uint64_t gstatus; @@ -1697,6 +1697,7 @@ static void mce_softirq(void) { static DEFINE_MCE_BARRIER(mce_inside_bar); static DEFINE_MCE_BARRIER(mce_severity_bar); + static atomic_t severity_cpu; int cpu = smp_processor_id(); unsigned int workcpu;