public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: "Masami Hiramatsu" <mhiramat@redhat.com>,
		"Ananth N Mavinakayanahalli" <ananth@in.ibm.com>,
		"Jim Keniston" <jkenisto@us.ibm.com>,
		"Li, Shaohua" <shaohua.li@intel.com>
Cc: "LKML" <linux-kernel@vger.kernel.org>,
		"ia64" <linux-ia64@vger.kernel.org>,
		"systemtap-ml" <systemtap@sources.redhat.com>
Subject: RE: [RFC][PATCH] kprobes: kprobe-booster for ia64
Date: Tue, 05 Feb 2008 23:35:00 -0000	[thread overview]
Message-ID: <1FE6DD409037234FAB833C420AA843EC84804C@orsmsx424.amr.corp.intel.com> (raw)
In-Reply-To: <47A8E995.1090400@redhat.com>

+/* Insert a long branch code */
+static void __kprobes set_brl_inst(void *from, void *to)
+{
+	s64 rel = ((s64) to - (s64) from) >> 4;
+	bundle_t *brl;
+	brl = (bundle_t *) ((u64) from & ~0xf);
+	brl->quad0.template = 0x05;	/* [MLX](stop) */
+	brl->quad0.slot0 = NOP_M_INST;	/* nop.m 0x0 */
+	brl->quad0.slot1_p0 = ((rel >> 20) & 0x7fffffffff) << 2;
+	brl->quad1.slot1_p1 = (((rel >> 20) & 0x7fffffffff) << 2) >> (64 - 46);
+	/* brl.cond.sptk.many.clr rel<<4 (qp=0) */
+	brl->quad1.slot2 = BRL_INST(rel >> 59, rel & 0xfffff);
+}

Is this function operating directly on the instruction bundle in the
kernel code?  If so, the bundle will contain some "interesting"
intermediate values as each of the "brl->xxx = yyy;" are processed.
If another cpu should try to execute this bundle while the modifications
are in progress, then the results will be not what you want.

On cpu models that support st16 you could construct the brl instruction
and use a single st16 to update the whole bundle atomically.

-Tony

  reply	other threads:[~2008-02-05 23:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 22:57 Masami Hiramatsu
2008-02-05 23:35 ` Luck, Tony [this message]
2008-02-06 12:52   ` Masami Hiramatsu

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=1FE6DD409037234FAB833C420AA843EC84804C@orsmsx424.amr.corp.intel.com \
    --to=tony.luck@intel.com \
    --cc=ananth@in.ibm.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=shaohua.li@intel.com \
    --cc=systemtap@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).