diff options
author | Eric Lin <eric.lin@sifive.com> | 2022-07-05 17:19:20 +0800 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2022-07-06 10:57:30 +0100 |
commit | e9a023f2b73ac35ff5cfbefe8524c64d8173d65f (patch) | |
tree | d32964f14942b5e6390e7af2e8dbe5caeca27b92 /include/linux/perf | |
parent | e500405dd15d956790859fa532c64d8186445372 (diff) | |
download | linux-stable-e9a023f2b73ac35ff5cfbefe8524c64d8173d65f.tar.gz linux-stable-e9a023f2b73ac35ff5cfbefe8524c64d8173d65f.tar.bz2 linux-stable-e9a023f2b73ac35ff5cfbefe8524c64d8173d65f.zip |
drivers/perf: riscv_pmu: Add riscv pmu pm notifier
Currently, when the CPU is doing suspend to ram, we don't
save pmu counter register and its content will be lost.
To ensure perf profiling is not affected by suspend to ram,
this patch is based on arm_pmu CPU_PM notifier and implements riscv
pmu pm notifier. In the pm notifier, we stop the counter and update
the counter value before suspend and start the counter after resume.
Signed-off-by: Eric Lin <eric.lin@sifive.com>
Link: https://lore.kernel.org/r/20220705091920.27432-1-eric.lin@sifive.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'include/linux/perf')
-rw-r--r-- | include/linux/perf/riscv_pmu.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/perf/riscv_pmu.h b/include/linux/perf/riscv_pmu.h index 46f9b6fe306e..bf66fe011fa8 100644 --- a/include/linux/perf/riscv_pmu.h +++ b/include/linux/perf/riscv_pmu.h @@ -56,9 +56,13 @@ struct riscv_pmu { struct cpu_hw_events __percpu *hw_events; struct hlist_node node; + struct notifier_block riscv_pm_nb; }; #define to_riscv_pmu(p) (container_of(p, struct riscv_pmu, pmu)) + +void riscv_pmu_start(struct perf_event *event, int flags); +void riscv_pmu_stop(struct perf_event *event, int flags); unsigned long riscv_pmu_ctr_read_csr(unsigned long csr); int riscv_pmu_event_set_period(struct perf_event *event); uint64_t riscv_pmu_ctr_get_width_mask(struct perf_event *event); |