Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2896952pxj; Sun, 6 Jun 2021 18:36:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi9YptiKQOjO9F1rzLUJ/8PfaXFaIZisbsVNglIDHIQ6KVDnOz6wlDSZcJIEUMr0DWuq2N X-Received: by 2002:a17:906:5d14:: with SMTP id g20mr15231345ejt.243.1623029762698; Sun, 06 Jun 2021 18:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623029762; cv=none; d=google.com; s=arc-20160816; b=hadu7KBbMhiIEh5Qyd0Zc5XbGsahADL0pBGPJ9rxF9ND6uaNyIkq5hXFBtYcuTeR6H 6rWgn27sMkK4rEHnJFptL8cxcRw27kMh7iwElKaRJgY/XTqWNsiviva4WijePZnHBYGe DU3tqE3OrWNv7b9FYtXPvQ7PaFVHEJlwfrdct/k0Nj5NWIE/jKRjZ2EitjucSw3KN+yG v0o4Zy29rC10eapxz2Ig/crZP1GVpW5HgCn7L/7o2RVy5ABsV1uRDQ7U8p96tX/Ahzr8 kW5qsGMxSaei/UpZFHDIPBzZYAO/E0a8sSpEnmOcOIP3bwC2CSUFYpvpamkVFN+fWlgX mcFw== 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=pewWWGkwtoWaRpnqxiR5Bf7/1bdpb4mCHkLiNEqOTcc=; b=CPVjNtUfgx7FOL9Q/FFM1GXS1cmFSrddm/nCCEDZsP5P4bLTdvdxoj+Cc+s1fzje9O xTYgE3JFCNaC1hl3VYq7K6GC3ut2ZGpHFfD7pWH8EI7lrkCNORN85bMYsXSCw898ZHJa OpB0tuo0fBT96RrU5v/OUe/AP26fa9N7oHPRYVdLTb/jaY176ZUEUFKAIpbfNQNIGNfa R1ONAIEwHxw8Y6Bpyhd/d0EwXEA71fZ2Z2IkyMOvsIAZJxkE6pM/Z+IlNXHYCFO5cT71 ny7qS+HDmCh2f1yFGYP3jGpaD0ndVJcYXtqV4wRH9wCGrV4Ye0RyEyulLH43zojQHxBL Hofw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si10187667edr.251.2021.06.06.18.35.40; Sun, 06 Jun 2021 18:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbhFGBdl (ORCPT + 99 others); Sun, 6 Jun 2021 21:33:41 -0400 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:45844 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbhFGBdk (ORCPT ); Sun, 6 Jun 2021 21:33:40 -0400 Received: from zxbjmbx2.zhaoxin.com (10.29.252.164) 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.2176.14; Mon, 7 Jun 2021 09:31:41 +0800 Received: from zx.zhaoxin.com (10.28.64.91) by zxbjmbx2.zhaoxin.com (10.29.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 7 Jun 2021 09:31:40 +0800 From: Cody Yao-oc To: , , , , , , , , , , CC: , , , CodyYao-oc Subject: [PATCH] x86/perf: Fixed kernel panic during boot on Nano processor. Date: Mon, 7 Jun 2021 09:31:09 +0800 Message-ID: <20210607013109.7870-1-CodyYao-oc@zhaoxin.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.28.64.91] X-ClientProxiedBy: ZXSHCAS1.zhaoxin.com (10.28.252.161) To zxbjmbx2.zhaoxin.com (10.29.252.164) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: CodyYao-oc Nano processor may not fully support rdpmc instruction, it works well for reading general pmc counter, but will lead to GP(general protection) when accessing fixed pmc counter. Futhermore, family/model 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: CodyYao-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; -- 2.17.1