Skip to content

Commit f147516

Browse files
kimphillamdgregkh
authored andcommitted
perf/x86/amd/ibs: Handle erratum torvalds#420 only on the affected CPU family (10h)
[ Upstream commit e431e79 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 5b99e97 commit f147516

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/events/amd/ibs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs,
389389
struct hw_perf_event *hwc, u64 config)
390390
{
391391
config &= ~perf_ibs->cnt_mask;
392-
wrmsrl(hwc->config_base, config);
392+
if (boot_cpu_data.x86 == 0x10)
393+
wrmsrl(hwc->config_base, config);
393394
config &= ~perf_ibs->enable_mask;
394395
wrmsrl(hwc->config_base, config);
395396
}
@@ -564,7 +565,8 @@ static struct perf_ibs perf_ibs_op = {
564565
},
565566
.msr = MSR_AMD64_IBSOPCTL,
566567
.config_mask = IBS_OP_CONFIG_MASK,
567-
.cnt_mask = IBS_OP_MAX_CNT,
568+
.cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT |
569+
IBS_OP_CUR_CNT_RAND,
568570
.enable_mask = IBS_OP_ENABLE,
569571
.valid_mask = IBS_OP_VAL,
570572
.max_period = IBS_OP_MAX_CNT << 4,

0 commit comments

Comments
 (0)