qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: kvm@vger.kernel.org, yoshihiro.yunomae.ez@hitachi.com,
	mtosatti@redhat.com, qemu-devel@nongnu.org, rostedt@goodmis.org,
	Luiz Capitulino <lcapitulino@redhat.com>,
	linux-trace-users@vger.kernel.org, stefanha@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC] host and guest kernel trace merging
Date: Thu, 24 Mar 2016 16:42:42 +0800	[thread overview]
Message-ID: <20160324084242.GD28183@pxdev.xzpeter.org> (raw)
In-Reply-To: <20160304111933.GB626@stefanha-x1.localdomain>

On Fri, Mar 04, 2016 at 11:19:33AM +0000, Stefan Hajnoczi wrote:
> On Thu, Mar 03, 2016 at 02:35:01PM -0500, Luiz Capitulino wrote:
> > trace-cmd-server
> > ================
> > 
> > Everything I described could look like this:
> > 
> >   # trace-cmd server [ in the host ]
> >   # trace-cmd record [ in the guest ]
> >   # trace-cmd report [ in the host, to merge the traces ]
> > 
> > To achieve this, we need two things:
> > 
> >  1. Add an interface to obtain the guest TSC offset from the
> >     host user-space.
> > 
> >     Maybe we could have a new sysfs directory, with a file
> >     per vCPU thread and the offset as contents? Or maybe
> >     just add a new entry to /proc/, like: /proc/TID/tsc-offset?
> 
> Yes, the interface is missing.  In the past I have heard people using
> trace events on the host to:
> 
> 1. Collect tsc offsets
> 2. Track which vCPU is scheduled to a host CPU
> 
> So instead of relying on an interface they enable the relevant trace
> events on the host and then parse the trace to collect this information.
> However, it's a bad solution especially for tsc offsets since you may
> wish to trace an already-running VM where the tracepoint that records
> the tsc offset may not fire after startup (?).
> 
> Therefore, I agree that an interface for the tsc offset is needed.

It seems that KVM still has no such a generic interface to query VM
status, right? How about we create one for it? As a start, we can
make it fairly simple. Afterward, we can enrich it when
necessary. For example:

we create this directory to store all KVM guest informations (or
general KVM dynamic informations):

  /sys/hypervisor/kvm/

For each VM, we can have this to store VM specific infos:

  /sys/hypervisor/kvm/$VM_NAME

For each vCPU:

  /sys/hypervisor/kvm/$VM_NAME/cpus/cpuN/

and we can put tsc-offset here like:

  /sys/hypervisor/kvm/$VM_NAME/cpus/cpuN/tsc-offset

Would this be workable?

Thanks.

-- peterx

  parent reply	other threads:[~2016-03-24  8:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 19:35 [Qemu-devel] [RFC] host and guest kernel trace merging Luiz Capitulino
2016-03-04 11:19 ` Stefan Hajnoczi
2016-03-04 13:23   ` Steven Rostedt
2016-03-07 15:17     ` Stefan Hajnoczi
2016-03-07 15:49       ` Steven Rostedt
2016-03-07 16:10         ` Eric Blake
2016-03-07 16:26           ` Steven Rostedt
2016-03-07 17:13             ` Paolo Bonzini
2016-03-24  5:16     ` Peter Xu
2016-03-24 13:02       ` Luiz Capitulino
2016-03-25  1:53         ` Peter Xu
2016-03-24  8:42   ` Peter Xu [this message]
2016-03-24 10:13     ` Stefan Hajnoczi
2016-03-25  2:22       ` Peter Xu

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=20160324084242.GD28183@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=linux-trace-users@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rostedt@goodmis.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=yoshihiro.yunomae.ez@hitachi.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).