linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: richardj_moore@uk.ibm.com
To: Andreas Dilger <adilger@turbolinux.com>
Cc: "Collins, Tom" <Tom.Collins@surgient.com>, linux-kernel@vger.kernel.org
Subject: Re: Dynamically altering code segments
Date: Tue, 27 Feb 2001 18:15:07 +0000	[thread overview]
Message-ID: <80256A00.006458FC.00@d06mta06.portsmouth.uk.ibm.com> (raw)



Dprobes is one mechanism for doing what you want. It works the same way
OS/2 dynamic trace did. Another mecnahism, also available from the dprobes
web page is the GKHI (generalised kernel hooks interface). If you know you
want tracepoints in permanently assigned locations then you could code a
gkhi hook in the kernel which is essentially two jmps. When the hook is
inactive the first jmp bypasses the second, which jumps to the hook exit
dispatcher routine. When active the first jmp uses a zero offset. If you
use the gkhi you'll need to write you own hook exits, which presumably will
trace data and drop it into a trace buffer of your own making. Again if you
do decide to use ghki, please wait for 1.0 to be dropped next week
sometime.

If you go down the dprobes route you'll see that it inter-operates with
Linux Trace Toolkit to give you a dynamic tracing capability for Linux
(user and kernel space).  We're currently working on custom formatting for
raw trace data events created by dprobes. If you're familiar with os/2 then
TRCUST might mean something to you in connection with custom formatting.


Richard Moore -  RAS Project Lead - Linux Technology Centre (PISC).

http://oss.software.ibm.com/developerworks/opensource/linux
Office: (+44) (0)1962-817072, Mobile: (+44) (0)7768-298183
IBM UK Ltd,  MP135 Galileo Centre, Hursley Park, Winchester, SO21 2JN, UK


Andreas Dilger <adilger@turbolinux.com> on 27/02/2001 17:05:37

Please respond to Andreas Dilger <adilger@turbolinux.com>

To:   "Collins, Tom" <Tom.Collins@surgient.com>
cc:   linux-kernel@vger.kernel.org
Subject:  Re: Dynamically altering code segments




Tom Collins writes:
> I am wanting to dynamically modify the kernel in specific places to
> implement a custom kernel trace mechanism.  The general idea is that,
> when the "trace" is off, there are NOP instruction sequences at various
> places in the kernel.  When the "trace" is turned on, those same NOPs
> are replaced by JMPs to code that implements the trace (such as logging
> events, using the MSR and PMC's etc..).
>
> This was a trick that was done in my old days of OS/2 performance tools
> developement to get trace information from the running kernel.
>
> Is it possible to do the same thing in Linux?

See IBM "dprobes" project.  It is basically what you are describing
(AFAIK).  It makes sense, because a lot of the OS/2 folks are now working
on Linux.

Cheers, Andreas
--
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/




             reply	other threads:[~2001-02-27 18:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-27 18:15 richardj_moore [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-01  2:58 Dynamically altering code segments Jeremy Jackson
2001-02-27 19:04 Collins, Tom
2001-02-28  1:22 ` Karim Yaghmour
2001-02-27 16:43 Collins, Tom
2001-02-27 17:05 ` Andreas Dilger

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=80256A00.006458FC.00@d06mta06.portsmouth.uk.ibm.com \
    --to=richardj_moore@uk.ibm.com \
    --cc=Tom.Collins@surgient.com \
    --cc=adilger@turbolinux.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 NNTP newsgroup(s).