Skip to contentSkip to conversation

x86/perf: Avoid warning for Arch LBR without XSAVE

PATCH Applied Andi Kleen 2 participants 2 messages Dec 15, 2021 – Jan 18, 2022

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 x86/perf: Avoid warning for Arch LBR without XSAVE

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.

---
 arch/x86/events/intel/lbr.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/events/intel/lbr.c +2 -0
index 8043213b75a5..1b8fef8545fb 100644
@@ -1726,6 +1726,8 @@ 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;
 
Signature · 1 line
2.33.1
merge bot Applied
#1 lore raw
The following commit has been merged into the perf/urgent branch of tip:

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     8c16dc047b5dd8f7b3bf4584fa75733ea0dde7dc
Gitweb:        https://git.kernel.org/tip/8c16dc047b5dd8f7b3bf4584fa75733ea0dde7dc
Author:        Andi Kleen <[email protected]>
AuthorDate:    Wed, 15 Dec 2021 12:40:29 -08:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Tue, 18 Jan 2022 12:09:49 +01:00

x86/perf: Avoid warning for Arch LBR without XSAVE

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.

---
 arch/x86/events/intel/lbr.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/events/intel/lbr.c +3 -0
index f8fd255..669c2be 100644
@@ -1751,6 +1751,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;