2021-03-10 15:27:33

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] 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.

Cc: [email protected]
Fixes: 9b545c04abd4 ("perf/x86/kvm: Avoid unnecessary work ...")
Signed-off-by: Andi Kleen <[email protected]>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 5bac48d5c18e..d74deadd3a6d 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -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)
--
2.25.4


2021-03-10 15:38:37

by Jim Mattson

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/kvm: Fix inverted pebs_no_isolation check

On Wed, Mar 10, 2021 at 7:24 AM Andi Kleen <[email protected]> wrote:
>
> 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.