diff options
author | Marco Elver <elver@google.com> | 2022-08-29 14:47:07 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-08-30 10:56:20 +0200 |
commit | c5b81449f915a28bb9c7725e53aebab3ba39b4a2 (patch) | |
tree | 1cd3e781dfed0f8a271bd0987aa26e4979dc3a3b /include/linux/hw_breakpoint.h | |
parent | 724c299c6a0e412b5679d7ebb9b3f4e00bd2aa78 (diff) | |
download | lwn-c5b81449f915a28bb9c7725e53aebab3ba39b4a2.tar.gz lwn-c5b81449f915a28bb9c7725e53aebab3ba39b4a2.zip |
perf/hw_breakpoint: Provide hw_breakpoint_is_used() and use in test
Provide hw_breakpoint_is_used() to check if breakpoints are in use on
the system.
Use it in the KUnit test to verify the global state before and after a
test case.
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20220829124719.675715-3-elver@google.com
Diffstat (limited to 'include/linux/hw_breakpoint.h')
-rw-r--r-- | include/linux/hw_breakpoint.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h index 78dd7035d1e5..a3fb846705eb 100644 --- a/include/linux/hw_breakpoint.h +++ b/include/linux/hw_breakpoint.h @@ -74,6 +74,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr, extern int register_perf_hw_breakpoint(struct perf_event *bp); extern void unregister_hw_breakpoint(struct perf_event *bp); extern void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events); +extern bool hw_breakpoint_is_used(void); extern int dbg_reserve_bp_slot(struct perf_event *bp); extern int dbg_release_bp_slot(struct perf_event *bp); @@ -121,6 +122,8 @@ register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } static inline void unregister_hw_breakpoint(struct perf_event *bp) { } static inline void unregister_wide_hw_breakpoint(struct perf_event * __percpu *cpu_events) { } +static inline bool hw_breakpoint_is_used(void) { return false; } + static inline int reserve_bp_slot(struct perf_event *bp) {return -ENOSYS; } static inline void release_bp_slot(struct perf_event *bp) { } |