Skip to content

Commit e431e79

Browse files
kimphillamdIngo Molnar
authored and
Ingo Molnar
committed
perf/x86/amd/ibs: Handle erratum torvalds#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 torvalds#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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Fixes: c9574fe ("perf/x86-ibs: Implement workaround for IBS erratum torvalds#420") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 317b96b commit e431e79

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/events/amd/ibs.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs,
377377
struct hw_perf_event *hwc, u64 config)
378378
{
379379
config &= ~perf_ibs->cnt_mask;
380-
wrmsrl(hwc->config_base, config);
380+
if (boot_cpu_data.x86 == 0x10)
381+
wrmsrl(hwc->config_base, config);
381382
config &= ~perf_ibs->enable_mask;
382383
wrmsrl(hwc->config_base, config);
383384
}
@@ -553,7 +554,8 @@ static struct perf_ibs perf_ibs_op = {
553554
},
554555
.msr = MSR_AMD64_IBSOPCTL,
555556
.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,
557559
.enable_mask = IBS_OP_ENABLE,
558560
.valid_mask = IBS_OP_VAL,
559561
.max_period = IBS_OP_MAX_CNT << 4,

0 commit comments

Comments
 (0)