Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1678367pxj; Wed, 19 May 2021 11:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGdtNXNsS+0d7FkmxvWM6ci5JNV8LIWvYpGofHeV28HrJsTNxQUyOPvHJ8GWg+88M8QsEj X-Received: by 2002:a92:db0e:: with SMTP id b14mr255750iln.171.1621448158577; Wed, 19 May 2021 11:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621448158; cv=none; d=google.com; s=arc-20160816; b=ZmLgzdOXPIqI0rDJKiw+0DwWSv3UygfQjCMseudZs7wbh7GjPxKSEG5GOShlLA6OwF vY4dCiMKaFkkG2fumNkD7+hcU4XMD9P9zoeUFDI9KUdcXNNSC1+j+3d97JqHZXuApWiR obrctmnj5mRoVeMvEQa5jW8UQ8ZmnGZvVZvVijhXbfEHfQfswdRR3p8tz/KQA73V28aS v5xUafzGJF5RAXyTsYx7KznXjXXG7J83LKpL5jLv4TO2hZ1isdfTHG7EcETPYM3ZEoTe b92fQVtiCNh+40h2afEnM0rxoskVHHbE2/yap+QxZ9XXY9faNblLqogXPHFxYsGberAQ MGSA== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=20ei4RVMpDY6brVZB1bRyaXlGttyu3OMTw2u3yagRqs=; b=JcHnUTy2zWolz6H3cwzzwrMAslqcv7hmYsQwEUJQlYd8CHHfjwxUpdF/jL3TtFCqCe pgJr4+eSAsojo5GX7qnQBj7uPdnN5nDgLEcA0q+TndfnXs/OtXZa2PquqyiBuRm7M1Jq zL9CqNEJGhh5/k2cQS9uN8V7fiVy/ndhn8xF1+ikw+v3hN1RJI34DY/8m13OdDxnNTPM 1xJsKC5IuXX0l3x3Z9jsyey4kxAVBpPOIbxTQYSC82CfdEJd/HLY3997l3v3h2SmTAE6 9C8wAOYPVFyG1SW9Af4nwYBNAGF7GTD2uNXCY/WHh2yF16KkG+YvWiMyh+KMV6eexTsV 1Y/Q== 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 i17si4832345iog.70.2021.05.19.11.15.44; Wed, 19 May 2021 11:15:58 -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 S231249AbhERO2X (ORCPT + 99 others); Tue, 18 May 2021 10:28:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:5998 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbhERO2X (ORCPT ); Tue, 18 May 2021 10:28:23 -0400 IronPort-SDR: gEd1fJsuXUBuXMz+KEUuKoQLudXm0SOsBmP56sCPGWG3NTRJ/PC3LvqEuEwgA1P2awL4GpaJGi rf2dWnTl6j9Q== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="221776741" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="221776741" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 07:27:04 -0700 IronPort-SDR: nvYy8cUBMtkdKxFc1dNdWGvE0e9nYapYZKo7mUpXFukhrFYKyNrzwWbWjO2e28uZTkjv9Jieyl LteE3oZkyspw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="472978466" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga001.jf.intel.com with ESMTP; 18 May 2021 07:27:01 -0700 From: Like Xu To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v3 1/2] perf/x86: Skip checking x86_pmu.lbr_tos if it doesn't exist Date: Tue, 18 May 2021 22:26:11 +0800 Message-Id: <20210518142612.200111-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.31.1 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). In a guest that should support Architecture LBR, check_msr() will be a non-related check for the architecture MSR 0x0 (IA32_P5_MC_ADDR) that is also not supported by KVM. The failure will cause x86_pmu.lbr_nr = 0, thereby preventing the initialization of the guest Arch LBR. Fix it by avoiding this extraneous check in intel_pmu_init() for Arch LBR. Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR") Signed-off-by: Like Xu --- v2->v3 Changelog: - Make it simpler. arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 2521d03de5e0..e28892270c58 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -6253,7 +6253,7 @@ __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_tos && !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.31.1