Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp545204rwd; Wed, 7 Jun 2023 03:49:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BNrTiAMKXJ4YExC6EmcWUck6OlUEHLUWipLIAi3GTYrtqPe9Qj65u/6sV/5usTMv9Pus3 X-Received: by 2002:a5e:c111:0:b0:76c:71dc:55f3 with SMTP id v17-20020a5ec111000000b0076c71dc55f3mr7994919iol.6.1686134991239; Wed, 07 Jun 2023 03:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686134991; cv=none; d=google.com; s=arc-20160816; b=n5fbjgF8SChRaZGJdOMmU41kcu9rnETAE4mgMoxXe7cVaolJst3/CSoFFfyY9AWWHz lThASJkP2PTCB0Tb8CQoI1bh6jswHpQuc68ZiKCWKDOaYbSkoNDDQOCCKvLtNAcW+NgU Vz808Rcea7BI8QIlsTqYAB5V+wu+5+tr+avON7XJc+ho11iueMNYGnTFe8d2qqcrWRLM ss1rnRqiTODlZBn1j3D8g6E9+U7VLcZa2GRtLmwiwY+/tCZA2dqPZw2BMaG7pzBRHSiA nz3A8s4/dPgKYOeXGmCkrhOdicKyEqRCoYRo1KI39FhSl7IWb0xPok0YIoxRmoEt1p6d CBSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KT1pHsY4xKWN1h28aXBveVgGpwOSdlfC9QIiwvDz62w=; b=jSNghbN6aBRJFztlsvSOxUyXO6H/yd8ACzt801NAAaqHQQ2IqWRfPqGetLUxlGwUXF aPdhcoiA8sSMGq9rbQyFYaY2wV7V3KQ8oVwMmGos8Ye1upWMktrr2BTrB8xq4TiN/Tm/ BQv+iaUY6SEjs4nznJ8+/MFGJQ8v5AlrcoIqpxBaX03tFGHyBHGvZQr5uQUi02EuGM37 kbdydCiYZMq/e5szZ/61t3p0zIBlyg5vUAqPiaW1SKzDusEi+mvefptaS+UzyDHt6V5x KuEzs+gYpkR/FjLB4cmCZqE2J8O4UEbhS5uIrVP9AMxHYA2udYm+iPtdePoGq/py+QHK DQLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a632707000000b0053f34e19906si8507153pgn.882.2023.06.07.03.49.39; Wed, 07 Jun 2023 03:49:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239240AbjFGKp4 (ORCPT + 99 others); Wed, 7 Jun 2023 06:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239120AbjFGKpl (ORCPT ); Wed, 7 Jun 2023 06:45:41 -0400 Received: from mx1.zhaoxin.com (MX1.ZHAOXIN.COM [210.0.225.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86CB1BE3 for ; Wed, 7 Jun 2023 03:45:35 -0700 (PDT) X-ASG-Debug-ID: 1686134725-086e2331330ea30001-xx1T2L Received: from ZXSHMBX1.zhaoxin.com (ZXSHMBX1.zhaoxin.com [10.28.252.163]) by mx1.zhaoxin.com with ESMTP id uzZDneJ6fJW7g13y (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 07 Jun 2023 18:45:25 +0800 (CST) X-Barracuda-Envelope-From: TonyWWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX1.zhaoxin.com (10.28.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 7 Jun 2023 18:45:25 +0800 Received: from tony-HX002EA.zhaoxin.com (10.32.65.162) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 7 Jun 2023 18:45:23 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 From: Tony W Wang-oc X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.163 To: , , , , , , , , , , , , , CC: , , Subject: [PATCH 2/3] x86/mce: Set Zhaoxin CPUs MCE monarch_timeout correctly Date: Wed, 7 Jun 2023 18:45:26 +0800 X-ASG-Orig-Subj: [PATCH 2/3] x86/mce: Set Zhaoxin CPUs MCE monarch_timeout correctly Message-ID: <20230607104527.3298-2-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607104527.3298-1-TonyWWang-oc@zhaoxin.com> References: <20230607104527.3298-1-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.32.65.162] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Barracuda-Connect: ZXSHMBX1.zhaoxin.com[10.28.252.163] X-Barracuda-Start-Time: 1686134725 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.35:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 2225 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.109718 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because __mcheck_cpu_apply_quirks will setting monarch_timeout = 0 before to call the function mce_centaur_feature_init. So the if case below will not be executed: if (cfg->monarch_timeout < 0) cfg->monarch_timeout = USEC_PER_SEC; Move monarch_timeout setup for these Zhaoxin CPUs to the function __mcheck_cpu_apply_quirks to solve this problem. Signed-off-by: Tony W Wang-oc --- arch/x86/kernel/cpu/mce/core.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 6ae68749383c..f919fa3ab69d 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1909,6 +1909,18 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) } } + if (c->x86_vendor == X86_VENDOR_CENTAUR) { + /* + * All newer Centaur CPUs support MCE broadcasting. Enable + * synchronization with a one second timeout. + */ + if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) || + c->x86 > 6) { + if (cfg->monarch_timeout < 0) + cfg->monarch_timeout = USEC_PER_SEC; + } + } + if (cfg->monarch_timeout < 0) cfg->monarch_timeout = 0; if (cfg->bootlog != 0) @@ -1951,21 +1963,6 @@ static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c) } } -static void mce_centaur_feature_init(struct cpuinfo_x86 *c) -{ - struct mca_config *cfg = &mca_cfg; - - /* - * All newer Centaur CPUs support MCE broadcasting. Enable - * synchronization with a one second timeout. - */ - if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) || - c->x86 > 6) { - if (cfg->monarch_timeout < 0) - cfg->monarch_timeout = USEC_PER_SEC; - } -} - static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) { switch (c->x86_vendor) { @@ -1983,10 +1980,6 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) mce_hygon_feature_init(c); break; - case X86_VENDOR_CENTAUR: - mce_centaur_feature_init(c); - break; - case X86_VENDOR_ZHAOXIN: mce_zhaoxin_feature_init(); mce_adjust_timer = cmci_intel_adjust_timer; -- 2.17.1