From patchwork Wed Aug 16 11:22:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9903489 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 D7EB66038C for ; Wed, 16 Aug 2017 11:24:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA81627CEA for ; Wed, 16 Aug 2017 11:24:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF78D28769; Wed, 16 Aug 2017 11:24:18 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 85DBC27CEA for ; Wed, 16 Aug 2017 11:24:17 +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 1dhwOv-0006BV-TE; Wed, 16 Aug 2017 11:22:17 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhwOu-0006Ai-CS for xen-devel@lists.xen.org; Wed, 16 Aug 2017 11:22:16 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 67/47-01862-7EA24995; Wed, 16 Aug 2017 11:22:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUve51pR Ig7uPuCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozO3S1MBXuFK2adf8HWwHiBv4uRk0NCwF/i /uW9zCA2m4C+xO4Xn5hAbBEBdYnTHRdZuxg5OJgF/CQOPfAFCQsLOEpsufsCrJxFQFXi9s9tY OW8Ap4S1w7cZ4EYKSdx/vhPsBpOAS+JC3t2gNUIAdXc2rGPFcJWk7jWf4kdoldQ4uTMJ2C9zA ISEgdfvGCewMg7C0lqFpLUAkamVYzqxalFZalFuoZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTm JScV6yfm5mxiBgcMABDsYl390OsQoycGkJMq76OykSCG+pPyUyozE4oz4otKc1OJDjDIcHEoS vLWaUyKFBItS01Mr0jJzgCEMk5bg4FES4U0DSfMWFyTmFmemQ6ROMepyvJrw/xuTEEtefl6ql DjvapAiAZCijNI8uBGweLrEKCslzMsIdJQQT0FqUW5mCar8K0ZxDkYlYd5NIFN4MvNK4Da9Aj qCCeiIK+2TQI4oSURISTUwxotd+Cn9e72xfPuzgpuHBfleWX+IUA9X+bUv+9TZxqnv3uxoN5j tbZA1451xdaCyctnZOAenpuVzRM5L1xw///p0RLH0nUXfq7OuLSmvm6Ru9FWspaMgxcdH6Na/ tOLevd8jgkKXFec0uZnXVPN1Gyokdq3uvm3O/HjyJ76Wk7vzL8ir/mZRYinOSDTUYi4qTgQAg wLPQaICAAA= X-Env-Sender: prvs=3941fdc67=Andrew.Cooper3@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1502882533!102640526!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5784 invoked from network); 16 Aug 2017 11:22:14 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 16 Aug 2017 11:22:14 -0000 X-IronPort-AV: E=Sophos;i="5.41,382,1498521600"; d="scan'208";a="435692131" From: Andrew Cooper To: Xen-devel Date: Wed, 16 Aug 2017 12:22:07 +0100 Message-ID: <1502882530-31700-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1502882530-31700-1-git-send-email-andrew.cooper3@citrix.com> References: <1502882530-31700-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v2 1/4] x86/mcheck: Minor cleanup to amd_nonfatal 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP * Drop trailing whitespace. * Move amd_nonfatal_mcheck_init() into .init.text and drop a trailing return. * Drop unnecessary wmb()'s. Because of Xen's implementation, they are only compiler barriers anyway, and each wrmsr() is already fully serialising. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich New in v2 --- xen/arch/x86/cpu/mcheck/amd_nonfatal.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/amd_nonfatal.c b/xen/arch/x86/cpu/mcheck/amd_nonfatal.c index c6a9c89..222f539 100644 --- a/xen/arch/x86/cpu/mcheck/amd_nonfatal.c +++ b/xen/arch/x86/cpu/mcheck/amd_nonfatal.c @@ -106,7 +106,7 @@ static void mce_amd_checkregs(void *info) } else { mctelem_dismiss(mctc); } - + } else if (mctc != NULL) { mctelem_dismiss(mctc); } @@ -151,7 +151,7 @@ static void mce_amd_work_fn(void *data) /* HW does not count *all* kinds of correctable errors. * Thus it is possible, that the polling routine finds an - * correctable error even if the HW reports nothing. */ + * correctable error even if the HW reports nothing. */ if (counter > 0) { /* HW reported correctable errors, * the polling routine did not find... @@ -164,8 +164,8 @@ static void mce_amd_work_fn(void *data) (counter == 1 ? "" : "s"), (counter == 1 ? "was" : "were")); } - /* subtract 1 to not double count the error - * from the polling service routine */ + /* subtract 1 to not double count the error + * from the polling service routine */ adjust += (counter - 1); /* Restart counter */ @@ -174,7 +174,6 @@ static void mce_amd_work_fn(void *data) /* Counter enable */ value |= (1ULL << 51); mca_wrmsr(MSR_IA32_MCx_MISC(4), value); - wmb(); } } @@ -202,7 +201,7 @@ static void mce_amd_work_fn(void *data) adjust = 0; } -void amd_nonfatal_mcheck_init(struct cpuinfo_x86 *c) +void __init amd_nonfatal_mcheck_init(struct cpuinfo_x86 *c) { if (c->x86_vendor != X86_VENDOR_AMD) return; @@ -238,14 +237,10 @@ void amd_nonfatal_mcheck_init(struct cpuinfo_x86 *c) /* Counter enable */ value |= (1ULL << 51); wrmsrl(MSR_IA32_MCx_MISC(4), value); - /* serialize */ - wmb(); printk(XENLOG_INFO "MCA: Use hw thresholding to adjust polling frequency\n"); } } init_timer(&mce_timer, mce_amd_work_fn, NULL, 0); set_timer(&mce_timer, NOW() + period); - - return; }