Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp34151pxy; Tue, 20 Apr 2021 19:36:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWLYzV1Qr8VxHNzrUUUJYF12lno5I3S9gSPstaCFovkfPmfM/8zc2Nl0a5KrvQhGTM+/hu X-Received: by 2002:aa7:908c:0:b029:209:aacd:d8b with SMTP id i12-20020aa7908c0000b0290209aacd0d8bmr27804441pfa.74.1618972600634; Tue, 20 Apr 2021 19:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618972600; cv=none; d=google.com; s=arc-20160816; b=bSPJjjPPuSI8MAQ+3lKvp0ojbSicHVkfftagUI+dqA7v41RdgEM+1N3bEag6xnqfBE PL85X2YDS8ar0J9iHB7cGy2rDw2aN8z83/eJl8wV1amZ5dfrzzUbnswLgK5iGFtBlB3u 77r9ED7eTJYz8/agVQ4NZWGtoazve+K35dWJ/G90FHHuMsg9AqPAKIwwQKKvt4l2haaD bIWcmjwYPsd+QtEI1va1gWk3bX8zKEVvbG+S+dbMNLdBN4GSmHLG8nt1tWDYe3vvoc0D ncRE6Pg32Kg6EndqLMA2xBvmTb2KzEssS6iKNdgTsDWgq4XkmSogdVQKs2DoPReX7vu6 iKLg== 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=pEwQ5lKFjCBw/qSRx2mDi4EdBsht5uX5hvZznYptxBU=; b=aNswYmyDhnbRwuUsaLSbldam16cj6/LvUYxX8CS1TzsLotCsEapM3sFzjI4AT9bv2u l5/IHyKNV0flRoLzMscQ769sW9Fi7qku3HPtypkXbs7ikkzZDo2vsGUZw0GYoyj3oa4A NHF6EhD290mWBJJn1MklgRLN3AproV/q8+NKzwaxG0zNVKETfL9Dgl/uDDYvQD0bOQ3g JpBf7kTAjdEH2znjWayeS+BixRsSVQI/hU3z2i3oD7aQTUqfgJb7UCDiMLVzE1vaWkj/ 1cJtVxCx+3m88etzaRalNhuX0Kesus7sH8gITS3rSbW4ZDSer658SpeGdfJsGLoQL95q cFIg== 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 d15si999032pgv.130.2021.04.20.19.36.28; Tue, 20 Apr 2021 19:36:40 -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 S234493AbhDUCTR (ORCPT + 99 others); Tue, 20 Apr 2021 22:19:17 -0400 Received: from mga17.intel.com ([192.55.52.151]:44095 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbhDUCTO (ORCPT ); Tue, 20 Apr 2021 22:19:14 -0400 IronPort-SDR: dFRlfaSKqsScH3AsAfWOL2AUz5QGp/kAOy8Y0qwVAe1JT++xz1J1kprLLSvZKzqTw53aaO084R 4BjhVlrgNiaA== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="175733826" X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="175733826" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 19:18:42 -0700 IronPort-SDR: b6JAxodUtWAtA4sxJpKAE1huCQwBxjwz9Xwa5O7eUNXGHlMZraaNw7i37Qu4vBf0ikARRp4ksy VpQuWDmz1Ujw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="384309780" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2021 19:18:39 -0700 From: Like Xu To: Peter Zijlstra , Kan Liang Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH RESEND 1/2] perf/x86: Skip checking MSR for MSR 0x0 Date: Wed, 21 Apr 2021 10:18:24 +0800 Message-Id: <20210421021825.37872-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.30.2 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 5272f349dca2..5036496caa60 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4751,10 +4751,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.30.2