function-exit probes += ppc64

William Cohen wcohen@redhat.com
Fri Feb 25 15:26:00 GMT 2005


Chen, Brad wrote:
> Can somebody in the know comment on the use of tail call
> removal and inlining in the kernel? Is it common or rare?
> If it is common, this approach won't work very well. It
> will certainly tend to become more common if kernel builds
> get more and more optimized over time.

Inline functions are common in the kernel. They are used instead of 
macros. Inlined functions do not make functions calls, so they will not 
affect this implementation of function return instrumentation.

I don't know how often the tail call optimization is used in the kernel.

There are some functions where there is no return, e.g. panic(). These 
functions have NORET_TYPE. There appear to be relatively few in the 2.6 
kernel. From the look of them there isn't going to be a reason to 
instrument them.

[wcohen@slingshot linux-2.6.10-1.1143_FC4]$ find -path "*.c" -exec grep 
"NORET_TYPE" {} /dev/null \;
./arch/arm/kernel/traps.c:NORET_TYPE void die(const char *str, struct 
pt_regs *regs, int err)
./arch/ppc/amiga/config.c:static NORET_TYPE void amiga_reset( void )
./arch/mips/kernel/traps.c:NORET_TYPE void __die(const char * str, 
struct pt_regs * regs,
./arch/arm26/kernel/traps.c:NORET_TYPE void die(const char *str, struct 
pt_regs *regs, int err)
./arch/m68k/amiga/config.c:static NORET_TYPE void amiga_reset( void )
./kernel/exit.c:fastcall NORET_TYPE void do_exit(long code)
./kernel/exit.c:NORET_TYPE void complete_and_exit(struct completion 
*comp, long code)
./kernel/exit.c:NORET_TYPE void
./kernel/panic.c:NORET_TYPE void panic(const char * fmt, ...)


> Are there any analogs to setjmp/longjmp or exception
> handling that we would have to deal with? These use
> the return address in user level code but maybe they
> aren't problems in the kernel.

Another trick that could trip things up in userspace for x86 is that for 
  code in shared libraries one often see a call to the following 
instruction to obtain the current pc address and use that of pic code.

-Will



More information about the Systemtap mailing list