qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 0/6] hypertrace: Lightweight guest-to-QEMU trace


From: Lluís Vilanova
Subject: Re: [Qemu-devel] [PATCH 0/6] hypertrace: Lightweight guest-to-QEMU trace channel
Date: Mon, 29 Aug 2016 20:46:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Hajnoczi writes:

> On Wed, Aug 24, 2016 at 12:25:54PM +0200, Lluís Vilanova wrote:
>> Stefan Hajnoczi writes:
>> 
>> > On Sun, Aug 21, 2016 at 02:32:34PM +0200, Lluís Vilanova wrote:
>> >> Unfortuntely, I've been unable to to make dtrace recognise QEMU's events 
>> >> (I'm
>> >> only able to see the host kernel events). If someone with more experience 
>> >> on it
>> >> can help me use dtrace with QEMU's events, I'll also add the supporting 
>> >> library
>> >> to let dtrace do the callout to QEMU's moitor interface and control the 
>> >> events,
>> >> and add a prperly useful example of that on the hypertrace docs (which 
>> >> was my
>> >> original intention).
>> 
>> > Which "dtrace" and host OS are you using?
>> 
>> > QEMU builds with static user-space probes.  You need to tell DTrace or
>> > SystemTap to enable those probes in order to record trace data.
>> 
>> I'm using debian on a 4.6.0-1-amd64 kernel with systemtap 3.0.6.
>> 
>> I just gave it another try, and works if I use probes like:
>> 
>> process("<binary-path>").mark("<event-name>")
>> 
>> although they don't seem to appear on "stap -l" or anything like that (I 
>> cannot
>> find a "qemu" provider). But I'm still unable to print the event values. 
>> This:

> The following enumerates events for me:

> $ sudo stap -L 'process("/usr/bin/qemu-system-x86_64").mark("*")'
> process("/usr/bin/qemu-system-x86_64").mark("alsa_no_frames") $arg1:long
> process("/usr/bin/qemu-system-x86_64").mark("alsa_pollout") $arg1:long 
> $arg2:long
> process("/usr/bin/qemu-system-x86_64").mark("alsa_read_zero") $arg1:long
> ...

> You can also use /usr/share/systemtap/tapset/qemu-system-x86_64.stp.
> I'm running Fedora 24 with qemu-system-x86 2.6.0-5.fc24 and SystemTap
> 3.0-3.fc24.

I meant I cannot just use "qemu" as a provider name. Later I discovered that
"process()" does work.


>> Also, I'm still not sure how to interact with QEMU's monitor interface from
>> within the probe code (probes execute in kernel mode, including "guru mode"
>> code).

> When SystemTap is used the QEMU monitor interface does nothing.

That's not what I've experienced. I was able to use a stap script to change the
tracing state of events:

   #!/usr/bin/env stap

   %{
   #include </home/lluis/Projects/qemu-dbi-test/test.h>
   %}

   function event:long(cpu:long, addr:long, info:long)
   %{
       char *argv[4] = {"/bin/sh", "-c", "echo 'trace-event * off' | telnet 
localhost 1234", NULL};
       call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_EXEC);
       STAP_RETURN(0);
   %}

   probe begin {
       printf("hello\n")
   }
   probe 
process("./install/vanilla/bin/qemu-system-i386").mark("guest_mem_before_exec")
   {
       printf("%x %d %d\n", $arg1, $arg2, $arg3)
       event($arg1, $arg2, $arg3)
       exit()
   }

The only caveat is that you must pass the "-g" argument to stap.

Also, for some reason the printf in the probe always prints zeros, no matter
what the actual event receives (I've debugged QEMU down to the call to the
auto-generated stap functions). Could this be an error in systemtap?


Thanks,
  Lluis



reply via email to

[Prev in Thread] Current Thread [Next in Thread]