This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] Linux Kernel Markers
- From: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- To: karim at opersys dot com
- Cc: Martin Bligh <mbligh at google dot com>, prasanna at in dot ibm dot com, Andrew Morton <akpm at osdl dot org>, "Frank Ch. Eigler" <fche at redhat dot com>, Ingo Molnar <mingo at elte dot hu>, Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>, Paul Mundt <lethal at linux-sh dot org>, linux-kernel <linux-kernel at vger dot kernel dot org>, Jes Sorensen <jes at sgi dot com>, Tom Zanussi <zanussi at us dot ibm dot com>, Richard J Moore <richardj_moore at uk dot ibm dot com>, Michel Dagenais <michel dot dagenais at polymtl dot ca>, Christoph Hellwig <hch at infradead dot org>, Greg Kroah-Hartman <gregkh at suse dot de>, Thomas Gleixner <tglx at linutronix dot de>, William Cohen <wcohen at redhat dot com>, ltt-dev at shafik dot org, systemtap at sources dot redhat dot com, Alan Cox <alan at lxorguk dot ukuu dot org dot uk>
- Date: Wed, 20 Sep 2006 22:27:13 +0900
- Subject: Re: [PATCH] Linux Kernel Markers
- Organization: Systems Development Lab., Hitachi, Ltd., Japan
- References: <20060918234502.GA197@Krystal> <20060919081124.GA30394@elte.hu> <451008AC.6030006@google.com> <20060919154612.GU3951@redhat.com> <4510151B.5070304@google.com> <20060919093935.4ddcefc3.akpm@osdl.org> <45101DBA.7000901@google.com> <20060919063821.GB23836@in.ibm.com> <45102641.7000101@google.com> <20060919070516.GD23836@in.ibm.com> <451030A6.6040801@google.com> <45105B5E.9080107@opersys.com>
Hi Karim,
Karim Yaghmour wrote:
> Martin Bligh wrote:
>> be that many? Still doesn't fix the problem Matieu just pointed
>> out though. Humpf.
>
> There's one possibility if we're willing to insert a placeholder
> at function entry that allows to essentially do what Andrew
> suggests without much impact. Specifically, if you need a 5-byte
> operation to jump to the alternate instrumented function, you
> can then do something like:
This method is very similar to the djprobe.
And I had gotten the same idea to support preemptive kernel.
> 1- At build time insert 5-byte unconditional jump to instruction
> right after placeholder.
This means the below code, doesn't this?
---
jmp 1f /* short jump consumes 2 bytes */
nop
nop
nop
1:
---
> 2- At runtime for diverting flow:
> - Replace first byte with int3 (atomically)
> - Replace next 4 bytes with instrumented function destination
- Serialize all processor's cache by using IPI and cpuid.
> - Replace first byte
> 3- At runtime for returning flow:
> - Do #2 but for the original placeholder jump.
I think the djprobe can provide most of functionalities which
your idea requires.
I'll update the djprobe against for 2.6.17 or later as soon as
possible. Would you try to use it?
Thanks,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com