linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 2/3] trace-cmd: Read and use fraction bits from TRACECMD_OPTION_TIME_SHIFT
Date: Wed, 13 Oct 2021 13:03:10 +0300	[thread overview]
Message-ID: <CAPpZLN5=_dcdOGR7E3VBrT-QQ=VH6m5nP96mz8OrAifWR6fR4A@mail.gmail.com> (raw)
In-Reply-To: <20211012231401.22c8c22f@oasis.local.home>

On Wed, Oct 13, 2021 at 6:14 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Thu, 23 Sep 2021 12:45:25 +0300
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
>
> > @@ -1235,7 +1236,6 @@ timestamp_correction_calc(unsigned long long ts, unsigned int flags,
> >                         struct ts_offset_sample *min,
> >                         struct ts_offset_sample *max)
> >  {
> > -     long long scaling;
> >       long long tscor;
> >
> >       if (flags & TRACECMD_TSYNC_FLAG_INTERPOLATE) {
> > @@ -1243,15 +1243,12 @@ timestamp_correction_calc(unsigned long long ts, unsigned int flags,
> >               long long offset = ((long long)ts - min->time) *
> >                                  (max->offset - min->offset);
> >
> > -             scaling = (min->scaling + max->scaling) / 2;
>
> So the max->scaling is not going to play a role here?

I assume that if there is a clock scaling - it should not change
runtime, fraction bits and scaling should be the same from the VM
start. So there is no sense to make interpolation, just use the first
value.

>
> Does this work for other methods besides KVM?
>

We have only PTP and KVM till now, only KVM supports scaling. PTP just
sets scaling to 1 and fraction to 0. Unfortunately, I cannot test even
KVM scaling - I failed to enable it on my system.

> -- Steve
>
>
> >               tscor = min->offset + (offset + delta / 2) / delta;
> > -
> >       } else {
> > -             scaling = min->scaling;
> >               tscor = min->offset;
> >       }
> >
> > -     ts *= scaling;
> > +     ts = (ts * min->scaling) >> min->fraction;
> >       if (tscor < 0)
> >               return ts - llabs(tscor);
> >
> > @@ -2337,37 +2334,16 @@ static int tsync_offset_cmp(const void *a, const void *b)
> >



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

  reply	other threads:[~2021-10-13 10:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23  9:45 [PATCH 0/3] trace-cmd: Align guest TSC calculation with the kernel Tzvetomir Stoyanov (VMware)
2021-09-23  9:45 ` [PATCH 1/3] trace-cmd: Extend host-guest time sync with fraction bits Tzvetomir Stoyanov (VMware)
2021-10-13  3:04   ` Steven Rostedt
2021-10-13  9:48     ` Tzvetomir Stoyanov
2021-10-13 14:53       ` Steven Rostedt
2021-09-23  9:45 ` [PATCH 2/3] trace-cmd: Read and use fraction bits from TRACECMD_OPTION_TIME_SHIFT Tzvetomir Stoyanov (VMware)
2021-10-13  3:14   ` Steven Rostedt
2021-10-13 10:03     ` Tzvetomir Stoyanov [this message]
2021-09-23  9:45 ` [PATCH 3/3] trace-cmd: Dump " Tzvetomir Stoyanov (VMware)
2021-10-13  3:15   ` Steven Rostedt

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='CAPpZLN5=_dcdOGR7E3VBrT-QQ=VH6m5nP96mz8OrAifWR6fR4A@mail.gmail.com' \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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).