Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740602

Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading callback

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading callback
Date 2017-09-27 12:50 +0200
Message-ID <uui4G-1h8-17@gated-at.bofh.it> (permalink)
References <ukd6h-1Bo-3@gated-at.bofh.it> <ukd6i-1Bo-21@gated-at.bofh.it> <utJJD-43z-1@gated-at.bofh.it> <uu1nb-7hm-1@gated-at.bofh.it> <uugme-8tI-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 27/09/2017 10:52, Thomas Gleixner wrote:
> But there is no requirement that current clocksource is TSC. The
> requirement is:
> 
>   The hardware reference clock, the one which can be captured atomically
>   with device clock (PTP, audio whatever), is the coupled clock of the
>   current timekeeping clocksource. Both have a fixed ratio and offset.
> 
> That's completely independend of TSC. TSC/ART are a particular hardware
> implementation which can use that infrastructure because they fulfil the
> requirement.

Ok, this helps.

> So please stop these uninformed claims about brokeness and TSC
> requirements.

It was a question, not an uninformed claim.  You answered the question now.

> Instead please sit down and figure out whether your
> particular use case of kvmclock/hyperv clock actually fit into that
> functionality, i.e. whether you have
> 
>     1) 'device time'
>     2) 'system reference time'
>     3) 'system time'
> 
> where
> 
>     #1 and #2 can be captured atomically
> 
>     #2 and #3 are coupled clocks with a fixed ratio and offset
> 
> If those requirements are fulfilled then you can simply use it as is and it
> will give you CLOCK_MONOTONIC and CLOCK_REALTIME for the captured device
> time.
> 
> If your use case is different and does not fit into that picture then
> please write it up clearly what you are trying to achieve and we can
> discuss how to make it work w/o adding duct tape hackery.

Yes, I understand better now why you consider read_with_stamp a hack.
And it is---but I was confused and couldn't think of anything better.

The definitions do fit KVM, and indeed there is ptp-kvm that does
something very similar to what you describe in the other mail.  We have:

	#1 is host time
	#2 is host TSC
	#3 is guest TSC

We know that #2 and #3 have a fixed ratio and offset.  The point is
whether #1 and #2 can be captured atomically.

For PTP-KVM, the host tells the guest; if capturing the two is
impossible, it fails the hypercall and ioctl(PTP_SYS_OFFSET_PRECISE)
fails too.

Right now, the hypercall fails if the host clocksource is not the TSC
clocksource, which is safe.

These patches are about ascertaining whether #1 and #2 can be captured
atomically in a more generic way.  In the read_with_stamp case:

- if it returns true, it gives an atomic reading of #1 and #2

- if it returns false, it gives a reading of #1 only.


I think the hook should be specific to x86.  For example it could be an
array of function pointers, indexed by vclock_mode, with the same
semantics as read_with_stamp.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Paolo Bonzini <pbonzini@redhat.com> - 2017-09-26 19:00 +0200
  Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 11:00 +0200
    Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Paolo Bonzini <pbonzini@redhat.com> - 2017-09-27 12:50 +0200
      Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 14:00 +0200
        Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Paolo Bonzini <pbonzini@redhat.com> - 2017-09-27 14:20 +0200
          Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 15:50 +0200
  Re: [PATCH v5 1/6] timekeeper: introduce extended clocksource reading  callback Thomas Gleixner <tglx@linutronix.de> - 2017-09-27 11:20 +0200

csiph-web