Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM lock
4
5#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_LOCK_H
7
8#include <linux/lockdep.h>
9#include <linux/tracepoint.h>
10
11#ifdef CONFIG_LOCKDEP
12
13TRACE_EVENT(lock_acquire,
14
15 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
16 int trylock, int read, int check,
17 struct lockdep_map *next_lock, unsigned long ip),
18
19 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
20
21 TP_STRUCT__entry(
22 __field(unsigned int, flags)
23 __string(name, lock->name)
24 __field(void *, lockdep_addr)
25 ),
26
27 TP_fast_assign(
28 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
29 __assign_str(name, lock->name);
30 __entry->lockdep_addr = lock;
31 ),
32
33 TP_printk("%p %s%s%s", __entry->lockdep_addr,
34 (__entry->flags & 1) ? "try " : "",
35 (__entry->flags & 2) ? "read " : "",
36 __get_str(name))
37);
38
39DECLARE_EVENT_CLASS(lock,
40
41 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
42
43 TP_ARGS(lock, ip),
44
45 TP_STRUCT__entry(
46 __string( name, lock->name )
47 __field( void *, lockdep_addr )
48 ),
49
50 TP_fast_assign(
51 __assign_str(name, lock->name);
52 __entry->lockdep_addr = lock;
53 ),
54
55 TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
56);
57
58DEFINE_EVENT(lock, lock_release,
59
60 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
61
62 TP_ARGS(lock, ip)
63);
64
65#ifdef CONFIG_LOCK_STAT
66
67DEFINE_EVENT(lock, lock_contended,
68
69 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
70
71 TP_ARGS(lock, ip)
72);
73
74DEFINE_EVENT(lock, lock_acquired,
75
76 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
77
78 TP_ARGS(lock, ip)
79);
80
81#endif
82#endif
83
84#endif /* _TRACE_LOCK_H */
85
86/* This part must be outside protection */
87#include <trace/define_trace.h>
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM lock
3
4#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_LOCK_H
6
7#include <linux/lockdep.h>
8#include <linux/tracepoint.h>
9
10#ifdef CONFIG_LOCKDEP
11
12TRACE_EVENT(lock_acquire,
13
14 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
15 int trylock, int read, int check,
16 struct lockdep_map *next_lock, unsigned long ip),
17
18 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
19
20 TP_STRUCT__entry(
21 __field(unsigned int, flags)
22 __string(name, lock->name)
23 __field(void *, lockdep_addr)
24 ),
25
26 TP_fast_assign(
27 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
28 __assign_str(name, lock->name);
29 __entry->lockdep_addr = lock;
30 ),
31
32 TP_printk("%p %s%s%s", __entry->lockdep_addr,
33 (__entry->flags & 1) ? "try " : "",
34 (__entry->flags & 2) ? "read " : "",
35 __get_str(name))
36);
37
38DECLARE_EVENT_CLASS(lock,
39
40 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
41
42 TP_ARGS(lock, ip),
43
44 TP_STRUCT__entry(
45 __string( name, lock->name )
46 __field( void *, lockdep_addr )
47 ),
48
49 TP_fast_assign(
50 __assign_str(name, lock->name);
51 __entry->lockdep_addr = lock;
52 ),
53
54 TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
55);
56
57DEFINE_EVENT(lock, lock_release,
58
59 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
60
61 TP_ARGS(lock, ip)
62);
63
64#ifdef CONFIG_LOCK_STAT
65
66DEFINE_EVENT(lock, lock_contended,
67
68 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
69
70 TP_ARGS(lock, ip)
71);
72
73DEFINE_EVENT(lock, lock_acquired,
74
75 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
76
77 TP_ARGS(lock, ip)
78);
79
80#endif
81#endif
82
83#endif /* _TRACE_LOCK_H */
84
85/* This part must be outside protection */
86#include <trace/define_trace.h>