public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Nicolas Pitre <nico@cam.org>,
	Jes Sorensen <jes@trained-monkey.org>,
	Al Viro <viro@ftp.linux.org.uk>, Oleg Nesterov <oleg@tv-sign.ru>,
	David Howells <dhowells@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Christoph Hellwig <hch@infradead.org>, Andi Kleen <ak@suse.de>,
	Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: [patch 10/21] mutex subsystem, debugging code
Date: Thu, 05 Jan 2006 13:47:03 -0800	[thread overview]
Message-ID: <1136497623.22868.180.camel@stark> (raw)
In-Reply-To: <20060105153804.GK31013@elte.hu>

On Thu, 2006-01-05 at 16:38 +0100, Ingo Molnar wrote:
> mutex implementation - add debugging code.
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Arjan van de Ven <arjan@infradead.org>
> 
> ----
> 
>  include/linux/mutex-debug.h |   21 +
>  include/linux/sched.h       |    5 
>  kernel/Makefile             |    1 
>  kernel/fork.c               |    4 
>  kernel/mutex-debug.c        |  464 ++++++++++++++++++++++++++++++++++++++++++++
>  kernel/mutex-debug.h        |  134 ++++++++++++
>  lib/Kconfig.debug           |    8 
>  7 files changed, 637 insertions(+)
> 
> Index: linux/include/linux/mutex-debug.h
> ===================================================================
> --- /dev/null
> +++ linux/include/linux/mutex-debug.h
> @@ -0,0 +1,21 @@
> +#ifndef __LINUX_MUTEX_DEBUG_H
> +#define __LINUX_MUTEX_DEBUG_H
> +
> +/*
> + * Mutexes - debugging helpers:
> + */
> +
> +#define __DEBUG_MUTEX_INITIALIZER(lockname) \
> +	, .held_list = LIST_HEAD_INIT(lockname.held_list), \
> +	  .name = #lockname , .magic = &lockname
> +
> +#define mutex_init(sem)		__mutex_init(sem, __FUNCTION__)
> +
> +extern void FASTCALL(mutex_destroy(struct mutex *lock));
> +
> +extern void mutex_debug_show_all_locks(void);
> +extern void mutex_debug_show_held_locks(struct task_struct *filter);
> +extern void mutex_debug_check_no_locks_held(struct task_struct *task);
> +extern void mutex_debug_check_no_locks_freed(const void *from, const void *to);
> +
> +#endif
> Index: linux/include/linux/sched.h
> ===================================================================
> --- linux.orig/include/linux/sched.h
> +++ linux/include/linux/sched.h
> @@ -820,6 +820,11 @@ struct task_struct {
>  /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
>  	spinlock_t proc_lock;
>  
> +#ifdef CONFIG_DEBUG_MUTEXES
> +	/* mutex deadlock detection */
> +	struct mutex_waiter *blocked_on;
> +#endif
> +
>  /* journalling filesystem info */
>  	void *journal_info;
>  
> Index: linux/kernel/Makefile
> ===================================================================
> --- linux.orig/kernel/Makefile
> +++ linux/kernel/Makefile
> @@ -9,6 +9,7 @@ obj-y     = sched.o fork.o exec_domain.o
>  	    rcupdate.o intermodule.o extable.o params.o posix-timers.o \
>  	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o
>  
> +obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o
>  obj-$(CONFIG_FUTEX) += futex.o
>  obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
>  obj-$(CONFIG_SMP) += cpu.o spinlock.o
> Index: linux/kernel/fork.c
> ===================================================================
> --- linux.orig/kernel/fork.c
> +++ linux/kernel/fork.c
> @@ -973,6 +973,10 @@ static task_t *copy_process(unsigned lon
>   	}
>  #endif
>  
> +#ifdef CONFIG_DEBUG_MUTEXES
> +	p->blocked_on = NULL; /* not blocked yet */
> +#endif
> +
>  	p->tgid = p->pid;
>  	if (clone_flags & CLONE_THREAD)
>  		p->tgid = current->tgid;

Should there be a corresponding initialization of init's blocked_on
field in include/linux/init_task.h?

<snip>

Cheers,
	-Matt Helsley


  reply	other threads:[~2006-01-05 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 15:38 [patch 10/21] mutex subsystem, debugging code Ingo Molnar
2006-01-05 21:47 ` Matt Helsley [this message]
2006-01-06 11:31   ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2006-01-04 14:43 Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136497623.22868.180.camel@stark \
    --to=matthltc@us.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=jes@trained-monkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nico@cam.org \
    --cc=oleg@tv-sign.ru \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox