public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Avishay Traeger <atraeger@cs.sunysb.edu>
Cc: prasanna@in.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: KPROBES: Instrumenting a function's call site
Date: Wed, 26 Sep 2007 22:57:21 +0530	[thread overview]
Message-ID: <20070926172721.GA6598@in.ibm.com> (raw)
In-Reply-To: <1190822975.3940.17.camel@localhost>

On Wed, Sep 26, 2007 at 12:09:35PM -0400, Avishay Traeger wrote:
> On Wed, 2007-09-26 at 14:33 +0530, Ananth N Mavinakayanahalli wrote:
> > What happens when the "call" is singlestepped is that the instruction
> > pointer is moved to the call target. That explains the lower latency you
> > are seeing. You'll need to do something along the lines I suggested in
> > the earlier mail.
> 
> Can you please explain what you mean by this more clearly?  I'm not a
> kprobes expert yet.  Specifically, using kprobes the way that I did,
> what will the resulting code look like?  Also, what do you mean by
> "singlestepped"?

If you single-step (regs->eflags | TF_MASK in i386) on a call instruction,
you'll end up at the call target; ie., after the post_kprobe_handler()
returns, the instruction pointer will point to the first instruction
of foo().

Try printk()ing the instruction pointer(regs) after resume_execution()
in the post_kprobe_handler() in your arch/<arch>/kernel/kprobes.c, you'll
see what I mean.

And when I say singlestepped, I mean executing one instruction under the
architecture specific single step enable flag - the "trap" flag for i386,
the MSR_SE for powerpc, etc. Evidently, this'll mean single-stepping a
single instruction.

Ananth

  reply	other threads:[~2007-09-26 17:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 22:12 KPROBES: Instrumenting a function's call site Avishay Traeger
2007-09-26  4:39 ` Ananth N Mavinakayanahalli
2007-09-26  9:03   ` Ananth N Mavinakayanahalli
2007-09-26 16:09     ` Avishay Traeger
2007-09-26 17:27       ` Ananth N Mavinakayanahalli [this message]
2007-09-26 17:35         ` Avishay Traeger
2007-09-26 16:52   ` Abhishek Sagar
2007-09-26 17:28   ` Keshavamurthy, Anil S
2007-09-26 17:37     ` Avishay Traeger
2007-11-08 19:42   ` Avishay Traeger
2007-11-12 10:27     ` Ananth N Mavinakayanahalli
2007-09-26 16:37 ` Abhishek Sagar

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=20070926172721.GA6598@in.ibm.com \
    --to=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=atraeger@cs.sunysb.edu \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.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