Re: [RESEND PATCH 04/11] kernel:lockdep:implement check_noncircular() by BFS

From: Dave Young
Date: Mon Jul 13 2009 - 04:08:26 EST


On Mon, Jul 13, 2009 at 4:02 PM, Dave Young<hidave.darkstar@xxxxxxxxx> wrote:
> On Sun, Jun 28, 2009 at 11:04:39PM +0800, tom.leiming@xxxxxxxxx wrote:
>> From: Ming Lei <tom.leiming@xxxxxxxxx>
>>
>> This patch uses BFS to implement check_noncircular() and
>> prints the generated shortest circle if exists.
>>
>> Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
>> ---
>> Âkernel/lockdep.c | Â 89 ++++++++++++++++++++++-------------------------------
>> Â1 files changed, 37 insertions(+), 52 deletions(-)
>>
>> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
>> index ce6d09e..f740088 100644
>> --- a/kernel/lockdep.c
>> +++ b/kernel/lockdep.c
>> @@ -985,12 +985,7 @@ static inline int __bfs_backward(struct lock_list *src_entry,
>> Â * Recursive, forwards-direction lock-dependency checking, used for
>> Â * both noncyclic checking and for hardirq-unsafe/softirq-unsafe
>> Â * checking.
>> - *
>> - * (to keep the stackframe of the recursive functions small we
>> - * Âuse these global variables, and we also mark various helper
>> - * Âfunctions as noinline.)
>> Â */
>> -static struct held_lock *check_source, *check_target;
>>
>> Â/*
>> Â * Print a dependency chain entry (this is only done when a deadlock
>> @@ -1014,7 +1009,9 @@ print_circular_bug_entry(struct lock_list *target, unsigned int depth)
>> Â * header first:
>> Â */
>> Âstatic noinline int
>> -print_circular_bug_header(struct lock_list *entry, unsigned int depth)
>> +print_circular_bug_header(struct lock_list *entry, unsigned int depth,
>> + Â Â Â Â Â Â Â Â Â Â struct held_lock *check_src,
>> + Â Â Â Â Â Â Â Â Â Â struct held_lock *check_tgt)
>> Â{
>> Â Â Â struct task_struct *curr = current;
>>
>> @@ -1027,9 +1024,9 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth)
>> Â Â Â printk( Â"-------------------------------------------------------\n");
>> Â Â Â printk("%s/%d is trying to acquire lock:\n",
>> Â Â Â Â Â Â Â curr->comm, task_pid_nr(curr));
>> - Â Â print_lock(check_source);
>> + Â Â print_lock(check_src);
>> Â Â Â printk("\nbut task is already holding lock:\n");
>> - Â Â print_lock(check_target);
>> + Â Â print_lock(check_tgt);
>> Â Â Â printk("\nwhich lock already depends on the new lock.\n\n");
>> Â Â Â printk("\nthe existing dependency chain (in reverse order) is:\n");
>>
>> @@ -1043,36 +1040,24 @@ static inline int class_equal(struct lock_list *entry, void *data)
>> Â Â Â return entry->class == data;
>> Â}
>>
>> -static noinline int print_circular_bug(void)
>> +static noinline int print_circular_bug(struct lock_list *this,
>
> Shouldn't be 'static noinline int' here? Same question to following ones.
>

Sorry for pointing to wrong place. please grep to find them:

161:+static int noinline print_bfs_bug(int ret)
173: static int noinline print_infinite_recursion_bug(void)

--
Regards
dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/