From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07DF1C4167B for ; Thu, 3 Feb 2022 20:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355215AbiBCUfG (ORCPT ); Thu, 3 Feb 2022 15:35:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354215AbiBCUdo (ORCPT ); Thu, 3 Feb 2022 15:33:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 688ECC0617B1; Thu, 3 Feb 2022 12:33:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0950961AD2; Thu, 3 Feb 2022 20:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F269C340F0; Thu, 3 Feb 2022 20:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643920392; bh=mJFAQ4XWlIEWfk9/Ehgip/K6Kmf/6NuP5AUZM7Gisx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhqD+p5ugt1IbZQJPRmqpVeahHQC2ddaIkT+Xqq6/oDjOktrQ7FIC4EF9Tj6VIpRH 3MeMXn/f0LjZ4rIgvMmjNs94ZFfSWYpKJkGx+5UKO6OmoB22nGD1ckaAiiWLk9h4qO AfpNJ0PbuAQRgnmzTM/k2iUQ+dERidr0XIqZtoaQDiUAOBvTf0jTsClWEimvGvdROF F7qgJtwnibi/VJ6jqlnaAKJ2RyO42J3doCnq1FuZU0szy/4RSSjbwJR4PD2R5NEzmJ iFTsE7zc0Xx9dhEOGaKDhtZSPL2eX8M7Kmh7mjIgqhypjzgBfITsMpl6eWk0wKCcvC 8d/TF2eW4u9Tw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Sasha Levin , mingo@redhat.com, acme@kernel.org, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 16/41] x86/perf: Avoid warning for Arch LBR without XSAVE Date: Thu, 3 Feb 2022 15:32:20 -0500 Message-Id: <20220203203245.3007-16-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220203203245.3007-1-sashal@kernel.org> References: <20220203203245.3007-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org From: Andi Kleen [ Upstream commit 8c16dc047b5dd8f7b3bf4584fa75733ea0dde7dc ] Some hypervisors support Arch LBR, but without the LBR XSAVE support. The current Arch LBR init code prints a warning when the xsave size (0) is unexpected. Avoid printing the warning for the "no LBR XSAVE" case. Signed-off-by: Andi Kleen Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211215204029.150686-1-ak@linux.intel.com Signed-off-by: Sasha Levin --- arch/x86/events/intel/lbr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 9e6d6eaeb4cb6..f455dd93f9219 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1734,6 +1734,9 @@ static bool is_arch_lbr_xsave_available(void) * Check the LBR state with the corresponding software structure. * Disable LBR XSAVES support if the size doesn't match. */ + if (xfeature_size(XFEATURE_LBR) == 0) + return false; + if (WARN_ON(xfeature_size(XFEATURE_LBR) != get_lbr_state_size())) return false; -- 2.34.1