diff options
author | Kim Phillips <kim.phillips@amd.com> | 2019-10-23 11:09:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-10-28 06:02:00 -0400 |
commit | e431e79b60603079d269e0c2a5177943b95fa4b6 (patch) | |
tree | f20798d42f63937bc01a5d21c4843bf1b6a02070 /arch/x86 | |
parent | 317b96bb14303c7998dbcd5bc606bd8038fdd4b4 (diff) |
perf/x86/amd/ibs: Handle erratum #420 only on the affected CPU family (10h)
This saves us writing the IBS control MSR twice when disabling the
event.
I searched revision guides for all families since 10h, and did not
find occurrence of erratum #420, nor anything remotely similar:
so we isolate the secondary MSR write to family 10h only.
Also unconditionally update the count mask for IBS Op implementations
that have read & writeable current count (CurCnt) fields in addition
to the MaxCnt field. These bits were reserved on prior
implementations, and therefore shouldn't have negative impact.
Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: c9574fe0bdb9 ("perf/x86-ibs: Implement workaround for IBS erratum #420")
Link: https://lkml.kernel.org/r/20191023150955.30292-2-kim.phillips@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/events/amd/ibs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 98ba21a588a1..26c36357c4c9 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c | |||
@@ -377,7 +377,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs, | |||
377 | struct hw_perf_event *hwc, u64 config) | 377 | struct hw_perf_event *hwc, u64 config) |
378 | { | 378 | { |
379 | config &= ~perf_ibs->cnt_mask; | 379 | config &= ~perf_ibs->cnt_mask; |
380 | wrmsrl(hwc->config_base, config); | 380 | if (boot_cpu_data.x86 == 0x10) |
381 | wrmsrl(hwc->config_base, config); | ||
381 | config &= ~perf_ibs->enable_mask; | 382 | config &= ~perf_ibs->enable_mask; |
382 | wrmsrl(hwc->config_base, config); | 383 | wrmsrl(hwc->config_base, config); |
383 | } | 384 | } |
@@ -553,7 +554,8 @@ static struct perf_ibs perf_ibs_op = { | |||
553 | }, | 554 | }, |
554 | .msr = MSR_AMD64_IBSOPCTL, | 555 | .msr = MSR_AMD64_IBSOPCTL, |
555 | .config_mask = IBS_OP_CONFIG_MASK, | 556 | .config_mask = IBS_OP_CONFIG_MASK, |
556 | .cnt_mask = IBS_OP_MAX_CNT, | 557 | .cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT | |
558 | IBS_OP_CUR_CNT_RAND, | ||
557 | .enable_mask = IBS_OP_ENABLE, | 559 | .enable_mask = IBS_OP_ENABLE, |
558 | .valid_mask = IBS_OP_VAL, | 560 | .valid_mask = IBS_OP_VAL, |
559 | .max_period = IBS_OP_MAX_CNT << 4, | 561 | .max_period = IBS_OP_MAX_CNT << 4, |