xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Ben Sanda <Ben.Sanda@dornerworks.com>,
	Dario Faggioli <dario.faggioli@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Paul Sujkov <psujkov@gmail.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	"stefano.stabellini" <stefano.stabellini@eu.citrix.com>
Subject: Re: Xentrace on Xilinx ARM
Date: Wed, 9 Mar 2016 11:05:05 +0000	[thread overview]
Message-ID: <56E00361.7090005@citrix.com> (raw)
In-Reply-To: <A2A949C387F3A54C9B4DAC2DCD2E9A85C38D5433@Quimby.dw.local>

On 08/03/16 20:51, Ben Sanda wrote:
> George,
> 
>> FWIW, on my "to-do" list for xenalyze for years has been to have the xentrace
>> process query something (either Xen or Linux) to find the hz rate, and then
>> write that at the beginning of the xentrace file, so that xenalyze could just
>> pick that up and use it.  Since you're doing some work on xentrace / xenalyze
>> anyway, you might think about adding that to your "to-do" list -- it doesn't
>> seem conceptually like it would be that hard.
> 
> Since I'm in the code base anyway right now I'll give it a look. I was wondering
> about that for the xenalyze hertz parameter. I had assumed initially xentrace
> embedded the value somehow already. Is there any documentation as to the binary
> format xentrace outputs? Or is it best just to look at the code and figure it
> out? I guess the main thing would be providing a common interface for both ARM
> and x86 but the common trace.c has a get frequency function that's implemented
> by both so we should be able to query it and shove in the data.

Well fundamentally the output is a series of variable-sized records of
"struct t_rec", defined in xen/include/public/trace.h.  Each trace is at
least one word (4 bytes) long, and at most 10 words (40 bytes) long.  I
think between the t_rec definition and the code that handles it in
xenalyze you should be able to figure out what's going on. :-)

Xen creates one ring-buffer per cpu and simply writes trace records into
the buffers (with producer / consumer pointers).  If the buffer is full,
it simply drops trace records; however, it counts  how many records get
dropped, and when there is space again it creates a TRC_LOST_RECORDS
trace record that contains:
1. The number of lost records
2. The tsc of the first lost record (which, with the current tsc, gives
you a clear picture of the timeframe over which records were lost)
3. The currently running vcpu (so you can tell which vcpu to account the
records until the next schedule trace record)

xentrace will intermittently wake up and check for outstanding records
in the cpu buffers.  For each buffer it finds consumed records, it
creates a TRC_CPU_CHANGE record, which says the physical cpu of the
following records, as well as the number of bytes about to be written.
This allows xenalyze to efficiently scan through the file looking for
records from a specific pcpu.

So xentrace already generates new trace records and inserts them into
the stream.  The new functionality we're talking about would just be a
matter of defining a new trace record or two (probably of time TRC_GEN
-- see TRC_CPU_CHANGE in xen/include/public/trace.h), then getting
xentrace to add the records at the beginning of the trace file.

I *think* that you could get away with not writing a TRC_CPU_CHANGE
record for those trace records; but it wouldn't really hurt to insert
one anyway.  I'll leave that up to you.

>> The other thing that might be useful is information about the architecture
>> you're running on -- right now it assumes intel, and will crash tracing a file
>> generated on an AMD box unless you specify --svm-mode.  Adding a trace record
>> that indicates "Intel / AMD / ARM" would also make things a lot easier.
> 
> I didn't run into any issue with xenalyze analyzing the ARM generated trace file
> (I didn't give it any special flag). What does --svm-mode modify? The endedness?
> I can look quick into that as well.

"SVM" is* AMD's name for their virtualization extension (as "VMX" or
"VT-x" is for Intel).

* Or at least, it was at one time -- they tend to rename these things
for marketing reasons.

If you're just doing a straight dump of the records, with no analysis,
then it's probably not a big deal.  The main thing with Intel / AMD is
that they have different VMEXIT types, so xenalyze needs to know which
one it's getting to be able to analyze them properly.

On the other hand, maybe what we should do is just have a flag in the
architecture-specific trace records themselves saying whether they
should be interpreted as VMX or SVM. :-)

 -George


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-03-09 11:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 20:53 Xentrace on Xilinx ARM Ben Sanda
2016-03-05 15:43 ` Dario Faggioli
2016-03-07  3:20   ` Ben Sanda
2016-03-07 19:36   ` Ben Sanda
2016-03-07 20:30     ` Paul Sujkov
2016-03-07 20:32       ` Ben Sanda
2016-03-08 12:41     ` Dario Faggioli
2016-03-08 18:04       ` Ben Sanda
2016-03-08 18:15         ` Dario Faggioli
2016-03-08 18:28         ` Paul Sujkov
2016-03-08 18:32           ` Andrew Cooper
2016-03-09 11:22             ` Dario Faggioli
2016-03-08 18:44         ` George Dunlap
2016-03-08 20:51           ` Ben Sanda
2016-03-09 11:05             ` George Dunlap [this message]
2016-03-09 16:28               ` Ben Sanda
2016-03-09 11:41             ` Paul Sujkov
2016-03-09 16:26               ` Ben Sanda

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=56E00361.7090005@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=Ben.Sanda@dornerworks.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=psujkov@gmail.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 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).