This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Model-Specific Register


Hi,

On Tue, Oct 10, 2006 at 03:46:29PM -0400, Frank Ch. Eigler wrote:
> >    Beside that, I would like to measure (count) the number of branches (call,
> >    jmp, jcc, loop) executed so far by a given process while it's executing in
> >    user space. Do you think MSR (in particular) branch_retired register could
> >    be useful for what I'm trying to do?
> 
> Certainly.  Systemtap proper does not expose those registers yet, but
> using e.g.  inline C code, it should be able to pull out such
> information.

   Cool. Any ideas (all the list, I mean :-)) on how to do it "from scratch"?
   Never played with MSR at all.

> >    Moreover, I would like to save this register (or a combo of
> >    registers) into the process task_struct since I would like to
> >    keep this counter accross processes' context switch [...]
> 
> Check out the perfmon2 patches for the kernel.  Among other things, they
> do this sort of context switch tracking.

   Fine, thx! I'll check it out ASAP. :-)

> >    As a complication, I would like to instrument at run-time a
> >    process behavior by means of ptrace system call, so I think some
> >    modification to that part of kernel code have to be done as well
> >    [...]
> 
> ptrace is a way of performing low-level manipulation of a user-space
> program's code/data from another user-space program.  Why do you
> suspect kernel patches are needed?

   Because I would like to save that MSR counter accross processes
   context-switch but I also would like to get this info while tracing such
   processes.  
   
   Right now, I'm tracing in user space using ptrace; it's easier to develop
   and to debug even if you have to resort to some kind of tricks in certain
   situation because you're in user space after all (even if I think ptrace it's
   pretty powerful on Linux kernel compared to other *nix systems). 

   Since so far ptrace doesn't give you this info (there is no such info) I
   probably need to modify its kernel implementation to provide what I need in
   user space.

   Ah, btw, performances doesn't matter to me, right now.  
   
TIA, bye
Lorenzo

-- 
Lorenzo `Gigi Sullivan' Cavallaro <sullivan@security.dico.unimi.it>
GPG key at http://security.dico.unimi.it/~sullivan/sullivan.asc

Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)

See the reality in your eyes, when the hate makes you blind. (A.H.X)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]