From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Dario Faggioli <dfaggioli@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>,
Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: Accuracy of traces sync [Was: Re: [PATCH] Fix `make -jN trace-cmd gui`]
Date: Thu, 26 Nov 2020 05:53:13 +0200 [thread overview]
Message-ID: <CAPpZLN70+CkZWPK_XAv3WyPUC02yY98WoMwqMCNu2sRQiQ_QCA@mail.gmail.com> (raw)
In-Reply-To: <4aafe6e3fd34a17ab4c9bf4514b5a9b7d65ca6ea.camel@suse.com>
On Thu, Nov 26, 2020 at 2:15 AM Dario Faggioli <dfaggioli@suse.com> wrote:
>
> On Fri, 2020-11-20 at 09:08 -0500, Steven Rostedt wrote:
> > On Fri, 20 Nov 2020 14:43:21 +0100
> > Dario Faggioli <dfaggioli@suse.com> wrote:
> > >
> > > So, you often say that "the accuracy of the synchronization
> > > protocol is
> > > XX ms". Now, I guess that means that an event in the guest and the
> >
> > Note, we are usually microsecond (us) apart, not millisecond (ms) ;-)
> >
> Ah, yes, sure... And sorry about that! I know it us, I'm not sure how I
> ended up writing ms. That would be quite terrible indeed! :-D
>
> > > corresponding event in the host (or vice versa) are XX ms apart.
> > > And
> > > that's even after the synchronization of the two traces, is that
> > > right?
> >
> > At plumbers we talked with Thomas Gleixner and he suggested ideas of
> > how to
> > get to the actual shifts used in the hardware that should give us
> > exact
> > timestamp offsets. We are currently working on that.
> >
> Yes, I remember that, I attended the BoF.
>
> > But in the mean time,
> > the P2P is giving us somewhere between 5 and 10 us accuracy. And
> > that's
> > simply because the jitter of the vsock connection (which is used for
> > the
> > synchronization at start and end of the traces) has a 5 to 10 us
> > jitter,
> > and it's not possible to get a more accurate than the medium that is
> > being
> > used.
> >
> Yes, with a student that I was helping with his thesis, we applied one
> debug patch to trace-cmd that you have on this list, and we tried the
> different synchronization strategies, frequency, etc.
>
> > > Question is, how do you measure that? Sure, I can look manually for
> > > an
> > > occurrence of the pattern that I described above: i.e., an event in
> > > the
> > > guest, then the corresponding one in the host and compute the
> > > difference between the timestamps.
> >
> > You mean, how we measure the accuracy? It's usually done by seeing
> > when we
> > have events from the guest showing up when we should be in the host
> > (it's
> > like seeing events from userspace when you are in the kernel).
> >
> Ok, makes sense. I need to try it first hand to make sure I've properly
> understood it, though. I'll collect some more tracing and looks for
> situations like these.
>
> Thanks!
>
> > > But do you have a way to do so automatically, or with a
> > > script/program,
> > > etc?
> >
> > We have talked about having something scan to find cases where the
> > guest
> > event happens in kernel and do some post processing shifting, but
> > haven't
> > gotten there yet.
> >
> Yep, as said, I was thinking at it as a way to measure how accurately
> the traces are synched, but indeed once one has it, it can even use it
> to actually synch them better.
Hi Dario
There is one approach to measure the accuracy of the synchronisation.
May be you remember the suggestions proposed in the BoF - KVM exposes
the clock offset and scaling factor in the /proc FS. In the last
version of the time
sync patch set, v25, I've implemented such logic - when x86-tsc is used for
trace clock source, the offset is read from the KVM debug FS. In theory this
should bring the best synchronisation, but I still see some guest events in
wrong order according to the host events.
I use the offset exposed from KVM as a reference - run PTP algorithm using
the x86-tsc trace clock and compare the calculated offset with the one from
the KVM debug FS.
We still need to find a way to improve the synchronisation accuracy for cases
when other hypervisors and trace clocks are used.
>
> But I understand how it's rather tricky.
>
> > If the hardware settings can work, then there will be no
> > need to do so.
> >
> Indeed. Well, perhaps it could still be useful, as a test/check whether
> things are working? :-)
>
> Regards
> --
> Dario Faggioli, Ph.D
> http://about.me/dario.faggioli
> Virtualization Software Engineer
> SUSE Labs, SUSE https://www.suse.com/
> -------------------------------------------------------------------
> <<This happens because _I_ choose it to happen!>> (Raistlin Majere)
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
prev parent reply other threads:[~2020-11-26 3:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 21:16 [PATCH] Fix `make -jN trace-cmd gui` Dario Faggioli
2020-11-20 3:09 ` Steven Rostedt
2020-11-20 12:06 ` Dario Faggioli
2020-11-20 12:32 ` Yordan Karadzhov (VMware)
2020-11-20 13:43 ` Accuracy of traces sync [Was: Re: [PATCH] Fix `make -jN trace-cmd gui`] Dario Faggioli
2020-11-20 14:08 ` Steven Rostedt
2020-11-26 0:15 ` Dario Faggioli
2020-11-26 3:53 ` Tzvetomir Stoyanov [this message]
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=CAPpZLN70+CkZWPK_XAv3WyPUC02yY98WoMwqMCNu2sRQiQ_QCA@mail.gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=dfaggioli@suse.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=y.karadz@gmail.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).