diff options
| author | SeungJu Cheon <suunj1331@gmail.com> | 2026-08-25 17:37:19 +0900 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2026-09-15 18:55:51 +0530 |
| commit | c7e2cc38c56142cdab25e6f73602a8222bf9479b (patch) | |
| tree | 7d3196bbeb6f7b99da398c73ce2e77509f47c685 /tools/perf/scripts/python | |
| parent | 057dd2639ceae79adced5d8fe52c32d562edcb3a (diff) | |
| download | linux-next-c7e2cc38c56142cdab25e6f73602a8222bf9479b.tar.gz linux-next-c7e2cc38c56142cdab25e6f73602a8222bf9479b.zip | |
RISC-V: KVM: Fix perf-backed counter accounting across stop and read
pmu_ctr_read() adds the event count returned by perf_event_read_value()
to counter_val, which can accumulate the same count repeatedly across
reads. kvm_riscv_vcpu_pmu_ctr_stop() also leaves counter_val stale by
not folding the current event count into it.
Make reads of perf-backed counters side-effect free, and use
perf_event_pause() when stopping a counter to fold the current event
count into counter_val while resetting it. This preserves the counter
value across stop/start and lets the snapshot path use counter_val
directly.
Fixes: 0cb74b65d2e5 ("RISC-V: KVM: Implement perf support without sampling")
Signed-off-by: SeungJu Cheon <suunj1331@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260825083719.643970-4-suunj1331@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
