Skip to contentSkip to conversation

lock stat kills lock meter for -rt (.h files)

PATCH New Bill Huey (hui) 1 participant 1 message Dec 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 3/5 lock stat kills lock meter for -rt (.h files)

Containes .h file changes.

bill

============================================================

linux/mutex.h +8 -2
@@ -15,6 +15,7 @@
 #include <linux/rt_lock.h>
 #include <linux/linkage.h>
 #include <linux/lockdep.h>
+#include <linux/lock_stat.h>
 
 #include <asm/atomic.h>
 
@@ -35,7 +36,8 @@ extern void
 	}
 
 extern void
-_mutex_init(struct mutex *lock, char *name, struct lock_class_key *key);
+_mutex_init(struct mutex *lock, char *name, struct lock_class_key *key
+					__COMMA_LOCK_STAT_NOTE_PARAM_DECL);
 
 extern void __lockfunc _mutex_lock(struct mutex *lock);
 extern int __lockfunc _mutex_lock_interruptible(struct mutex *lock);
@@ -56,11 +58,15 @@ extern void __lockfunc _mutex_unlock(str
 # define mutex_lock_nested(l, s)	_mutex_lock(l)
 #endif
 
+#define __mutex_init(l,n)		__rt_mutex_init(&(l)->mutex,	\
+					n				\
+					__COMMA_LOCK_STAT_NOTE)
+
 # define mutex_init(mutex)				\
 do {							\
 	static struct lock_class_key __key;		\
 							\
-	_mutex_init((mutex), #mutex, &__key);		\
+	_mutex_init((mutex), #mutex, &__key __COMMA_LOCK_STAT_NOTE);	\
 } while (0)
 
 #else

============================================================

linux/rt_lock.h +13 -9
@@ -13,6 +13,7 @@
 #include <linux/rtmutex.h>
 #include <asm/atomic.h>
 #include <linux/spinlock_types.h>
+#include <linux/lock_stat.h>
 
 #ifdef CONFIG_PREEMPT_RT
 /*
@@ -28,8 +29,8 @@ typedef struct {
 
 #ifdef CONFIG_DEBUG_RT_MUTEXES
 # define __SPIN_LOCK_UNLOCKED(name) \
-	(spinlock_t) { { .wait_lock = _RAW_SPIN_LOCK_UNLOCKED(name) \
-	, .save_state = 1, .file = __FILE__, .line = __LINE__ } }
+	(spinlock_t) { .lock = { .wait_lock = _RAW_SPIN_LOCK_UNLOCKED(name) \
+	, .save_state = 1, .file = __FILE__, .line = __LINE__ __COMMA_LOCK_STAT_INITIALIZER} }
 #else
 # define __SPIN_LOCK_UNLOCKED(name) \
 	(spinlock_t) { { .wait_lock = _RAW_SPIN_LOCK_UNLOCKED(name) } }
@@ -92,7 +93,7 @@ typedef struct {
 # ifdef CONFIG_DEBUG_RT_MUTEXES
 #  define __RW_LOCK_UNLOCKED(name) (rwlock_t) \
 	{ .lock = { .wait_lock = _RAW_SPIN_LOCK_UNLOCKED(name), \
-	 .save_state = 1, .file = __FILE__, .line = __LINE__ } }
+	 .save_state = 1, .file = __FILE__, .line = __LINE__ __COMMA_LOCK_STAT_INITIALIZER } }
 # else
 #  define __RW_LOCK_UNLOCKED(name) (rwlock_t) \
 	{ .lock = { .wait_lock = _RAW_SPIN_LOCK_UNLOCKED(name) } }
@@ -139,14 +140,16 @@ struct semaphore name = \
  */
 #define DECLARE_MUTEX_LOCKED COMPAT_DECLARE_MUTEX_LOCKED
 
-extern void fastcall __sema_init(struct semaphore *sem, int val, char *name, char *file, int line);
+extern void fastcall __sema_init(struct semaphore *sem, int val, char *name
+				__COMMA_LOCK_STAT_FN_DECL, char *_file, int _line);
 
 #define rt_sema_init(sem, val) \
-		__sema_init(sem, val, #sem, __FILE__, __LINE__)
+		__sema_init(sem, val, #sem __COMMA_LOCK_STAT_NOTE_FN, __FILE__, __LINE__)
 
-extern void fastcall __init_MUTEX(struct semaphore *sem, char *name, char *file, int line);
+extern void fastcall __init_MUTEX(struct semaphore *sem, char *name
+				__COMMA_LOCK_STAT_FN_DECL, char *_file, int _line);
 #define rt_init_MUTEX(sem) \
-		__init_MUTEX(sem, #sem, __FILE__, __LINE__)
+		__init_MUTEX(sem, #sem __COMMA_LOCK_STAT_NOTE_FN, __FILE__, __LINE__)
 
 extern void there_is_no_init_MUTEX_LOCKED_for_RT_semaphores(void);
 
@@ -247,13 +250,14 @@ extern void fastcall __rt_rwsem_init(str
 	struct rw_semaphore lockname = __RWSEM_INITIALIZER(lockname)
 
 extern void fastcall __rt_rwsem_init(struct rw_semaphore *rwsem, char *name,
-				     struct lock_class_key *key);
+				     struct lock_class_key *key
+					__COMMA_LOCK_STAT_NOTE_PARAM_DECL);
 
 # define rt_init_rwsem(sem)				\
 do {							\
 	static struct lock_class_key __key;		\
 							\
-	__rt_rwsem_init((sem), #sem, &__key);		\
+	__rt_rwsem_init((sem), #sem, &__key __COMMA_LOCK_STAT_NOTE);		\
 } while (0)
 
 extern void fastcall rt_down_write(struct rw_semaphore *rwsem);

============================================================

linux/rtmutex.h +33 -3
@@ -15,6 +15,7 @@
 #include <linux/linkage.h>
 #include <linux/plist.h>
 #include <linux/spinlock_types.h>
+#include <linux/lock_stat.h>
 
 /*
  * The rt_mutex structure
@@ -33,6 +34,9 @@ struct rt_mutex {
 	int			line;
 	void			*magic;
 #endif
+#ifdef CONFIG_LOCK_STAT
+	struct lock_stat	*lock_stat;
+#endif
 };
 
 struct rt_mutex_waiter;
@@ -54,11 +58,13 @@ struct hrtimer_sleeper;
 #ifdef CONFIG_DEBUG_RT_MUTEXES
 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
 	, .name = #mutexname, .file = __FILE__, .line = __LINE__
-# define rt_mutex_init(mutex)			__rt_mutex_init(mutex, __FUNCTION__)
+# define rt_mutex_init(mutex)		__rt_mutex_init(mutex, __FUNCTION__ \
+						__COMMA_LOCK_STAT_NOTE_DECL_FLLN)
  extern void rt_mutex_debug_task_free(struct task_struct *tsk);
 #else
 # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
-# define rt_mutex_init(mutex)			__rt_mutex_init(mutex, NULL)
+# define rt_mutex_init(mutex)		__rt_mutex_init(mutex, NULL		\
+						__COMMA_LOCK_STAT_NOTE_DECL_FLLN)
 # define rt_mutex_debug_task_free(t)			do { } while (0)
 #endif
 
@@ -66,6 +72,7 @@ struct hrtimer_sleeper;
 	{ .wait_lock = RAW_SPIN_LOCK_UNLOCKED(mutexname) \
 	, .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \
 	, .owner = NULL \
+	__COMMA_LOCK_STAT_INITIALIZER	\
 	__DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
 
 #define DEFINE_RT_MUTEX(mutexname) \
@@ -82,10 +89,19 @@ static inline int rt_mutex_is_locked(str
 	return lock->owner != NULL;
 }
 
-extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
+extern void __rt_mutex_init(struct rt_mutex *lock,
+				const char *name
+				__COMMA_LOCK_STAT_NOTE_PARAM_DECL);
+#ifdef CONFIG_LOCK_STAT
+extern void __rt_mutex_init_annotated(struct rt_mutex *lock, const char *name,
+					LOCK_STAT_NOTE_PARAM_DECL,
+					struct lock_stat *lsobject);
+#endif
+
 extern void rt_mutex_destroy(struct rt_mutex *lock);
 
 extern void rt_mutex_lock(struct rt_mutex *lock);
+
 extern int rt_mutex_lock_interruptible(struct rt_mutex *lock,
 						int detect_deadlock);
 extern int rt_mutex_timed_lock(struct rt_mutex *lock,
@@ -96,6 +112,20 @@ extern void rt_mutex_unlock(struct rt_mu
 
 extern void rt_mutex_unlock(struct rt_mutex *lock);
 
+#ifdef CONFIG_LOCK_STAT
+extern void rt_mutex_lock_with_ip(struct rt_mutex *lock,
+					unsigned long ip);
+extern int rt_mutex_lock_interruptible_with_ip(struct rt_mutex *lock,
+						int detect_deadlock,
+						unsigned long ip);
+extern int rt_mutex_timed_lock_with_ip(struct rt_mutex *lock,
+					struct hrtimer_sleeper *timeout,
+					int detect_deadlock,
+					unsigned long ip);
+extern int rt_mutex_trylock_with_ip(struct rt_mutex *lock,
+					unsigned long ip);
+#endif
+
 #ifdef CONFIG_RT_MUTEXES
 # define INIT_RT_MUTEXES(tsk)						\
 	.pi_waiters	= PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock),	\

============================================================

linux/spinlock.h +56 -4

106 lines not on this page · raw message