Skip to content

Commit 9f3de72

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/ds: Unconditionally drain PEBS DS when changing PEBS_DATA_CFG
The PEBS kernel warnings can still be observed with the below case. when the below commands are running in parallel for a while. while true; do perf record --no-buildid -a --intr-regs=AX \ -e cpu/event=0xd0,umask=0x81/pp \ -c 10003 -o /dev/null ./triad; done & while true; do perf record -e 'cpu/mem-loads,ldlat=3/uP' -W -d -- ./dtlb done The commit b752ea0 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG") intends to flush the entire PEBS buffer before the hardware is reprogrammed. However, it fails in the above case. The first perf command utilizes the large PEBS, while the second perf command only utilizes a single PEBS. When the second perf event is added, only the n_pebs++. The intel_pmu_pebs_enable() is invoked after intel_pmu_pebs_add(). So the cpuc->n_pebs == cpuc->n_large_pebs check in the intel_pmu_drain_large_pebs() fails. The PEBS DS is not flushed. The new PEBS event should not be taken into account when flushing the existing PEBS DS. The check is unnecessary here. Before the hardware is reprogrammed, all the stale records must be drained unconditionally. For single PEBS or PEBS-vi-pt, the DS must be empty. The drain_pebs() can handle the empty case. There is no harm to unconditionally drain the PEBS DS. Fixes: b752ea0 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG") Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 4e54ed4 commit 9f3de72

File tree

1 file changed

+1
-1
lines changed
  • arch/x86/events/intel

1 file changed

+1
-1
lines changed

arch/x86/events/intel/ds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ void intel_pmu_pebs_enable(struct perf_event *event)
14891489
* hence we need to drain when changing said
14901490
* size.
14911491
*/
1492-
intel_pmu_drain_large_pebs(cpuc);
1492+
intel_pmu_drain_pebs_buffer();
14931493
adaptive_pebs_record_size_update();
14941494
wrmsrl(MSR_PEBS_DATA_CFG, pebs_data_cfg);
14951495
cpuc->active_pebs_data_cfg = pebs_data_cfg;

0 commit comments

Comments
 (0)