Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1090089pxb; Thu, 4 Mar 2021 03:03:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrMkCqtCrl0LtfYn2ldNKGjK4j8Dht5MpD67+uo+H4Ly9NKunlSdEt4OvY3X3wIWBhlyaG X-Received: by 2002:aa7:c386:: with SMTP id k6mr3621577edq.224.1614855789338; Thu, 04 Mar 2021 03:03:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614855789; cv=none; d=google.com; s=arc-20160816; b=Wy0uvg3ggRm0b3ai0u52exWfmnrXUTjym+oNpoqTLlm8hs/JvT/oPQEEfO7IIBBqbn o5JI2+LnsCe+sV1+JrG4elm2D45ASevstz1bF4Y8ni8dH4xkVFQOffgJPp10jNUwzM5y vAW+Q2EyRIJcTjuJZ+Us2R+clDpzqrJB05Y6f5Zzgiv6/QAuCgtuN2M/H4SrNcPcFisA A3FB6wQgCMb7hPZhaapVea1TBoSSdikmSkJQ9eflQuaWRTjYFOMpMNv5N3uGLZOuBxFF 5/5/XtE5lfpqqHlQ8yVgyJMmw3Hx8zpRiu4FpKHeip/RN59LFq75HvrhIzfxzZ6GiqGV Iztw== 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=E6e3w7plEot57+V7ZsfQMcQ1+gYOyMALA0C2NeIeDy4=; b=PVCku5Ncx7W+X3fIvElaMQg+RvbuSiJ60fdkW0CKSXkKb/Hpo7aHS6NhpEq4l2WvVh 5izbZAgyxYvnPfBObonfOOTF3UJzb2RVhyoW67bJJJrlMkezELLJFGfgzIjM6iZImS6+ uUqi7RJQxtCzyzdMjehd1QYVUHAo/eEmBKbc4uXM+So7t9nPri85rabCeUi/X/7OVKya I6VFV8LZ3YkR+WUMr4fmQNzWev3+SdQ2OPonY5NvRJy5xp5iUfk5UFCcIbRfmqxoeyUr hzu8E7pLNhYVe1x4FGs7lSx9jPfJpcBLdvs/oAiEhZXpLOACqzOQDSo3E0Sfrk3Od+j/ /ZTg== 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 z4si2473621edc.579.2021.03.04.03.02.39; Thu, 04 Mar 2021 03:03:09 -0800 (PST) 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 S1575115AbhCCRee (ORCPT + 99 others); Wed, 3 Mar 2021 12:34:34 -0500 Received: from mga11.intel.com ([192.55.52.93]:43939 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244164AbhCCOKT (ORCPT ); Wed, 3 Mar 2021 09:10:19 -0500 IronPort-SDR: FMpvI/HO+ZW8Mvy8Ypt9GiNVF2BlKaakHM+ptbV0Nh/7bCp6YrlhnzQYIQG5q2sGMycGSBnUwF iIKF2Z6G3/HQ== X-IronPort-AV: E=McAfee;i="6000,8403,9911"; a="183818883" X-IronPort-AV: E=Sophos;i="5.81,220,1610438400"; d="scan'208";a="183818883" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 06:05:22 -0800 IronPort-SDR: c3U1uZ/u3AMh7CmlxC1zrPjgsEB79U9XtYBjIFWWSxbXtQ4J7hjj1E2b9jvTnm454ZDgyrAwS6 Q7sicnQBs4TQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,220,1610438400"; d="scan'208";a="399729358" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga008.fm.intel.com with ESMTP; 03 Mar 2021 06:05:18 -0800 From: Like Xu To: Peter Zijlstra , Paolo Bonzini , Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Kan Liang , Dave Hansen , wei.w.wang@intel.com, Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v3 3/9] perf/x86/lbr: Skip checking for the existence of LBR_TOS for Arch LBR Date: Wed, 3 Mar 2021 21:57:49 +0800 Message-Id: <20210303135756.1546253-4-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210303135756.1546253-1-like.xu@linux.intel.com> References: <20210303135756.1546253-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. Cc: Peter Zijlstra Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR") Signed-off-by: Like Xu Reviewed-by: Kan Liang --- 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 a32acc7733a7..3cf065185fb0 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5569,7 +5569,8 @@ __init int intel_pmu_init(void) * Check all LBT 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