Re: [PATCH 1/1] module: initialize module dynamic debug later

From: Rusty Russell
Date: Tue Jun 15 2010 - 22:37:27 EST


On Wed, 16 Jun 2010 09:56:37 am Yehuda Sadeh wrote:
> We should initialize the module dynamic debug datastructures
> only after determining that the module is not loaded yet. This
> fixes a bug that introduced in 2.6.35-rc2, where when a trying
> to load a module twice, we also load it's dynamic printing data
> twice which causes all sorts of nasty issues. Also handle
> the dynamic debug cleanup later on failure.
>
> Signed-off-by: Yehuda Sadeh <yehuda@xxxxxxxxxxxxxxx>

Hi Yehuda,

Thanks for tracking this down. One minor comment:

> #if defined(CONFIG_DYNAMIC_DEBUG)
> -extern int ddebug_remove_module(char *mod_name);
> +extern int ddebug_remove_module(const char *mod_name);
>
> #define __dynamic_dbg_enabled(dd) ({ \
> int __ret = 0; \
> @@ -73,7 +73,7 @@ extern int ddebug_remove_module(char *mod_name);
>
> #else
>
> -static inline int ddebug_remove_module(char *mod)
> +static inline int ddebug_remove_module(const char *mod)
> {
> return 0;
> }

This implies we don't need the #ifdef here:

> +static void dynamic_debug_remove(struct _ddebug *debug)
> +{
> +#ifdef CONFIG_DYNAMIC_DEBUG
> + if (debug)
> + ddebug_remove_module(debug->modname);
> +#endif
> +}
> +

So I removed it. It'd be nice to have a similar wrapper in the header
for ddebug_add_module so we can avoid the #ifdef there too, but that's
a separate patch.

Applied!
Rusty.
--
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/