Re: [PATCH 08/12] add trace events for each syscall entry/exit

From: Mathieu Desnoyers
Date: Wed Aug 26 2009 - 15:01:20 EST


* Christoph Hellwig (hch@xxxxxxxxxxxxx) wrote:
> On Wed, Aug 26, 2009 at 02:41:16PM -0400, Christoph Hellwig wrote:
> > We do not support system calls from kernelspace anymore. All the
> > macros to do real system calls are gone, and there are very very few
> > places left calling sys_foo as normal function calls.
> >
> > An how exactly is calling sys_foo as a normal function call different
> > from calling do_foo or vfs_foo?
>

Not very different, no. But the fact is that we would not be
instrumenting do_foo nor vfs_foo because we would somehow expect all
callers to go through a system call, which ain't always true.

> And if you really need to trace direct callers of sys_foo just put
> a jprobe on it.
>

Yep, that would do it. Getting the arguments of the function upon entry
and the return value on exit is pretty much all we need.

But I would like to ensure that we do not duplicate the instrumentation
done by the generic syscall instrumentation neither, so we don't end up
having:

syscall_entry X (args)
do_X (args)
do_X return (return value)
syscall_exit X (return value)

If I am not mistakened, the current execution paths are:

>From userland:

syscall -> sys_X() -> do_X()

>From the kernel:

do_X()

Adding a trampoline taken only when the kernel is doing the call might
be useful there to selectively trace calls made by the kernel.

Mathieu

--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/