Skip to content

Commit

Permalink
[PATCH] pi-futex: rt mutex debug
Browse files Browse the repository at this point in the history
Runtime debugging functionality for rt-mutexes.

Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Arjan van de Ven <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jun 28, 2006
1 parent a6537be commit e7eebaf
Show file tree
Hide file tree
Showing 8 changed files with 581 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ static inline void
debug_check_no_locks_freed(const void *from, unsigned long len)
{
mutex_debug_check_no_locks_freed(from, len);
rt_mutex_debug_check_no_locks_freed(from, len);
}

#ifndef CONFIG_DEBUG_PAGEALLOC
Expand Down
15 changes: 14 additions & 1 deletion include/linux/rtmutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ struct rt_mutex {
struct rt_mutex_waiter;
struct hrtimer_sleeper;

#ifdef CONFIG_DEBUG_RT_MUTEXES
extern int rt_mutex_debug_check_no_locks_freed(const void *from,
unsigned long len);
extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
#else
static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
unsigned long len)
{
return 0;
}
# define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
#endif

#ifdef CONFIG_DEBUG_RT_MUTEXES
# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
, .name = #mutexname, .file = __FILE__, .line = __LINE__
Expand All @@ -48,7 +61,7 @@ struct hrtimer_sleeper;
#else
# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL)
# define rt_mutex_debug_task_free(t) do { } while (0)
# define rt_mutex_debug_task_free(t) do { } while (0)
#endif

#define __RT_MUTEX_INITIALIZER(mutexname) \
Expand Down
1 change: 1 addition & 0 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ifeq ($(CONFIG_COMPAT),y)
obj-$(CONFIG_FUTEX) += futex_compat.o
endif
obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
obj-$(CONFIG_SMP) += cpu.o spinlock.o
obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
Expand Down
1 change: 1 addition & 0 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ fastcall NORET_TYPE void do_exit(long code)
* If DEBUG_MUTEXES is on, make sure we are holding no locks:
*/
mutex_debug_check_no_locks_held(tsk);
rt_mutex_debug_check_no_locks_held(tsk);

if (tsk->io_context)
exit_io_context();
Expand Down
Loading

0 comments on commit e7eebaf

Please sign in to comment.