Skip to content

Commit

Permalink
x86/perf: Avoid warning for Arch LBR without XSAVE
Browse files Browse the repository at this point in the history
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 <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211215204029.150686-1-ak@linux.intel.com
  • Loading branch information
Andi Kleen authored and Peter Zijlstra committed Jan 18, 2022
1 parent 5a4487f commit 8c16dc0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/events/intel/lbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8c16dc0

Please sign in to comment.