All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Giuseppe Eletto <giuseppe.eletto@edu.unito.it>,
	<linux-trace-devel@vger.kernel.org>,
	<xen-devel@lists.xenproject.org>,
	"Dario Faggioli" <dfaggioli@suse.com>,
	Enrico Bini <enrico.bini@unito.it>
Subject: Re: A KernelShark plugin for Xen traces analysis
Date: Wed, 14 Apr 2021 21:05:00 +0100	[thread overview]
Message-ID: <f44f994d-32da-0610-57d8-e3a30bbb278c@citrix.com> (raw)
In-Reply-To: <20210414094300.7fbd6887@gandalf.local.home>

On 14/04/2021 14:43, Steven Rostedt wrote:
>> This causes major problems for `perf` support under Xen, which assumes
>> that the kernel's idea of CPUs matches that of the system.
> Things are different with KernelShark.

That is very encouraging to hear.

>> When rendering a trace including Xen data, Xen can provide the real
>> system CPUs, and dom0 wants to be rendered as a VM under Xen, similar to
>> trace-Fedora21 in your screenshot above.  (Obviously, if you're doing
>> nested virt, things need to start nesting.)
> Right.
>
> What I would envision how this would work, is that you would produce a
> set of tracing files. One for each guest (including Dom0), and one for the
> Xen hypervisor itself. The trick is to have a way to synchronize the time
> stamps. What we just did with KVM is to have all the tracing record the
> CPUs TSC, including the shift and multiplier that the CPU might change for
> the guests. Then we have a way to convert the TSC to nanoseconds. This way
> all tracing data has the same clock. It's somewhat complicated to get
> right, and requires access to how the guests clocks are modified by the CPU.

Hmm.  In the past, I have had success by modifying Xen to refuse any
shift/scale settings, at which point VMs and the hypervisor have
directly-comparable raw TSC values.

Xen certainly has enough information to describe what TSC rate/epoch
each guest is seeing, but I doubt any of this is coherently exposed at
the moment.

> For KVM, each machine has a unique id and is stored in the trace.dat files.
> We have the host store a mapping of what thread represents which guest VCPU
> (virtual CPU). Then the "-a" option tells KernelShark to append the
> tracing data as a dependency. I would imagine we can have something like
> this:
>
>  kernelshark xen.dat -a trace-dom0.dat -a trace-guest1.dat -a trace-guest2.dat
>
> The Xen plugin would then need to read the how the threads in xen.dat map
> to the virtual CPUs of each of the guest files. Which would give you the
> layering.

Looks good.  I suspect we might need to do a little work on Xen's trace
data to make this mesh together nicely.  In particular, Xen doesn't have
a terribly good scheme on unique IDs for "a VM".

We've got domain ID's which are Xen's unique instances of a running
"thing", but they change across VM reboot/migrate/etc.  I suspect we
have some atomicity problems with unique identification information and
VM-fork too.

There is a UUID field but we leave that entirely up to the toolstack to
manage.  (A good test for naive toolstack code comes on the a localhost
live migrate, because suddenly the toolstack is presented with one
logical VM (=> one UUID) and two concurrent domid's.)


I'll try to have a play with the plugin in some copious free time, but
this work does look exciting.

~Andrew


  reply	other threads:[~2021-04-14 20:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 14:28 A KernelShark plugin for Xen traces analysis ​ Giuseppe Eletto
2021-04-13 15:33 ` Andrew Cooper
2021-04-14 17:31   ` Dario Faggioli
2021-04-14 17:31     ` Dario Faggioli
2021-04-14 18:11     ` Andrew Cooper
2021-04-14 19:07       ` A KernelShark plugin for Xen traces analysis Steven Rostedt
2021-04-15  0:50         ` Dario Faggioli
2021-04-15  0:50           ` Dario Faggioli
2021-04-15 13:29           ` Steven Rostedt
2021-04-15 13:29             ` Steven Rostedt
2021-04-14 21:51       ` A KernelShark plugin for Xen traces analysis ​ Dario Faggioli
2021-04-14 21:51         ` Dario Faggioli
2021-04-13 15:46 ` A KernelShark plugin for Xen traces analysis Steven Rostedt
2021-04-14 10:07   ` Andrew Cooper
2021-04-14 13:43     ` Steven Rostedt
2021-04-14 20:05       ` Andrew Cooper [this message]
2021-04-15  0:41         ` Dario Faggioli
2021-04-15  0:41           ` Dario Faggioli
2021-04-15  0:13     ` Dario Faggioli
2021-04-15  0:13       ` Dario Faggioli
2021-04-14 22:11   ` Dario Faggioli
2021-04-14 22:11     ` Dario Faggioli
2021-04-14 22:25     ` Steven Rostedt
2021-04-14 22:25       ` Steven Rostedt
2021-04-14  9:25 ` A KernelShark plugin for Xen traces analysis ​ Yordan Karadzhov (VMware)
2021-04-14 17:46   ` Dario Faggioli
2021-04-14 17:46     ` Dario Faggioli
2021-04-15 14:22   ` Giuseppe Eletto

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=f44f994d-32da-0610-57d8-e3a30bbb278c@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=dfaggioli@suse.com \
    --cc=enrico.bini@unito.it \
    --cc=giuseppe.eletto@edu.unito.it \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.