Skip to content

Commit 76ee414

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 9807e72 commit 76ee414

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
@@ -388,7 +388,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs,
388388
struct hw_perf_event *hwc, u64 config)
389389
{
390390
config &= ~perf_ibs->cnt_mask;
391-
wrmsrl(hwc->config_base, config);
391+
if (boot_cpu_data.x86 == 0x10)
392+
wrmsrl(hwc->config_base, config);
392393
config &= ~perf_ibs->enable_mask;
393394
wrmsrl(hwc->config_base, config);
394395
}
@@ -563,7 +564,8 @@ static struct perf_ibs perf_ibs_op = {
563564
},
564565
.msr = MSR_AMD64_IBSOPCTL,
565566
.config_mask = IBS_OP_CONFIG_MASK,
566-
.cnt_mask = IBS_OP_MAX_CNT,
567+
.cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT |
568+
IBS_OP_CUR_CNT_RAND,
567569
.enable_mask = IBS_OP_ENABLE,
568570
.valid_mask = IBS_OP_VAL,
569571
.max_period = IBS_OP_MAX_CNT << 4,

0 commit comments

Comments
 (0)