Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3540864pxj; Mon, 24 May 2021 09:00:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8UU0tE2ARo2Ym2/Jvz2MV2vUS9//tOej2xkuS7gIG0fEBow+YOBd8rspsEwwUjqYZAn0r X-Received: by 2002:a17:906:b2c1:: with SMTP id cf1mr23397351ejb.544.1621872021143; Mon, 24 May 2021 09:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872021; cv=none; d=google.com; s=arc-20160816; b=QF3LKCReRikWNT4ksK7KvQxgbwaCPjR7ctF2zMXRSGLKUwVI2mEgA6goH2T5rxNkyl bSjhOWXg6jA7u2o2lxtPe+twZw270MRVT6tkxKwBpuTiAopl/4rogq/KpsVMiB9bE5X6 GfyjNsWGK2VzucxdlPIuPuXLdvuuBfVKldZNBJ3hU5K0VXHotajrjgFEXLnZA++YBeqa U9DQN4vEGiwhfItjzjXhNlpoSszZ83lMBpecaPjV/++HYhZr0CptslL54JMBB3Jl8wvN tvhoweJ76wYDoXxafShDEd8w/4FTJm+Sr8ps+RfxE6q2ERxMJmDlpDJ7ns8E97mCzFrj D1IQ== 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=3q5ZxKMyLwj5nS9RJIFyoQk7egH45pDY/02TZpjINL4=; b=c3lYLve9Qn+7pcVL2gMmULkHnrACQEtNhvwtMBseYYq8Vo970fSK8TkZg5QITgd5F4 HIQ2Zz5dHlIYb2a3elaCqeUx1Itse6g/sJrqz48EoGWh++9OhwbCKZ8m9+/96QpC9tD2 WVvpYNgNn5h5TYzgvpvNgZwAhCqmp6WMYV2/NUVOxHdBlKVNCv1fD9+0ZJ9HRv2vAFFC 38ASGUe7dJJbZC4ncOPS9/2Bwk9b+Sn93xZdaJAW4Nl7/6E8UQ8vx3vbEtNEzAGjzvUw TSx9SqgVhHpHQh2Kghxbjud1vVFLq1C/XYVrJ+74WRgh0NHTLVc/hZqzlA+OnyFJibyK 9oYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vK5v0A+4; 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 d15si10116325edu.375.2021.05.24.08.59.55; Mon, 24 May 2021 09:00:21 -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=vK5v0A+4; 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 S235677AbhEXP7G (ORCPT + 99 others); Mon, 24 May 2021 11:59:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:38642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233869AbhEXPyI (ORCPT ); Mon, 24 May 2021 11:54:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9174F61429; Mon, 24 May 2021 15:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870771; bh=QcAThLl9y4n7ZlTyjZ+RSrM8tVat9RflhWQWZlXzWOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vK5v0A+4dDTUnVIPIqhMzqhbX4NTgANFbDcZj79Ea4zu4BuyqM6KvXwIN01n37bIa byH0ofbSDpd9cNzQCbSp89ErQWqDtVzyDQmV+LZgl1CF08Jqpgx+UqI3qZ1u2gmV8q Si0vJHowB3k+yNI6YEXizxHWgbEtBqS4QTWeFbzw= 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.10 027/104] perf/x86: Avoid touching LBR_TOS MSR for Arch LBR Date: Mon, 24 May 2021 17:25:22 +0200 Message-Id: <20210524152333.716774390@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@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 0b9975200ae3..ee659b5faf71 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5563,7 +5563,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