[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1290557416.30543.420.camel@gandalf.stny.rr.com>
Date: Tue, 23 Nov 2010 19:10:16 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Jason Baron <jbaron@...hat.com>, mingo@...e.hu,
peterz@...radead.org, mathieu.desnoyers@...ymtl.ca,
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 0/3] jump label: updates for 2.6.37
On Tue, 2010-11-23 at 15:32 -0800, H. Peter Anvin wrote:
> On 11/23/2010 03:11 PM, Steven Rostedt wrote:
> >> I would also like to see a change in the API, preferrably something
> >> closer to the "SWITCH_POINT" interface I discussed with Stephen before
> >> Kernel Summit.
> >
> > Could you explain in more detail what you would like to see.
>
> The JUMP_LABEL() macro is rather ugly, and I found from the
> static_cpu_has() work that inlines like (somewhat pseudocode here):
>
> static inline bool SWITCH_POINT(void *metadata)
> {
> asm goto("1: <5 byte nop>\n"
> ".section \".metadata\",\"a\"\n"
> ".long 1b, %p0\n"
> ".previous\n"
> : : "i" (metadata)
> : : l_yes);
> return false;
> l_yes:
> return true;
> }
>
> ... work quite well; with the resulting SWITCH_POINT() being usable like
> any other boolean expression in the kernel, i.e. as part of if, while,
> etc. Most of the time, gcc is smart enough to just use the flow of
> control provided, and it also permits backwards compatibility with older
> gcc by patching in a one-byte immediate instead.
>
> There are some instances where it double-jumps; those can be avoided by
> always jumping (allowing the patch code to replace the jump with a
> 5-byte NOP opportunistically a posteori) but unfortunately current gcc
> tends to not order the sequentially next code afterwards if one does that.
>
So you would rather have it as an if statement? Something like this:
if (unlikely(JUMP_LABEL(key)))
__DO_TRACE(....);
(Note, I like the above better too)
-- Steve
--
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