From: Steven Rostedt <rostedt@goodmis.org>
To: Jason Baron <jbaron@redhat.com>
Cc: peterz@infradead.org, hpa@zytor.com,
mathieu.desnoyers@polymtl.ca, mingo@elte.hu, tglx@linutronix.de,
andi@firstfloor.org, roland@redhat.com, rth@redhat.com,
masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
avi@redhat.com, davem@davemloft.net, sam@ravnborg.org,
ddaney@caviumnetworks.com, michael@ellerman.id.au,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] jump label: introduce static_branch() interface
Date: Wed, 23 Feb 2011 10:40:28 -0500 [thread overview]
Message-ID: <1298475628.7666.88.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <201102222228.p1MMSxnT016454@int-mx10.intmail.prod.int.phx2.redhat.com>
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)
>
next prev parent reply other threads:[~2011-02-23 15:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 22:28 Jason Baron
2011-02-22 23:12 ` Andi Kleen
2011-02-23 10:08 ` Peter Zijlstra
2011-02-23 10:11 ` Peter Zijlstra
2011-02-23 13:45 ` Steven Rostedt
2011-02-23 15:48 ` Jason Baron
2011-02-23 15:40 ` Steven Rostedt [this message]
2011-02-23 15:42 ` Peter Zijlstra
2011-02-23 17:12 ` David Daney
2011-03-01 15:28 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1298475628.7666.88.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=davem@davemloft.net \
--cc=ddaney@caviumnetworks.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=michael@ellerman.id.au \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=roland@redhat.com \
--cc=rth@redhat.com \
--cc=sam@ravnborg.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®