Re: [patch 07/61] lock validator: better lock debugging

From: Andrew Morton
Date: Mon May 29 2006 - 21:29:12 EST


On Mon, 29 May 2006 23:23:37 +0200
Ingo Molnar <mingo@xxxxxxx> wrote:

> --- /dev/null
> +++ linux/include/linux/debug_locks.h
> @@ -0,0 +1,62 @@
> +#ifndef __LINUX_DEBUG_LOCKING_H
> +#define __LINUX_DEBUG_LOCKING_H
> +
> +extern int debug_locks;
> +extern int debug_locks_silent;
> +
> +/*
> + * Generic 'turn off all lock debugging' function:
> + */
> +extern int debug_locks_off(void);
> +
> +/*
> + * In the debug case we carry the caller's instruction pointer into
> + * other functions, but we dont want the function argument overhead
> + * in the nondebug case - hence these macros:
> + */
> +#define _RET_IP_ (unsigned long)__builtin_return_address(0)
> +#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
> +
> +#define DEBUG_WARN_ON(c) \
> +({ \
> + int __ret = 0; \
> + \
> + if (unlikely(c)) { \
> + if (debug_locks_off()) \
> + WARN_ON(1); \
> + __ret = 1; \
> + } \
> + __ret; \
> +})

Either the name of this thing is too generic, or we _make_ it generic, in
which case it's in the wrong header file.

> +#ifdef CONFIG_SMP
> +# define SMP_DEBUG_WARN_ON(c) DEBUG_WARN_ON(c)
> +#else
> +# define SMP_DEBUG_WARN_ON(c) do { } while (0)
> +#endif

Probably ditto.


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