This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Instrumenting context-switching
- From: Perry Cheng <perryche at us dot ibm dot com>
- To: systemtap at sources dot redhat dot com
- Date: Wed, 31 Oct 2007 09:42:12 -0400
- Subject: Instrumenting context-switching
Instrumenting the context switch code has long been delicate. I can't
seem to find any help on this particular topic on the wiki (specifically,
the examples).
In the past, following some hints from old docs and mailing list, it has
been enough to instrument the __switch_to method to get the prev and next
tasks. The method one level higher is switch_to which, being a macro, is
not instrumentable. Lately, I've switched from an older i386 kernel to a
new x86_64 kernel and now __switch_to no longer is instrumentable with
kprobes. The higher-level context_switch itself does not seem probe-able
because it is a static inline method. Even higherup, we have the call to
context_switch from schedule but instrumenting that would require using a
specific line number which seems rather fragile because of greater
reliance of debugging code and susceptibility to kernel code change.
So, on an x86_64 kernel, how do I instrument this method?
Perry