From patchwork Thu Nov 3 03:23:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: silviazhao X-Patchwork-Id: 14618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp299618wru; Wed, 2 Nov 2022 20:48:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KMDoC0QJa4xS/dQw5yDbqqP4pYzXxFQKRUQFOOLREM93ETGNAdK7tTeGmMNkvOCDJ5Z3y X-Received: by 2002:aa7:cad5:0:b0:454:88dc:2c22 with SMTP id l21-20020aa7cad5000000b0045488dc2c22mr27923508edt.352.1667447324377; Wed, 02 Nov 2022 20:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667447324; cv=none; d=google.com; s=arc-20160816; b=FetBXF4sgimPSQIHo6ZPWa14j/X1IFfM/FCAeUhVzqd9OuKuTGwIMd9FafHpXEAkwE CxLY6lLElNjOmsGBDbEp9G2e2ans1btWebpl+pGprIrWWHJCvLzLBJpdmSPJrVfKoF7H AJ0yWfnxB22TvvJIYmhpg3JLow/QAbKp2E3VEh9Jq3yZyz9et9Cor1+8Bw5gYvSzXDfk /gkopG2iWVX4rBzxHlD34x9tbncQMuTvmS3OXRY0iYLRd+WBfI/aRy13CF522jhRvuDo N7Dog+oXIzZ3WXK5MC/011OzimMnsHmmrrn3D1YXkglNQ16F/g6y68+2c2ZGvtLnPwoC QhwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=kCYgtZmWcnloUpc5T57To0NmPGRmL3pUJ5xfvZD3Qvg=; b=VPJBJ/9s3FpuSK1rNGvkjwB3pMS3vG5zy+ytcdsYw4yaJ2U+dcBdvwGrfD1gXWDWaM +CAMcqTcQAdwG2wr1qNQsaQmO+JJ4efEWnz42UX7WecsgfUDBq42dl7WPDjdPZjxXyMP JGN2Lw0VIcbpjZ4eqelcpz2iPAPZeanBwBC0oONhWhoiVS18J87MRJV3iwI14wycWiN4 ghWfCGxkUURq2cp0rlvGPVC2JcdxIhCKrQR70IfDZlx54LnaW7TtXSxwQ4SE0WrMzOrH ajeE9M35qkfx7IxYsr4Sm53ztsfGvbXEHGEDCpGT5qRPThUI7uJFg7fgZgbAs2p99B5D pL4A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a056402518b00b004630d0c280esi17080359edd.539.2022.11.02.20.48.20; Wed, 02 Nov 2022 20:48:44 -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 S230202AbiKCDkW (ORCPT + 99 others); Wed, 2 Nov 2022 23:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbiKCDkS (ORCPT ); Wed, 2 Nov 2022 23:40:18 -0400 X-Greylist: delayed 1026 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 02 Nov 2022 20:40:16 PDT Received: from mx1.zhaoxin.com (MX1.ZHAOXIN.COM [210.0.225.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F681580B for ; Wed, 2 Nov 2022 20:40:15 -0700 (PDT) X-ASG-Debug-ID: 1667445785-086e235325630c0001-xx1T2L Received: from ZXSHMBX2.zhaoxin.com (ZXSHMBX2.zhaoxin.com [10.28.252.164]) by mx1.zhaoxin.com with ESMTP id 4H8CKghlSEVnENGS (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 03 Nov 2022 11:23:05 +0800 (CST) X-Barracuda-Envelope-From: SilviaZhao-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from ZXBJMBX02.zhaoxin.com (10.29.252.6) by ZXSHMBX2.zhaoxin.com (10.28.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 3 Nov 2022 11:23:05 +0800 Received: from silvia-OptiPlex-3010.zhaoxin.com (10.29.8.47) by ZXBJMBX02.zhaoxin.com (10.29.252.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 3 Nov 2022 11:23:04 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 From: silviazhao-oc X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.6 To: , , , , , , , , , , , , , CC: , , Subject: [PATCH] x86/perf: Fixed kernel panic during boot on Nano processor. Date: Thu, 3 Nov 2022 11:23:04 +0800 X-ASG-Orig-Subj: [PATCH] x86/perf: Fixed kernel panic during boot on Nano processor. Message-ID: <20221103032304.27753-1-silviazhao-oc@zhaoxin.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.29.8.47] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX02.zhaoxin.com (10.29.252.6) X-Barracuda-Connect: ZXSHMBX2.zhaoxin.com[10.28.252.164] X-Barracuda-Start-Time: 1667445785 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: 1332 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0007 1.0000 -2.0164 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.101869 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 autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748445245391219463?= X-GMAIL-MSGID: =?utf-8?q?1748445245391219463?= Nano processor may not fully support rdpmc instruction, it works well for reading general pmc counter, but will lead GP(general protection) when accessing fixed pmc counter. Furthermore, family/mode information is same between Nano processor and ZX-C processor, it leads to zhaoxin pmu driver is wrongly loaded for Nano processor, which resulting boot kernal fail. To solve this problem, stepping information will be checked to distinguish between Nano processor and ZX-C processor. [https://bugzilla.kernel.org/show_bug.cgi?id=212389] Reported-by: Arjan <8vvbbqzo567a@nospam.xutrox.com> Signed-off-by: silviazhao-oc --- arch/x86/events/zhaoxin/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/zhaoxin/core.c b/arch/x86/events/zhaoxin/core.c index 949d845c922b..cef1de251613 100644 --- a/arch/x86/events/zhaoxin/core.c +++ b/arch/x86/events/zhaoxin/core.c @@ -541,7 +541,8 @@ __init int zhaoxin_pmu_init(void) switch (boot_cpu_data.x86) { case 0x06: - if (boot_cpu_data.x86_model == 0x0f || boot_cpu_data.x86_model == 0x19) { + if ((boot_cpu_data.x86_model == 0x0f && boot_cpu_data.x86_stepping >= 0x0e) || + boot_cpu_data.x86_model == 0x19) { x86_pmu.max_period = x86_pmu.cntval_mask >> 1;