167178767SFrederic Weisbecker #undef TRACE_SYSTEM 267178767SFrederic Weisbecker #define TRACE_SYSTEM lock 367178767SFrederic Weisbecker 467178767SFrederic Weisbecker #if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) 567178767SFrederic Weisbecker #define _TRACE_LOCK_H 667178767SFrederic Weisbecker 767178767SFrederic Weisbecker #include <linux/lockdep.h> 867178767SFrederic Weisbecker #include <linux/tracepoint.h> 967178767SFrederic Weisbecker 1067178767SFrederic Weisbecker #ifdef CONFIG_LOCKDEP 1167178767SFrederic Weisbecker 1267178767SFrederic Weisbecker TRACE_EVENT(lock_acquire, 1367178767SFrederic Weisbecker 1467178767SFrederic Weisbecker TP_PROTO(struct lockdep_map *lock, unsigned int subclass, 1567178767SFrederic Weisbecker int trylock, int read, int check, 1667178767SFrederic Weisbecker struct lockdep_map *next_lock, unsigned long ip), 1767178767SFrederic Weisbecker 1867178767SFrederic Weisbecker TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), 1967178767SFrederic Weisbecker 2067178767SFrederic Weisbecker TP_STRUCT__entry( 2167178767SFrederic Weisbecker __field(unsigned int, flags) 2267178767SFrederic Weisbecker __string(name, lock->name) 23c965be10SHitoshi Mitake __field(void *, lockdep_addr) 2467178767SFrederic Weisbecker ), 2567178767SFrederic Weisbecker 2667178767SFrederic Weisbecker TP_fast_assign( 2767178767SFrederic Weisbecker __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); 2867178767SFrederic Weisbecker __assign_str(name, lock->name); 29c965be10SHitoshi Mitake __entry->lockdep_addr = lock; 3067178767SFrederic Weisbecker ), 3167178767SFrederic Weisbecker 32c965be10SHitoshi Mitake TP_printk("%p %s%s%s", __entry->lockdep_addr, 33c965be10SHitoshi Mitake (__entry->flags & 1) ? "try " : "", 3467178767SFrederic Weisbecker (__entry->flags & 2) ? "read " : "", 3567178767SFrederic Weisbecker __get_str(name)) 3667178767SFrederic Weisbecker ); 3767178767SFrederic Weisbecker 382c193c73SFrederic Weisbecker DECLARE_EVENT_CLASS(lock, 3967178767SFrederic Weisbecker 4093135439SFrederic Weisbecker TP_PROTO(struct lockdep_map *lock, unsigned long ip), 4167178767SFrederic Weisbecker 4293135439SFrederic Weisbecker TP_ARGS(lock, ip), 4367178767SFrederic Weisbecker 4467178767SFrederic Weisbecker TP_STRUCT__entry( 4567178767SFrederic Weisbecker __string( name, lock->name ) 46c965be10SHitoshi Mitake __field( void *, lockdep_addr ) 4767178767SFrederic Weisbecker ), 4867178767SFrederic Weisbecker 4967178767SFrederic Weisbecker TP_fast_assign( 5067178767SFrederic Weisbecker __assign_str(name, lock->name); 51c965be10SHitoshi Mitake __entry->lockdep_addr = lock; 5267178767SFrederic Weisbecker ), 5367178767SFrederic Weisbecker 542c193c73SFrederic Weisbecker TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) 552c193c73SFrederic Weisbecker ); 562c193c73SFrederic Weisbecker 572c193c73SFrederic Weisbecker DEFINE_EVENT(lock, lock_release, 582c193c73SFrederic Weisbecker 592c193c73SFrederic Weisbecker TP_PROTO(struct lockdep_map *lock, unsigned long ip), 602c193c73SFrederic Weisbecker 612c193c73SFrederic Weisbecker TP_ARGS(lock, ip) 6267178767SFrederic Weisbecker ); 6367178767SFrederic Weisbecker 6467178767SFrederic Weisbecker #ifdef CONFIG_LOCK_STAT 6567178767SFrederic Weisbecker 662c193c73SFrederic Weisbecker DEFINE_EVENT(lock, lock_contended, 6767178767SFrederic Weisbecker 6867178767SFrederic Weisbecker TP_PROTO(struct lockdep_map *lock, unsigned long ip), 6967178767SFrederic Weisbecker 702c193c73SFrederic Weisbecker TP_ARGS(lock, ip) 7167178767SFrederic Weisbecker ); 7267178767SFrederic Weisbecker 732c193c73SFrederic Weisbecker DEFINE_EVENT(lock, lock_acquired, 742c193c73SFrederic Weisbecker 75883a2a31SFrederic Weisbecker TP_PROTO(struct lockdep_map *lock, unsigned long ip), 7667178767SFrederic Weisbecker 772c193c73SFrederic Weisbecker TP_ARGS(lock, ip) 7867178767SFrederic Weisbecker ); 7967178767SFrederic Weisbecker 8067178767SFrederic Weisbecker #endif 8167178767SFrederic Weisbecker #endif 8267178767SFrederic Weisbecker 8367178767SFrederic Weisbecker #endif /* _TRACE_LOCK_H */ 8467178767SFrederic Weisbecker 8567178767SFrederic Weisbecker /* This part must be outside protection */ 8667178767SFrederic Weisbecker #include <trace/define_trace.h> 87