From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Martin Bligh <mbligh@google.com>,
"Frank Ch. Eigler" <fche@redhat.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
prasanna@in.ibm.com, Andrew Morton <akpm@osdl.org>,
Ingo Molnar <mingo@elte.hu>, Paul Mundt <lethal@linux-sh.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jes Sorensen <jes@sgi.com>, Tom Zanussi <zanussi@us.ibm.com>,
Richard J Moore <richardj_moore@uk.ibm.com>,
Michel Dagenais <michel.dagenais@polymtl.ca>,
Christoph Hellwig <hch@infradead.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Thomas Gleixner <tglx@linutronix.de>,
William Cohen <wcohen@redhat.com>,
ltt-dev@shafik.org, systemtap@sources.redhat.com,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] Linux Markers 0.4 (+dynamic probe loader) for 2.6.17
Date: Thu, 21 Sep 2006 00:17:17 -0700 [thread overview]
Message-ID: <45123C7D.3080309@goop.org> (raw)
In-Reply-To: <20060921015840.GB13504@Krystal>
Mathieu Desnoyers wrote:
> Yup, good catch. I have not seen gcc removing this asm in my objdump however, by
> I guess we cannot be sure. This MARK_SYM() is only useful for kprobe
> insertion : I don't use it myself for the jump markup stuff. I don't know how
> relevant it is for kprobes users for the symbol to be at a specific location,
> as they don't know themself what data they are interested in and they simply
> don't want to modify the instruction stream. I fact, if the asm volatile
> modifies the instruction stream, it would be an unwanted side-effect :(
>
"asm volatile" isn't documented to do anything other than prevent the
asm from being removed altogether. It doesn't prevent it from being
moved elsewhere, and it doesn't imply any ordering dependency with the
code around it. So I don't think it will change the generated code, but
I also don't think it will be all that useful unless there's something
to actually make sure it's in a particular place - and that may change
codegen because it may force the compiler to not eliminate/reorder/move
the point at which you want the label.
Something like this might do it:
#define MARK_SYM(label) \
do { \
__label__ here; \
here: asm volatile(#label " = %0" : : "m" (*&&here)); \
} while(0)
This at least gives the compiler a C-level label to hang the asm from.
> It doesn't matter :) You are absolutely right, they can get reordered, and the
> fact is : we don't care. The function above sets the *target_mark_call before
> the *target_mark_jump_over, so that the function pointer is set up before the
> jump can call it. But imagine the inverse : the will be able to the function
> call before the function call handler is set up. It really doesn't matter
> because the function pointer is always pointing to a valid function : either the
> "empty" default function or the inserted one.
>
Does the local indirect jump really help? Wouldn't you do just as well
with the call? It's a jump out of line, but if it points to the null
function, it's likely to be in cache, and reducing the number of
indirect targets within a few instructions will help the CPU keep its
branch target prediction in order (modern Intel chips don't like having
too many indirect jumps within a cache line, for example).
It's a pity you can't make these all direct jumps; I guess patching the
instruction stream on an SMP system on the fly is too tricky...
(Though on x86 you could do something like make the default case 5 bytes
of nops. Then to patch it, you could patch in an int3 on the first
byte, put the relative address in the other 4 bytes, then patch the int3
back to the call/jump. The int3 handler would look to see if the fault
address is a kernel hook point, and if so, spin waiting for the *eip to
go to a call/jump, then resume the instruction.)
J
next prev parent reply other threads:[~2006-09-21 7:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-20 23:45 [PATCH] Linux Markers 0.4 (+dynamic probe loader) for 2.6.17 Mathieu Desnoyers
2006-09-21 0:13 ` Jeremy Fitzhardinge
2006-09-21 1:58 ` Mathieu Desnoyers
2006-09-21 7:17 ` Jeremy Fitzhardinge [this message]
2006-09-21 14:46 ` Mathieu Desnoyers
2006-09-21 4:46 ` Ingo Molnar
2006-09-21 12:26 ` Roman Zippel
2006-09-21 6:54 ` Richard J Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45123C7D.3080309@goop.org \
--to=jeremy@goop.org \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=fche@redhat.com \
--cc=gregkh@suse.de \
--cc=hch@infradead.org \
--cc=jes@sgi.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@shafik.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mbligh@google.com \
--cc=michel.dagenais@polymtl.ca \
--cc=mingo@elte.hu \
--cc=prasanna@in.ibm.com \
--cc=richardj_moore@uk.ibm.com \
--cc=systemtap@sources.redhat.com \
--cc=tglx@linutronix.de \
--cc=wcohen@redhat.com \
--cc=zanussi@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox