]> Git Repo - J-linux.git/commitdiff
perf/x86/amd/lbr: Discard erroneous branch entries
authorSandipan Das <[email protected]>
Mon, 29 Jan 2024 11:06:25 +0000 (16:36 +0530)
committerIngo Molnar <[email protected]>
Wed, 13 Mar 2024 10:01:30 +0000 (11:01 +0100)
The Revision Guide for AMD Family 19h Model 10-1Fh processors declares
Erratum 1452 which states that non-branch entries may erroneously be
recorded in the Last Branch Record (LBR) stack with the valid and
spec bits set.

Such entries can be recognized by inspecting bit 61 of the corresponding
LastBranchStackToIp register. This bit is currently reserved but if found
to be set, the associated branch entry should be discarded.

Signed-off-by: Sandipan Das <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://bugzilla.kernel.org/attachment.cgi?id=305518
Link: https://lore.kernel.org/r/3ad2aa305f7396d41a40e3f054f740d464b16b7f.1706526029.git.sandipan.das@amd.com
arch/x86/events/amd/lbr.c

index eb31f850841a89ae68cebe41707eccec0a965a8a..4a1e600314d5df124403636915a0f5fcf64ec475 100644 (file)
@@ -173,9 +173,11 @@ void amd_pmu_lbr_read(void)
 
                /*
                 * Check if a branch has been logged; if valid = 0, spec = 0
-                * then no branch was recorded
+                * then no branch was recorded; if reserved = 1 then an
+                * erroneous branch was recorded (see Erratum 1452)
                 */
-               if (!entry.to.split.valid && !entry.to.split.spec)
+               if ((!entry.to.split.valid && !entry.to.split.spec) ||
+                   entry.to.split.reserved)
                        continue;
 
                perf_clear_branch_entry_bitfields(br + out);
This page took 0.051534 seconds and 4 git commands to generate.