qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: pbonzini@redhat.com, rth@twiddle.net, qemu-devel@nongnu.org,
	stefanha@redhat.com, crosthwaite.peter@gmail.com
Subject: Re: [Qemu-devel] [PATCH] exec: Rename and fix trace events for tracing I/O port access.
Date: Tue, 29 Mar 2016 16:09:43 +0100	[thread overview]
Message-ID: <20160329150943.GK32133@redhat.com> (raw)
In-Reply-To: <1459263745-1035-1-git-send-email-rjones@redhat.com>

On Tue, Mar 29, 2016 at 04:02:24PM +0100, Richard W.M. Jones wrote:
> Back in the day you used to be able to set DEBUG_IOPORT in ioport.c
> and get qemu to dump what (x86) I/O ports were being accessed by the
> guest.  This was rather useful for finding out what closed source
> device drivers were up to.
> 
> Now you're supposed to use cpu_in/cpu_out tracepoints instead.
> However for the majority of guests these tracepoints will never be
> called.
> 
> So this patch tries to rationalize all of that.  It:
> 
>  - replaces cpu_in/cpu_out with ioport_in/ioport_out tracepoints
> 
>  - moves them down in the stack, so they actually get called
> 
>  - fixes various details like address size
> 
> It turns out this is still not particularly useful for debugging
> because (a) it creates massive amounts of log messages and (b) there's
> no way to select a range of addresses or a device of interest.  For
> example, if you have a serial port, everything else gets swamped by
> I/O access to the serial port.  Maybe using a different tracing
> backend (eg. stap) would help?

With ftrace the granularity is simply on/off printf on a per-tracepoint
basis. With dtrace/systemtap you provide a hook that does whatever it
wants per-tracepoint. So assuming the arguments passed with the tracepoint
have the info, you can filter so it only prints on the ones you care about.

eg you've defined this new probe

 ioport_in(uint64_t addr, char size, uint64_t val) "addr %#"PRIx64"(%c) value %#"PRIx64
 ioport_out(uint64_t addr, char size, uint64_t val) "addr %#"PRIx64"(%c) value %#"PRIx64


so with systemtap you would  do

  probe qemu.ioport_in {
      printf("addr=%p size=%d val=%llu\n", addr, size, val)
  }

to get the same output as ftrace, but to filter it you would add
a conditional


  probe qemu.ioport_in {
      if (addr == 0xdeadbeef) {
        printf("addr=%p size=%d val=%llu\n", addr, size, val);
      }
  }

...assuming you have an easy way to figure out the correct value
of addr you want.

Since you have global state with systemtap you could record parameters
you want in one probe and reference them in later probes. eg you could
stick a probe on the serial port emulation which registers the i/O
port address to record the address associated with the serial port,
then use this address in the ioport_in probe.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  parent reply	other threads:[~2016-03-29 15:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 15:02 [Qemu-devel] [PATCH] exec: Rename and fix trace events for tracing I/O port access Richard W.M. Jones
2016-03-29 15:02 ` Richard W.M. Jones
2016-03-29 15:09 ` Daniel P. Berrange [this message]
2016-03-30 13:30 ` Paolo Bonzini
2016-03-31 10:08 ` Stefan Hajnoczi

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=20160329150943.GK32133@redhat.com \
    --to=berrange@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=rth@twiddle.net \
    --cc=stefanha@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 NNTP newsgroup(s).