Cleanup: move to kernel style SPDX license identifiers
[lttng-modules.git] / instrumentation / events / lttng-module / lock.h
CommitLineData
9f36eaed 1/* SPDX-License-Identifier: GPL-2.0 */
7c68b363
AG
2#include <linux/version.h>
3
b283666f 4#undef TRACE_SYSTEM
7c68b363 5#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
b283666f 6#define TRACE_SYSTEM lock
7c68b363
AG
7#else
8#define TRACE_SYSTEM lockdep
9#define TRACE_INCLUDE_FILE lock
10#if defined(_TRACE_LOCKDEP_H)
3bc29f0a 11#define LTTNG_TRACE_LOCK_H
7c68b363
AG
12#endif
13#endif
b283666f 14
3bc29f0a
MD
15#if !defined(LTTNG_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
16#define LTTNG_TRACE_LOCK_H
b283666f
PW
17
18#include <linux/lockdep.h>
6ec43db8 19#include <probes/lttng-tracepoint-event.h>
b283666f
PW
20
21#ifdef CONFIG_LOCKDEP
22
3bc29f0a 23LTTNG_TRACEPOINT_EVENT(lock_acquire,
b283666f
PW
24
25 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
26 int trylock, int read, int check,
27 struct lockdep_map *next_lock, unsigned long ip),
28
29 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
30
f127e61e
MD
31 TP_FIELDS(
32 ctf_integer(unsigned int, flags, (trylock ? 1 : 0) | (read ? 2 : 0))
33 ctf_string(name, lock->name)
7c68b363 34#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
fa91fcac 35 ctf_integer_hex(void *, lockdep_addr, lock)
7c68b363 36#endif
f127e61e 37 )
b283666f
PW
38)
39
7c68b363
AG
40#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
41
3bc29f0a 42LTTNG_TRACEPOINT_EVENT_CLASS(lock,
b283666f
PW
43
44 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
45
46 TP_ARGS(lock, ip),
47
f127e61e
MD
48 TP_FIELDS(
49 ctf_string(name, lock->name)
fa91fcac 50 ctf_integer_hex(void *, lockdep_addr, lock)
f127e61e 51 )
b283666f
PW
52)
53
3bc29f0a 54LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_release,
b283666f
PW
55
56 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
57
58 TP_ARGS(lock, ip)
59)
60
61#ifdef CONFIG_LOCK_STAT
62
3bc29f0a 63LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_contended,
b283666f
PW
64
65 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
66
67 TP_ARGS(lock, ip)
68)
69
3bc29f0a 70LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_acquired,
b283666f
PW
71
72 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
73
74 TP_ARGS(lock, ip)
75)
76
77#endif
7c68b363
AG
78
79#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
80
3bc29f0a 81LTTNG_TRACEPOINT_EVENT(lock_release,
7c68b363
AG
82
83 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
84
85 TP_ARGS(lock, nested, ip),
86
f127e61e
MD
87 TP_FIELDS(
88 ctf_string(name, lock->name)
7c68b363 89#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
fa91fcac 90 ctf_integer_hex(void *, lockdep_addr, lock)
7c68b363 91#endif
f127e61e 92 )
7c68b363
AG
93)
94
95#ifdef CONFIG_LOCK_STAT
96
3bc29f0a 97LTTNG_TRACEPOINT_EVENT(lock_contended,
7c68b363
AG
98
99 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
100
101 TP_ARGS(lock, ip),
102
f127e61e
MD
103 TP_FIELDS(
104 ctf_string(name, lock->name)
7c68b363 105#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
fa91fcac 106 ctf_integer_hex(void *, lockdep_addr, lock)
7c68b363 107#endif
f127e61e 108 )
7c68b363
AG
109)
110
3bc29f0a 111LTTNG_TRACEPOINT_EVENT(lock_acquired,
7c68b363
AG
112
113 TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
114
115 TP_ARGS(lock, ip, waittime),
116
f127e61e
MD
117 TP_FIELDS(
118 ctf_string(name, lock->name)
7c68b363 119#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
f127e61e 120 ctf_integer(s64, wait_nsec, wait_nsec)
fa91fcac 121 ctf_integer_hex(void *, lockdep_addr, lock)
7c68b363 122#else
f127e61e
MD
123 ctf_integer(unsigned long, wait_usec, (unsigned long) waittime)
124 ctf_integer(unsigned long, wait_nsec_rem, do_div(waittime, NSEC_PER_USEC))
7c68b363 125#endif
f127e61e 126 )
7c68b363
AG
127)
128
129#endif
130
131#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
132
b283666f
PW
133#endif
134
3bc29f0a 135#endif /* LTTNG_TRACE_LOCK_H */
b283666f
PW
136
137/* This part must be outside protection */
6ec43db8 138#include <probes/define_trace.h>
This page took 0.037615 seconds and 4 git commands to generate.