Skip to contentSkip to conversation

perf/x86/kvm: Fix inverted pebs_no_isolation check

PATCH In review Andi Kleen 2 participants 2 messages Mar 10, 2021

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf/x86/kvm: Fix inverted pebs_no_isolation check

The pebs_no_isolation optimization check is inverted. We want to disable PEBS isolation when the microcode is at least the revision in the table, not for older microcode. So remove the extra !.

It meant that the new microcodes did unnecessary work, and the old microcodes could crash the PEBS. Presumably most people already running with newer microcodes, so that functional impact is small. But it should speed up the newer systems by the 2-4% claimed in the original patch.

Fixes 9b545c04abd4 ("perf/x86/kvm: Avoid unnecessary work ...")
---
 arch/x86/events/intel/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/core.c +1 -1
index 5bac48d5c18e..d74deadd3a6d 100644
@@ -4532,7 +4532,7 @@ static const struct x86_cpu_desc isolation_ucodes[] = {
 
 static void intel_check_pebs_isolation(void)
 {
-	x86_pmu.pebs_no_isolation = !x86_cpu_has_min_microcode_rev(isolation_ucodes);
+	x86_pmu.pebs_no_isolation = x86_cpu_has_min_microcode_rev(isolation_ucodes);
 }
 
 static __init void intel_pebs_isolation_quirk(void)
Signature · 1 line
2.25.4
#1 lore raw
Quoted 4 lines · Andi Kleen

The pebs_no_isolation optimization check is inverted. We want to disable PEBS isolation when the microcode is at least the revision in the table, not for older microcode. So remove the extra !.

The original code was correct because of the double negative. A "good" CPU _has_ PEBS isolation. It's bad to have pebs_no_isolation.