This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] gcc feature request: Moving blocks into sections
- From: Steven Rostedt <rostedt at goodmis dot org>
- To: Linus Torvalds <torvalds at linux-foundation dot org>
- Cc: LKML <linux-kernel at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>, Ingo Molnar <mingo at kernel dot org>, Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>, "H. Peter Anvin" <hpa at linux dot intel dot com>, Thomas Gleixner <tglx at linutronix dot de>, David Daney <ddaney dot cavm at gmail dot com>, Behan Webster <behanw at converseincode dot com>, Peter Zijlstra <peterz at infradead dot org>, Herbert Xu <herbert at gondor dot apana dot org dot au>
- Date: Mon, 05 Aug 2013 15:04:29 -0400
- Subject: Re: [RFC] gcc feature request: Moving blocks into sections
- References: <1375721715 dot 22073 dot 80 dot camel at gandalf dot local dot home> <CA+55aFw_o=D-j_SRn=Y4LhHm-tEyuP1Je5ZHVTYxbVyLyDcLEg at mail dot gmail dot com> <1375725328 dot 22073 dot 101 dot camel at gandalf dot local dot home> <CA+55aFwRHpL-3YObZfw6NxxDxMqQbiwp0=NnpotGj2RHDNF3iw at mail dot gmail dot com> <CA+55aFw=OX3Zz_PJc7NUGwFLAE1RYUsPe9Dn8qHDN0nZeW2R5A at mail dot gmail dot com> <CA+55aFyzmGzv3C9gy5Xi=pSmAOzpYMNAqrrrZmsvNbt4LdrorQ at mail dot gmail dot com>
On Mon, 2013-08-05 at 11:34 -0700, Linus Torvalds wrote:
> On Mon, Aug 5, 2013 at 11:24 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > Ugh. I can see the attraction of your section thing for that case, I
> > just get the feeling that we should be able to do better somehow.
>
> Hmm.. Quite frankly, Steven, for your use case I think you actually
> want the C goto *labels* associated with a section. Which sounds like
> it might be a cleaner syntax than making it about the basic block
> anyway.
I would love to. But IIRC, the asm_goto() has some strict constraints.
We may be able to jump to a different section, but we have no way of
coming back. Not to mention, you must tell the asm goto() what label you
may be jumping to.
I don't know how safe something like this may be:
static inline trace_sched_switch(prev, next)
{
asm goto("jmp foo1\n" : : foo2);
foo1:
return;
asm goto(".pushsection\n"
"section \".foo\"\n");
foo2:
__trace_sched_switch(prev, next);
asm goto("jmp foo1"
".popsection\n" : : foo1);
}
The above looks too fragile for my taste. I'm afraid gcc will move stuff
out of those "asm goto" locations, and make things just fail. But I can
play with this, but I don't like it.
-- Steve