Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5500365ybe; Tue, 17 Sep 2019 08:54:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKdJElOOGLiq4TwdG26UkRRNvxJorb50x1I1eg/q9BV59whulWVNKg75jlm7qkb925mtxs X-Received: by 2002:a50:fb13:: with SMTP id d19mr5381132edq.63.1568735694216; Tue, 17 Sep 2019 08:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568735694; cv=none; d=google.com; s=arc-20160816; b=iBeVo+rJ2JiSOyVyzdgLnd+V5MJDr+CvgIBjPWmXT+Obse7oDysbofxkpW3UK4b8Ti +bsVmwqP6fvT2ak/trW3Q94Vf7jx+QLkI6BqBCRS3bx40arNHWZaYqbldxGn8BLBRuxq 49UWjVhy8E8RjNX7LXssckzy5vtTTjrJaHod0/n5GybkngMyBMocwCYitpzyuPXDqXI6 QkZtNqWOn4HCMjXGvRsb81CGoJ3LTpcIdrcAgFK0ADloCV0xeJRM3H3cgbBL9EDcAQiP oQxVN0o2pu4qUMlayPU/5bedXLK70lg/hzvsNon7Etj+279g86/LdsmdUqH/B/t1eXtq ZEew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=lXnu9LYxvXPrDoGMIIc5Rueb7xYki9jvSlh0Gv2JEOU=; b=rbJzQlbRNdZRFzEm5lpEqK/9ig9K2ZDc84VD08joJ6kZyp8doUZkneyi0AK4WwQ9nh JW1FJHedm7ODOvjowTeFSbPTn3tto7kJNTrg4tBFLNThjaGG7sbztK9X0TG58xVb+DKf Y7k7Wl8OiaSBptRj5Sy09i95ws1EQ/x1xT7rTMoA6mdh7d9XScA28m+NEXNKAe34tJ2C cF1X/RRUR7wcPV2v+2/pXTrYub5l66RBS2M/ckx4Ye0P4w5igLrN2zEBO6Ysx3bw1Uht lAkFEYR7w1OCmvI/ucbIOouUDP/0knwjjarK67g8HdBoiyqYlroZtBAYFb5gkGWo7AlH qk3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ok21si948597ejb.296.2019.09.17.08.54.29; Tue, 17 Sep 2019 08:54:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404378AbfIQGyN convert rfc822-to-8bit (ORCPT + 99 others); Tue, 17 Sep 2019 02:54:13 -0400 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:17740 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2404356AbfIQGyL (ORCPT ); Tue, 17 Sep 2019 02:54:11 -0400 Received: from zxbjmbx3.zhaoxin.com (10.29.252.165) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Tue, 17 Sep 2019 14:54:06 +0800 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by zxbjmbx3.zhaoxin.com (10.29.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Tue, 17 Sep 2019 14:54:05 +0800 Received: from zxbjmbx1.zhaoxin.com ([fe80::b41a:737:a784:b70d]) by zxbjmbx1.zhaoxin.com ([fe80::b41a:737:a784:b70d%16]) with mapi id 15.01.1261.035; Tue, 17 Sep 2019 14:54:05 +0800 From: Tony W Wang-oc To: "Luck, Tony" CC: "Borislav Petkov (bp@alien8.de)" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "yazen.ghannam@amd.com" , "vishal.l.verma@intel.com" , "qiuxu.zhuo@intel.com" , David Wang , "Cooper Yan(BJ-RD)" , "Qiyuan Wang(BJ-RD)" , "Herry Yang(BJ-RD)" Subject: Re: [PATCH v3 4/4] x86/mce: Add Zhaoxin LMCE support Thread-Topic: [PATCH v3 4/4] x86/mce: Add Zhaoxin LMCE support Thread-Index: AdVtHDOle8Db4pQYQzu7i2JkrbUxgA== Date: Tue, 17 Sep 2019 06:54:05 +0000 Message-ID: <1da27840413348febf301ef39305de12@zhaoxin.com> Accept-Language: en-US, zh-CN Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.32.64.75] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 16, 2019, Luck, Tony wrote: >On Mon, Sep 16, 2019 at 11:37:18AM +0000, Tony W Wang-oc wrote: >> Zhaoxin newer CPUs support LMCE that compatible with Intel's >> "Machine-Check Architecture", so add support for Zhaoxin LMCE >> in mce/core.c. >> >> Signed-off-by: Tony W Wang-oc >> --- >> arch/x86/kernel/cpu/mce/core.c | 35 >+++++++++++++++++++++++++++++++++-- >> 1 file changed, 33 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c >> index 65c5a1f..acdd76b 100644 >> --- a/arch/x86/kernel/cpu/mce/core.c >> +++ b/arch/x86/kernel/cpu/mce/core.c >> @@ -1132,6 +1132,27 @@ static bool __mc_check_crashing_cpu(int cpu) >> u64 mcgstatus; >> >> mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); >> + >> + if (boot_cpu_data.x86_vendor == X86_VENDOR_ZHAOXIN) { >> + if (mcgstatus & MCG_STATUS_LMCES) >> + return false; >> + >> + if (!(mcgstatus & MCG_STATUS_LMCES)) { > >Don't really need this test ... you already did "return false" if >the LMCES bit was set ... so this test is redundant (and you can avoid >indenting the next dozen lines. Got it, Thank you. But have a question about below codes: if (mcgstatus & MCG_STATUS_RIPV) { mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); return true; } These seems require all #MC exception errors set MCG_STATUS_RIPV = 1 in order to skip synchronize which "return true;" actually does for this. As Intel SDM show, "Recoverable-not-continuable SRAR Type" errors may set MCG_STATUS_RIPV = 0, PCC = 0. When these #MC errors broadcast to offline CPU, may cause kernel panic with synchronize timeout (offline CPU can't skip synchronize in this case). Could "return true;" outside the if-case? if (mcgstatus & MCG_STATUS_RIPV) { mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); } return true; Sincerely TonyWWang-oc