public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Jun Koi" <junkoi2004@gmail.com>
To: systemtap@sources.redhat.com
Subject: Improvement for post-handler only case in kprobes
Date: Sun, 29 Oct 2006 14:01:00 -0000	[thread overview]
Message-ID: <fdaac4d50610290601g572cbbb0k9764133bd9692283@mail.gmail.com> (raw)

Hello,

I am reviewing the code of kprobes, and have an idea. Is there any
case we need only post-handler for a probe, but not pre-handler? If
that is the case, i think it is possible to improve the performance in
the similar approach with kprobe-booster.

For the moment, if the probe has only post-handler, we need to switch
out 2 times:
1. When the probe is hit, we switch out with BreakPoint instruction.
The processor is the put into Single-step mode.
2. After single-step, we switch out again.

In case we only has post-handler (NOT pre-handler), we can eliminate
the single-mode step in the following way:
- Still put BreakPoint at the registered address.
- After the single-step, remove the old BreakPoint and put it at the
current EIP (this is the place we switch out with single-step). Next
time, we only need to handle the breakpoint, as it is hit right after
the "original" breakpoint. Hence we dont need to get into the
single-step mode any more. Of course this improves the performance.

Of course if we analyze the instruction at the original address when
registering the probe, we can find the next instruction. But with the
above scheme we dont need to do that, with the price of 1 single-step
for the first time the probe is hit.

Any comment? Is this worth implementing?

Regards,
Jun

             reply	other threads:[~2006-10-29 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29 14:01 Jun Koi [this message]
2006-10-30 23:36 Stone, Joshua I
2006-10-31  9:51 ` Jun Koi

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=fdaac4d50610290601g572cbbb0k9764133bd9692283@mail.gmail.com \
    --to=junkoi2004@gmail.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).