[RFC patch 00/20] Kernel tracing thread flag

Mathieu Desnoyers
2009-05-09T16:52:54Z

This is the generalisation of the TIF_SYSCALL_FTRACE thread flag for :

- multiple tracers (even accessible from modules)
- multiple architectures

It includes :

- Addition of the TIF_KERNEL_TRACE for all Linux architectures.
- Modification of some architecture entry*.S files to ensure that the thread
flag is re-read upon syscall exit to ensure that syscall exit is traced.
Basically, what I try to achieve here is to make sure that given the following
sequence will get its syscall exit event traced :

- Thread preempted in a system call
- Activation of all TIF_KERNEL_TRACE thread flags
- ...enough time passes to expect that all tracing sites are activated...
- syscall exit -> expected to be traced

But if the thread flags used at syscall exit are the same that has been read at
syscall entry, the event will be skipped. This does not permit reaching a known
"quiescent state" where we know that all tracing sites are activated.

Note that having non-perfectly matched syscall trace entry/exit may have
implications wrt getname/putname refcounting for instance, and could cause
problems if getname/putname was used in the syscall entry/exit pairs. We will
have to deal with this somehow when we face this problem. Keeping a per-thread
flag saying that a matching syscall_entry tracing has been executed could fix
this problem. We could even re-use TIF_SYSCALL_FTRACE for this specific purpose.

Mathieu