Skip to content

Commit 133a6d1

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Update user page mapping only once during start
Currently, riscv_pmu_event_set_period updates the userpage mapping. However, the caller of riscv_pmu_event_set_period should update the userpage mapping because the counter can not be updated/started from set_period function in counter overflow path. Invoke the perf_event_update_userpage at the caller so that it doesn't get invoked twice during counter start path. Fixes: f5bfa23 ("RISC-V: Add a perf core library for pmu drivers") Reviewed-by: Anup Patel <[email protected]> Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Guo Ren <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent acc1b91 commit 133a6d1

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

drivers/perf/riscv_pmu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ int riscv_pmu_event_set_period(struct perf_event *event)
170170
left = (max_period >> 1);
171171

172172
local64_set(&hwc->prev_count, (u64)-left);
173-
perf_event_update_userpage(event);
174173

175174
return overflow;
176175
}

drivers/perf/riscv_pmu_sbi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu,
532532
sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1,
533533
flag, init_val, 0, 0);
534534
#endif
535+
perf_event_update_userpage(event);
535536
}
536537
ctr_ovf_mask = ctr_ovf_mask >> 1;
537538
idx++;

0 commit comments

Comments
 (0)