Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp930568pxf; Thu, 25 Mar 2021 18:29:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRBsbn8tdyxPw2HSMiXZ7E8Pi8fgJuEMSSUyBf+DT32FBy/8zMBhB/HvVzWenElYTwDgsQ X-Received: by 2002:a17:906:5495:: with SMTP id r21mr12778354ejo.471.1616722146927; Thu, 25 Mar 2021 18:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616722146; cv=none; d=google.com; s=arc-20160816; b=vRVZB/2Ng3+Z4uvtOCI4QzqXl9lGfIx6lueodyc0EFSxxqgPsyLL087aU5rc2j8h0L iXFwRiZnFts2wO0tWmzOsXxENTKqc3LkK1Jq0jkA9cBsigs2FRWLL/LBM9YPYSPN+qBZ y07j9N0qnMj7+AL64iXsssw5wFWnes4vMiQdOb9hXbacm/UxLpn0P3DQ6ElGuuzn70AI UW8hnXkIF9oP47hk93vS00mxwjLy+Bo7ZRfNMtGPAlKJo3yz2QYpUCraY8XpHgtW6Kw0 nJdyVDwAflLJY5aARFtg60YCFQvJsC7fFE09i5+lHfmUyseq58GqCtl8bDYsEEwma3BN gGvg== 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=s3JKHbkT6bUkfWh0vbXNb8qeVmHpfk03yvg8WXuqCtk=; b=daLcAdPM36IwrYluk6JWQbwsAmmnWhxBDPNvlPRlpEhF/FZmTuxad2Kv9Dc7BM133S O0MEjRSoUVOSwTCiX5fJWP7FWVtqjPg1yWO25VVRnwJz56OGj60j7drFuBELeGUh9mzA n8copQiOvuuQIiGHJez0LHz1Cirh69BXMrMThgwhW6kxNJVRBi8GzGgld0e+NfdfXEBv R5qCaPgGRRXFgtzbz5t1/cCk8qxnujATwx4KNMXGGsn9OeOd5GPPT8vc6h2Gi1nb20Qj pC4TWt0jB2/KjuryjhU2zh+bPIRUcenygER49GYztlgHm8NfzPUHUlqhzj5QEYrPo8CI En6g== 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 j3si5466423eds.542.2021.03.25.18.28.44; Thu, 25 Mar 2021 18:29:06 -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 S230247AbhCZB1u (ORCPT + 99 others); Thu, 25 Mar 2021 21:27:50 -0400 Received: from mga12.intel.com ([192.55.52.136]:51734 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbhCZB1T (ORCPT ); Thu, 25 Mar 2021 21:27:19 -0400 IronPort-SDR: MWgopQEOg84Z4/gWpbLBIc+qLqvmUHMilG7zjfrwfQ/uUjFX0XyMZDVJJ8cshOV5YjCw/OVJ+Q G/DbBmkyLtmQ== X-IronPort-AV: E=McAfee;i="6000,8403,9934"; a="170421825" X-IronPort-AV: E=Sophos;i="5.81,278,1610438400"; d="scan'208";a="170421825" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2021 18:27:19 -0700 IronPort-SDR: tGfPw17DfxK/KvCvG5z5ctnHdeDgByfKf225MFrxgbsFl2T1AEV4obkoPBHxUCzKdAltFHyhgF VuTiGQI3xhEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,278,1610438400"; d="scan'208";a="443088994" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga002.fm.intel.com with ESMTP; 25 Mar 2021 18:27:16 -0700 From: Like Xu To: Peter Zijlstra , Namhyung Kim Cc: pbonzini@redhat.com, Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Kan Liang , wei.w.wang@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v5 3/5] perf/x86: Skip checking MSR for MSR 0x000 Date: Fri, 26 Mar 2021 09:19:16 +0800 Message-Id: <20210326011918.183685-4-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210326011918.183685-1-like.xu@linux.intel.com> References: <20210326011918.183685-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). When ARCH_LBR we don't set lbr_tos, the failure from the check_msr() against MSR 0x000 will make x86_pmu.lbr_nr = 0, 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 --- arch/x86/events/intel/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 382dd3994463..564c9851dd34 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4593,10 +4593,10 @@ static bool check_msr(unsigned long msr, u64 mask) u64 val_old, val_new, val_tmp; /* - * Disable the check for real HW, so we don't + * Disable the check for real HW or non-sense msr, so we don't * mess with potentionaly enabled registers: */ - if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) || !msr) return true; /* -- 2.29.2