Re: Print out additional debugging advice when we hit lockdep BUGs

From: Ingo Molnar
Date: Fri Apr 26 2013 - 02:32:25 EST



* Dave Jones <davej@xxxxxxxxxx> wrote:

> On Wed, Apr 24, 2013 at 08:48:13AM +0200, Ingo Molnar wrote:
>
> > These patterns repeated in 4 places really call for a common helper
> > defined as print_lockdep_off(fmt...) or so?
> >
> > (Can be a followup patch if that's easier for you.)
>
> Given there was only one case which was really different, I opted not to
> bother with varargs, and just pass the one string that changes and add
> an extra printk for that special case (MAX_LOCK_DEPTH)
>
> --
>
> Consolidate the lockdep "too low" messages into one function.
> Also add some missing printk levels.
>
> Signed-off-by: Dave Jones <davej@xxxxxxxxxx>
>
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index e4c001f..be52e6d 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -380,6 +380,13 @@ static int verbose(struct lock_class *class)
> unsigned long nr_stack_trace_entries;
> static unsigned long stack_trace[MAX_STACK_TRACE_ENTRIES];
>
> +static void print_lockdep_off(const char *which)
> +{
> + printk(KERN_DEBUG "BUG: %s too low!\n", which);
> + printk(KERN_DEBUG "turning off the locking correctness validator.\n");
> + printk(KERN_DEBUG "Attach output of /proc/lock_stat to bug report\n");
> +}
> +

Yeah, that looks perfectly fine - thanks!

( I tweaked it a tiny bit to pass in a generic bug-string instead of
assuming that the warning is necessarily about some 'too low' value.
This makes actual usage sites of print_lockdep_off() easier to read and
closer to existing WARN() patterns. )

Thanks,

Ingo
--
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/