All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Lluís <xscript@gmx.net>, "Dhaval Giani" <dhaval.giani@gmail.com>,
	"Stefan Hajnoczi" <stefanha@linux.vnet.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH, RFC] trace: implement guest tracepoint passthrough
Date: Wed, 31 Aug 2011 08:24:53 +0100	[thread overview]
Message-ID: <CAJSP0QVQQUbs3Qboxtq2m-iSpBpJ1+c+DqC3-HxULW8NWsXnuw@mail.gmail.com> (raw)
In-Reply-To: <CAAu8pHtvfE3CB_f69horzJ8vot7_We9AgXx+qRtR=NZMh_e5fQ@mail.gmail.com>

On Tue, Aug 30, 2011 at 7:43 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Mon, Aug 29, 2011 at 12:17 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Fri, Aug 26, 2011 at 8:06 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> Let guests inject tracepoint data via fw_cfg device.
>>>
>>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>>> ---
>>> The patch is used like this:
>>> ../configure --with-guest-trace-file=/src/openbios-devel/trace-events
>>> make
>>> sparc64-softmmu/qemu-system-sparc64 -trace file=foo
>>> # ugly hack to combine the file, but my laziness^Wpython-fu is too
>>> weak to add handling of "--guest-trace-file
>>> /src/openbios-devel/trace-events" to simpletrace.py
>>> cat ../trace-events /src/openbios-devel/trace-events >/tmp/trace-events
>>> # examine trace file with OpenBIOS trace data with simpletrace.py
>>> ../scripts/simpletrace.py /tmp/trace-events foo
>>> ob_ide_read_blocks 0.000 dest=0xfff0bed0 blk=0x0 n=0x1
>>> ob_ide_read_blocks 6491.806 dest=0xfff0bed0 blk=0x0 n=0x1
>>>
>>> An example of a generated guest-trace.c file:
>>> /* This file is autogenerated by tracetool, do not edit. */
>>> #include "trace.h"
>>> #include "guest-trace.h"
>>>
>>> void guest_trace(uint64_t event_id, uint64_t arg1, uint64_t arg2,
>>>                 uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)
>>>
>>> {
>>>    switch (event_id) {
>>>
>>>    case 0:
>>>        trace_esp_do_command(arg1, arg2, arg3);
>>>        break;
>>>
>>>    case 1:
>>>        trace_ob_ide_pio_insw(arg1);
>>>        break;
>>>
>>>    case 2:
>>>        trace_ob_ide_read_blocks(arg1, arg2, arg3);
>>>        break;
>>>
>>>    default:
>>>        break;
>>>   }
>>> }
>>>
>>> ---
>>>  Makefile.objs     |   15 +++++++++++-
>>>  configure         |    9 +++++++-
>>>  guest-trace.h     |    3 ++
>>>  hw/fw_cfg.c       |   31 +++++++++++++++++++++++++++
>>>  hw/fw_cfg.h       |   10 ++++++--
>>>  scripts/tracetool |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>>>  6 files changed, 120 insertions(+), 8 deletions(-)
>>>  create mode 100644 guest-trace.h
>>
>> The ability to trace from the guest can be handy, so I think we should
>> have this feature.  Please add documentation on how to hook it up
>> (e.g. how people would use this for other firmware/guest code and/or
>> other architectures).
>
> OK. The format should be the same as raw simpletrace data, but words
> always in little endian like used elsewhere with fw_cfg. BTW,
> currently simpletrace file format depends on host endianness, is that
> intentional?

Yes, it is intentional.  The rationale is that we want to stream trace
events to disk as quickly as possible without any overhead.  Since
there is a magic number in the first trace record, the post-processing
tool can in theory determine the endianness and do the byteswapping at
that time.  The current simpletrace.py script does not do this.

Stefan

  reply	other threads:[~2011-08-31  7:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 19:06 [Qemu-devel] [PATCH, RFC] trace: implement guest tracepoint passthrough Blue Swirl
2011-08-29 12:17 ` Stefan Hajnoczi
2011-08-29 12:51   ` Lluís
2011-08-30 18:58     ` Blue Swirl
2011-08-30 18:43   ` Blue Swirl
2011-08-31  7:24     ` Stefan Hajnoczi [this message]
2011-08-31  8:38 ` Avi Kivity
2011-08-31  9:08   ` Stefan Hajnoczi
2011-08-31  9:11     ` Avi Kivity
2011-08-31 13:38       ` Stefan Hajnoczi
2011-08-31 18:01         ` Dhaval Giani
2011-08-31 10:54     ` Jan Kiszka
2011-08-31 17:58   ` Blue Swirl
2011-08-31 18:00     ` Dhaval Giani
2011-09-03  8:53       ` Blue Swirl
2011-09-03  9:26         ` Dhaval Giani
2011-09-03 10:55           ` Blue Swirl

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=CAJSP0QVQQUbs3Qboxtq2m-iSpBpJ1+c+DqC3-HxULW8NWsXnuw@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=blauwirbel@gmail.com \
    --cc=dhaval.giani@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=xscript@gmx.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.