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: Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>
- To: Steven Rostedt <rostedt at goodmis dot org>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, Linus Torvalds <torvalds at linux-foundation dot org>, LKML <linux-kernel at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>, Ingo Molnar <mingo at kernel dot org>, "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: Wed, 7 Aug 2013 12:03:36 -0400
- Subject: Re: [RFC] gcc feature request: Moving blocks into sections
- References: <CA+55aFyfvifCu=jDBH8LPmEHtvooVyo25dvJ+T6SQLhVidBBdQ at mail dot gmail dot com> <1375798783 dot 25420 dot 30 dot camel at gandalf dot local dot home> <CA+55aFwKYSwytooG50fyryWpVdGEk_v=vdB=L-kAyLmmSW=bkQ at mail dot gmail dot com> <1375811885 dot 25420 dot 44 dot camel at gandalf dot local dot home> <20130806203319 dot GA16170 at Krystal> <1375821817 dot 25420 dot 50 dot camel at gandalf dot local dot home> <1375836304 dot 25420 dot 76 dot camel at gandalf dot local dot home> <1375836960 dot 25420 dot 80 dot camel at gandalf dot local dot home> <20130807050601 dot GA5385 at domone dot kolej dot mff dot cuni dot cz> <1375887730 dot 6848 dot 7 dot camel at gandalf dot local dot home>
* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Wed, 2013-08-07 at 07:06 +0200, OndÅej BÃlka wrote:
>
> > Add short_counter,long_counter and before increment counter before each
> > jump. That way we will know how many short/long jumps were taken.
>
> That's not trivial at all. The jump is a single location (in an asm
> goto() statement) that happens to be inlined through out the kernel. The
> assembler decides if it will be a short or long jump. How do you add a
> counter to count the difference?
You might want to try creating a global array of counters (accessible
both from C for printout and assembly for update).
Index the array from assembly using: (2f - 1f)
1:
jmp ...;
2:
And put an atomic increment of the counter. This increment instruction
should be located prior to the jmp for obvious reasons.
You'll end up with the sums you're looking for at indexes 2 and 5 of the
array.
Thanks,
Mathieu
>
> The output I gave is from the boot up code that converts the jmp back to
> a nop (or in this case, the default nop to the ideal nop). It knows the
> size by reading the op code. This is a static analysis, not a running
> one. It's no trivial task to have a counter for each jump.
>
> There is a way though. If we enable all the jumps (all tracepoints, and
> other users of jumplabel), record the trace and then compare the trace
> to the output that shows which ones were short jumps, and all others are
> long jumps.
>
> I'll post the patches soon and you can have fun doing the compare :-)
>
> Actually, I'm working on the 4 patches of the series that is more about
> clean ups and safety checks than the jmp conversion. That is not
> controversial, and I'll be posting them for 3.12 soon.
>
> After that, I'll post the updated patches that have the conversion as
> well as the counter, for RFC and for others to play with.
>
> -- Steve
>
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com