All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Radim Krcmar <rkrcmar@redhat.com>,
	Miroslav Lichvar <mlichvar@redhat.com>
Subject: Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure
Date: Tue, 24 Jan 2017 09:23:29 -0200	[thread overview]
Message-ID: <20170124112326.GA30511@amt.cnet> (raw)
In-Reply-To: <e7ab90e9-6cfd-a926-196b-0018184d6f92@redhat.com>

On Mon, Jan 23, 2017 at 08:44:53PM +0100, Paolo Bonzini wrote:
> 
> 
> On 23/01/2017 19:44, Richard Cochran wrote:
> >> device clock	   |sample1P,deviceclock|       |sample2P,deviceclock|
> >> -------------------------------------------------------------
> >> realtime clock  |sample1P,realtimeclock|     |sample2P,realtimeclock|
> >
> > Are |sample1P,deviceclock| and |sample1P,realtimeclock| taken at the
> > same instant in time?
> > 
> > If not, then calling that PTP_SYS_OFFSET_PRECISE is misleading.
> 
> Yes, of course.  This was added for the e1000e drivers first, but chrony
> isn't using it yet.  In the case of KVM, the same host TSC value is used
> to produce the host clock and (converted to guest TSC) the guest clock.
> 
> If you just implement getclock64 the PTP_SYS_OFFSET output:
> 
> device clock	|	|sample2|	|sample4|	|sample6| ...
> -------------------------------------------------------------
> realtime clock  |sample1|       |sample3|	|sample5|
> 
> has a very large distance between samples on the same line (about 1 us),
> and I think it is too noisy for userspace to make sense of the output.
> 
> So, on one hand chrony only uses the mean of realtime clock samples, in
> an attempt to produce precise cross timestamps.  On the other hand, even
> though KVM could produce those natively, chrony does not support
> PTP_SYS_OFFSET_PRECISE.
> 
> Marcelo's patch then produces fake realtime clock samples that, however,
> let chrony derive the cross timestamps that KVM produced in the first
> place.  The outcome is really great accuracy compared to previous
> versions of the patch, often just +/- 2 or 3 nanoseconds.
> 
> Paolo

Nope, the clock offset is the value inside square brackets. The +/-
is the error. So the clock offset is actually up to 680ns.

Yes for greater accuracy userspace should implement _PRECISE
support.

I'm resending v5 with native support for ->gettime and 
->getcrosststamps.

  parent reply	other threads:[~2017-01-24 11:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 12:20 [patch 0/5] KVM virtual PTP driver (v3) Marcelo Tosatti
2017-01-20 12:20 ` [patch 1/5] KVM: x86: provide realtime host clock via vsyscall notifiers Marcelo Tosatti
2017-01-20 12:20 ` [patch 2/5] KVM: x86: add KVM_HC_CLOCK_OFFSET hypercall Marcelo Tosatti
2017-01-20 12:20 ` [patch 3/5] kvmclock: export kvmclock clocksource pointer Marcelo Tosatti
2017-01-20 12:55   ` Paolo Bonzini
2017-01-20 12:20 ` [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure Marcelo Tosatti
2017-01-20 12:55   ` Paolo Bonzini
2017-01-20 13:07     ` Marcelo Tosatti
2017-01-20 13:36       ` Paolo Bonzini
2017-01-20 13:52         ` Marcelo Tosatti
2017-01-20 14:02         ` Radim Krcmar
2017-01-20 14:23           ` Paolo Bonzini
2017-01-20 14:31             ` Miroslav Lichvar
2017-01-20 18:30             ` Radim Krcmar
2017-01-20 20:25   ` Richard Cochran
2017-01-23 13:19     ` Marcelo Tosatti
2017-01-23 18:44       ` Richard Cochran
2017-01-23 19:44         ` Paolo Bonzini
2017-01-24  5:43           ` Richard Cochran
2017-01-24 11:23           ` Marcelo Tosatti [this message]
2017-01-24 11:35             ` Richard Cochran
2017-01-23 23:06         ` Marcelo Tosatti
2017-01-24  5:32           ` Richard Cochran
2017-01-24  8:15             ` Miroslav Lichvar
2017-01-20 12:20 ` [patch 5/5] PTP: add kvm PTP driver Marcelo Tosatti
2017-01-20 12:58   ` Paolo Bonzini
2017-01-20 13:11     ` Marcelo Tosatti
2017-01-20 14:12   ` Radim Krcmar
2017-01-20 14:20     ` Radim Krcmar
2017-01-20 15:00     ` Marcelo Tosatti
2017-01-20 17:11       ` Paolo Bonzini
2017-01-20 18:08       ` Radim Krcmar
2017-01-20 19:10         ` Marcelo Tosatti
2017-01-21  8:02         ` Paolo Bonzini
2017-01-20 13:10 ` [patch 0/5] KVM virtual PTP driver (v3) Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2017-01-20 14:51 [patch 0/5] KVM virtual PTP driver (v4) Marcelo Tosatti
2017-01-20 14:51 ` [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure Marcelo Tosatti

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=20170124112326.GA30511@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rkrcmar@redhat.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 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.