~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/tracepoint-defs.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef TRACEPOINT_DEFS_H
  3 #define TRACEPOINT_DEFS_H 1
  4 
  5 /*
  6  * File can be included directly by headers who only want to access
  7  * tracepoint->key to guard out of line trace calls, or the definition of
  8  * trace_print_flags{_u64}. Otherwise linux/tracepoint.h should be used.
  9  */
 10 
 11 #include <linux/atomic.h>
 12 #include <linux/static_key.h>
 13 
 14 struct static_call_key;
 15 
 16 struct trace_print_flags {
 17         unsigned long           mask;
 18         const char              *name;
 19 };
 20 
 21 struct trace_print_flags_u64 {
 22         unsigned long long      mask;
 23         const char              *name;
 24 };
 25 
 26 struct tracepoint_func {
 27         void *func;
 28         void *data;
 29         int prio;
 30 };
 31 
 32 struct tracepoint {
 33         const char *name;               /* Tracepoint name */
 34         struct static_key key;
 35         struct static_call_key *static_call_key;
 36         void *static_call_tramp;
 37         void *iterator;
 38         void *probestub;
 39         int (*regfunc)(void);
 40         void (*unregfunc)(void);
 41         struct tracepoint_func __rcu *funcs;
 42 };
 43 
 44 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 45 typedef const int tracepoint_ptr_t;
 46 #else
 47 typedef struct tracepoint * const tracepoint_ptr_t;
 48 #endif
 49 
 50 struct bpf_raw_event_map {
 51         struct tracepoint       *tp;
 52         void                    *bpf_func;
 53         u32                     num_args;
 54         u32                     writable_size;
 55 } __aligned(32);
 56 
 57 /*
 58  * If a tracepoint needs to be called from a header file, it is not
 59  * recommended to call it directly, as tracepoints in header files
 60  * may cause side-effects and bloat the kernel. Instead, use
 61  * tracepoint_enabled() to test if the tracepoint is enabled, then if
 62  * it is, call a wrapper function defined in a C file that will then
 63  * call the tracepoint.
 64  *
 65  * For "trace_foo_bar()", you would need to create a wrapper function
 66  * in a C file to call trace_foo_bar():
 67  *   void do_trace_foo_bar(args) { trace_foo_bar(args); }
 68  * Then in the header file, declare the tracepoint:
 69  *   DECLARE_TRACEPOINT(foo_bar);
 70  * And call your wrapper:
 71  *   static inline void some_inlined_function() {
 72  *            [..]
 73  *            if (tracepoint_enabled(foo_bar))
 74  *                    do_trace_foo_bar(args);
 75  *            [..]
 76  *   }
 77  *
 78  * Note: tracepoint_enabled(foo_bar) is equivalent to trace_foo_bar_enabled()
 79  *   but is safe to have in headers, where trace_foo_bar_enabled() is not.
 80  */
 81 #define DECLARE_TRACEPOINT(tp) \
 82         extern struct tracepoint __tracepoint_##tp
 83 
 84 #ifdef CONFIG_TRACEPOINTS
 85 # define tracepoint_enabled(tp) \
 86         static_key_false(&(__tracepoint_##tp).key)
 87 #else
 88 # define tracepoint_enabled(tracepoint) false
 89 #endif
 90 
 91 #endif
 92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php