Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3189822pxf; Sun, 21 Mar 2021 23:15:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBDVAOaZplrob4ML0tZYKFW3dChDqlG9Oxv92+BCrhb6ulmwjkLZqnzAnmxG6wOW5WSSFP X-Received: by 2002:a17:906:3f87:: with SMTP id b7mr17587712ejj.139.1616393751375; Sun, 21 Mar 2021 23:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616393751; cv=none; d=google.com; s=arc-20160816; b=mjvFV0id+fhCMNr8WBXPaYzFmQc9jX7V12FuSmhlq5p0FJkcbaBj7mHpIiO9WMwG5H y8lzoxYTOBmu0VjIfqf3QBEEGlYYWy3Mi1vUyR1yPqOjGQDdt++s0mj+z5VqcOHpJVun ESQcY7RQpXWEgyYqJD0B/wB6d9bX21VswDhWmMzFBsqbBqdNF+9pT4sd3ZAcYhrcoQSs CrsJfx8DxzTANcTNpJcoWN8cu78z1RCfPaeBadLiM50uwNzMLszbhMRhkK4DR7M8Kd6r erII8T6omkIOL3guyHUvq98cgblS9aMJGNeeZ4z4SRiM3UWd5mScz36JyglDNXxBfJkO mN7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=0gpqWk34l+kFzUyFnqVE+NNKwflOdqeJGpZegI1Tun4=; b=FSXuUhWkaRjMetWzHqqx4+tG2rMCs/n5Ilf6KeIrPg/LhUN8bdW7lJr13LwaNaUPFo LnI5mwXqR5LIOc5h4AEYDrpHHpqUW5vXv02PeUMk9aUoMOrstN/x7yZtI8BU6b3K8PLW qsHsnnjZnvbLWSd+Wy+O/A8JXlN8mda5aYOva8ok8th8PELde3Hu+l5C2vEGdozQmvxO ghM0YO1DtmRRybNilJ3JX/kdcGM2M8aBVK97xeExOeOxFNKBbzmtrW6v7F34gFE+RfXw usziUlZTFzpIz87arG5u1kQCtxk8y30lCfSBlTSa7Py1U0k7i5Gpix2pKdKqLxz8BBQP goUQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si10535451edu.114.2021.03.21.23.15.29; Sun, 21 Mar 2021 23:15:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbhCVGOv (ORCPT + 99 others); Mon, 22 Mar 2021 02:14:51 -0400 Received: from mga11.intel.com ([192.55.52.93]:15223 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbhCVGO0 (ORCPT ); Mon, 22 Mar 2021 02:14:26 -0400 IronPort-SDR: HHXhyrEOHxBsASsnAHrJHVBCXlrsfBCIbhxeS2OWqJ6/XPreOWgqQ+beqejIEA6X6YCiQ8e0LH 9iov77i4agRA== X-IronPort-AV: E=McAfee;i="6000,8403,9930"; a="186889264" X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="186889264" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2021 23:14:26 -0700 IronPort-SDR: 0t9CtwKeqTZXjmRs7QFrHB6KVny460Wz72wcGJqwHtouuQsih7m1w2BP+Z88gOUBOXnnpnfiEh C/wwDqD1twOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,268,1610438400"; d="scan'208";a="441026295" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga002.fm.intel.com with ESMTP; 21 Mar 2021 23:14:22 -0700 From: Like Xu To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , Kan Liang , x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu , Andi Kleen Subject: [PATCH v4 RESEND 4/5] perf/x86/lbr: Skip checking for the existence of LBR_TOS for Arch LBR Date: Mon, 22 Mar 2021 14:06:34 +0800 Message-Id: <20210322060635.821531-5-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210322060635.821531-1-like.xu@linux.intel.com> References: <20210322060635.821531-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Architecture LBR does not have MSR_LBR_TOS (0x000001c9). KVM will generate #GP for this MSR access, thereby preventing the initialization of the guest LBR. Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR") Signed-off-by: Like Xu Reviewed-by: Kan Liang Reviewed-by: Andi Kleen --- arch/x86/events/intel/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 382dd3994463..7f6d748421f2 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5740,7 +5740,8 @@ __init int intel_pmu_init(void) * Check all LBR MSR here. * Disable LBR access if any LBR MSRs can not be accessed. */ - if (x86_pmu.lbr_nr && !check_msr(x86_pmu.lbr_tos, 0x3UL)) + if (x86_pmu.lbr_nr && !boot_cpu_has(X86_FEATURE_ARCH_LBR) && + !check_msr(x86_pmu.lbr_tos, 0x3UL)) x86_pmu.lbr_nr = 0; for (i = 0; i < x86_pmu.lbr_nr; i++) { if (!(check_msr(x86_pmu.lbr_from + i, 0xffffUL) && -- 2.29.2