Skip to content

Commit cc8e71c

Browse files
Daniel Bristot de Oliveirarostedt
authored andcommitted
rv/include: Add instrumentation helper functions
Instrumentation helper functions to facilitate the instrumentation of auto-generated RV monitors create by dot2k. Link: https://lkml.kernel.org/r/3b36c9435f9d9299beb84e5c7c46920e205bedec.1659052063.git.bristot@kernel.org Cc: Wim Van Sebroeck <wim@linux-watchdog.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ingo Molnar <mingo@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marco Elver <elver@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: "Paul E. McKenney" <paulmck@kernel.org> Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: Gabriele Paoloni <gpaoloni@redhat.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Clark Williams <williams@redhat.com> Cc: Tao Zhou <tao.zhou@linux.dev> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-trace-devel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 7925753 commit cc8e71c

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

include/rv/instrumentation.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
4+
*
5+
* Helper functions to facilitate the instrumentation of auto-generated
6+
* RV monitors create by dot2k.
7+
*
8+
* The dot2k tool is available at tools/verification/dot2/
9+
*/
10+
11+
#include <linux/ftrace.h>
12+
13+
/*
14+
* rv_attach_trace_probe - check and attach a handler function to a tracepoint
15+
*/
16+
#define rv_attach_trace_probe(monitor, tp, rv_handler) \
17+
do { \
18+
check_trace_callback_type_##tp(rv_handler); \
19+
WARN_ONCE(register_trace_##tp(rv_handler, NULL), \
20+
"fail attaching " #monitor " " #tp "handler"); \
21+
} while (0)
22+
23+
/*
24+
* rv_detach_trace_probe - detach a handler function to a tracepoint
25+
*/
26+
#define rv_detach_trace_probe(monitor, tp, rv_handler) \
27+
do { \
28+
unregister_trace_##tp(rv_handler, NULL); \
29+
} while (0)

0 commit comments

Comments
 (0)