[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <y0m1w22qxoj.fsf@ton.toronto.redhat.com>
Date: Wed, 09 Jul 2008 22:29:16 -0400
From: fche@...hat.com (Frank Ch. Eigler)
To: James Bottomley <James.Bottomley@...senPartnership.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
systemtap@...rceware.org
Subject: Re: [RFC] simple dprobe like markers for the kernel
James Bottomley <James.Bottomley@...senPartnership.com> writes:
> I've been looking at using the existing in kernel markers for dtrace
> named probing in systemtap. What I find is that they're a bit
> heavyweight when compared to what dtrace does (because of the way
> they drop stubbable calling points).
> This patch adds incredibly simple markers which are designed to be used
> via kprobes [+ dwarf]. [...]
> [...] The disadvantage is that it's really unusable for rolling
> your own marker probes because it relies on the dwarf2 information
> to locate the probe point for kprobes and unravel the local
> variables of interest, so you need an external tool like systemtap
> to help you. [...]
Another disadvantage is one that came up earlier when markers were
initially thought up: that something so invisible to the compiler (no
code being generated in the instruction stream, after optimization,
may be impossible to locate: not just the statement but also the
putative parameters.
Long ago, someone proposed inserting an asm("nop") mini-markers into
the instruction stream, which could then be used as an anchor to tie a
kprobe to, so that would solve the statement-location problem.
But it doesn't help assure that the parameters will be available in
dwarf, so someone else proposed adding another asm that just asks the
parameters to be evaluated and placed *somewhere*. Each asm input
constraint was to be the loosest possible, so as to not force the
compiler to put the values into registers (and evict their normal
tracing-ignorant tenants).
I believe this combination was never actually built/tested, partly
because people realized that then the compiler would always have to
evaluate parameters unconditionally, whether or not a kprobe is
present. (To do it otherwise would IIRC require the asm code to
include control-flow-modification instructions, which would surprise
gcc.)
So that's roughly how we arrived at recent markers. They expose to
the compiler the parameters, but arrange not to evaluate them unless
necessary. The most recent markers code patches nops over most or all
the hot path instructions, so there is no tangible performance impact.
- FChE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists