[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1298475628.7666.88.camel@gandalf.stny.rr.com>
Date: Wed, 23 Feb 2011 10:40:28 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Jason Baron <jbaron@...hat.com>
Cc: peterz@...radead.org, hpa@...or.com, mathieu.desnoyers@...ymtl.ca,
mingo@...e.hu, tglx@...utronix.de, andi@...stfloor.org,
roland@...hat.com, rth@...hat.com, masami.hiramatsu.pt@...achi.com,
fweisbec@...il.com, avi@...hat.com, davem@...emloft.net,
sam@...nborg.org, ddaney@...iumnetworks.com,
michael@...erman.id.au, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] jump label: introduce static_branch() interface
On Tue, 2011-02-22 at 17:28 -0500, Jason Baron wrote:
> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index 1c70028..7e51b6f 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -1,14 +1,9 @@
> #ifndef _DYNAMIC_DEBUG_H
> #define _DYNAMIC_DEBUG_H
>
> +#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
> #include <linux/jump_label.h>
> -
> -/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
> - * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
> - * use independent hash functions, to reduce the chance of false positives.
> - */
> -extern long long dynamic_debug_enabled;
> -extern long long dynamic_debug_enabled2;
> +#endif
>
> /*
> * An instance of this structure is created in a special
> @@ -33,7 +28,11 @@ struct _ddebug {
> #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
> #define _DPRINTK_FLAGS_DEFAULT 0
> unsigned int flags:8;
> - char enabled;
> +#ifdef HAVE_JUMP_LABEL
Shouldn't this be CONFIG_JUMP_LABEL?
> + struct jump_label_key enabled;
> +#else
> + int enabled;
> +#endif
> } __attribute__((aligned(8)));
>
>
> @@ -43,14 +42,22 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
> #if defined(CONFIG_DYNAMIC_DEBUG)
> extern int ddebug_remove_module(const char *mod_name);
>
> +#ifdef HAVE_JUMP_LABEL
Here too?
-- Steve
> +# define DDEBUG_INIT { JUMP_LABEL_INIT }
> +# define DDEBUG_BRANCH(enabled) static_branch(&enabled)
> +#else
> +# define DDEBUG_INIT 0
> +# define DDEBUG_BRANCH(enabled) unlikely(enabled)
> +#endif
> +
> #define dynamic_pr_debug(fmt, ...) do { \
> static struct _ddebug descriptor \
> __used \
> __attribute__((section("__verbose"), aligned(8))) = \
> { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
> - _DPRINTK_FLAGS_DEFAULT }; \
> - if (unlikely(descriptor.enabled)) \
> - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
> + _DPRINTK_FLAGS_DEFAULT, DDEBUG_INIT }; \
> + if (DDEBUG_BRANCH(descriptor.enabled)) \
> + printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
> } while (0)
>
>
> @@ -59,9 +66,9 @@ extern int ddebug_remove_module(const char *mod_name);
> __used \
> __attribute__((section("__verbose"), aligned(8))) = \
> { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
> - _DPRINTK_FLAGS_DEFAULT }; \
> - if (unlikely(descriptor.enabled)) \
> - dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
> + _DPRINTK_FLAGS_DEFAULT, DDEBUG_INIT }; \
> + if (DDEBUG_BRANCH(descriptor.enabled)) \
> + dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
> } while (0)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists