Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3546943pxj; Mon, 24 May 2021 09:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM9z9Wlhn26rRHOuK8j725byMZSmIThIqPdS3QlLoIZZhnFpdPa4ddYIn+9RK+qo4glcPb X-Received: by 2002:a05:6e02:caf:: with SMTP id 15mr16074079ilg.3.1621872386458; Mon, 24 May 2021 09:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872386; cv=none; d=google.com; s=arc-20160816; b=HVoaCuILSvyRQAR7kMfetjduR09b/ZhxoVUYHCzSUTBkVoZqppVu8JuiU0ShqbKfF0 i6uPses/ln2A13qZNm2vfq1J8txudJB03KcCZAyB7/xBQJk0RUDEL0aUYmv2SZFUPh30 EAZUZRguggmtluhGuYAkncXwn6FTaXMmmycErsw6xelWhO34Xf4xaGvRbkJW15OsA9EX Aexe25qwajCcLL9PrqgKzqPTf9+cAoWlhVaJZzckqqSoUDgtU+BCrF0UDRkVtpKoUK79 SCBelnXT7MKD95DGfrXYvOROlvUigNUOrIaPfo1Da1sYxW0XeK76ZJI6LK+Sl09KaRmj d/sA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3WlSBC/vwn8E8jZCDttuvGYTL7B0CNJLcGxkpZ/1mgI=; b=Wlztg9sHFDPQd/sNjMaXthqiqrjz6Ucc+rfIMETYWIB4bCoDf6c3mM0EP6fAwInJTu LNv4CLElaC78CWT3+MPsn9UebT6dI9Vi6wKAdAYu5z9b5wrnNpmSHUKYvJt+1qfM2lWb iMjsXe26pO3lBBgDmqQ4Pp4kUlEr9rR7269XoU2Ty2RXsdNJicFRBD0LZFxURwcyoMnt MOEKhKlFKLZdmECxOYA5VZwGAw0rR6+dxrsPS0potGLyOR2ayqLRiVvNkb7iALLSZUP1 wFTzknApWPBuyA23QMgNWmoJByTgjE898Czfja8mwW7lPLGjAj78Gs/g0lQCWlyZqms0 SMnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N2Jh21tf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si13671958iov.17.2021.05.24.09.06.06; Mon, 24 May 2021 09:06:26 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N2Jh21tf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236239AbhEXQEF (ORCPT + 99 others); Mon, 24 May 2021 12:04:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbhEXP5M (ORCPT ); Mon, 24 May 2021 11:57:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A3BF61950; Mon, 24 May 2021 15:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871009; bh=8MmAe9ioIJXYEC9+vWdC7mJvZaHue8oIlnJ3m1cRlx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2Jh21tfZArMCgNAto3rVEJJ7Uc1LfRnhl/WnPZ5PITtZtHoJ8nK+JdAz2O/bjIfo EnfJqwLKE2xO1nT4B1PSFd1VkwEDTeiAJX/h2Ufs+AZ52r+07dIozJ+RAASMAao0Vg UUOjPBdgRuuDVFzu4Zmm2x6jJ5yijFc8pNgmonnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Like Xu , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.12 031/127] perf/x86: Avoid touching LBR_TOS MSR for Arch LBR Date: Mon, 24 May 2021 17:25:48 +0200 Message-Id: <20210524152335.894137968@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Like Xu [ Upstream commit 3317c26a4b413b41364f2c4b83c778c6aba1576d ] 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 [peterz: simpler still] Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20210430052247.3079672-1-like.xu@linux.intel.com Signed-off-by: Sasha Levin --- 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 c57ec8e27907..4c18e7fb58f5 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5741,7 +5741,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.30.2