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