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


Groups > linux.kernel > #1563693

Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure

From Marcelo Tosatti <mtosatti@redhat.com>
Newsgroups linux.kernel
Subject Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure
Date 2017-01-20 16:00 +0100
Message-ID <t1IPw-5I-11@gated-at.bofh.it> (permalink)
References <t1Gul-7bo-3@gated-at.bofh.it> <t1Gul-7bo-1@gated-at.bofh.it> <t1H76-7EL-85@gated-at.bofh.it> <t1HgL-7Iz-25@gated-at.bofh.it> <t1HA6-7Ps-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 20, 2017 at 02:36:40PM +0100, Paolo Bonzini wrote:
> 
> 
> On 20/01/2017 14:07, Marcelo Tosatti wrote:
> > On Fri, Jan 20, 2017 at 01:55:27PM +0100, Paolo Bonzini wrote:
> >>
> >>
> >> On 20/01/2017 13:20, Marcelo Tosatti wrote:
> >>>  kernel/time/timekeeping.c        |   79 +++++++++++++++++++++++++++++++++++++++
> >>
> >> Why not leave this in drivers/ptp/ptp_chardev.c?
> > 
> > timekeeper_lock
> 
> Why does emulate_ptp_sys_offset need it, if the current PTP_SYS_OFFSET
> code doesn't? 

Because if time is adjusted while you are taking the samples, 
the mean can return non existant values:

1) take sample1  (realtime = 2000)
2) userspace changes realtime (realtime = 100)
3) 2100/2 = 1050

However that 1050 value never existed, before or after
userspace changed realtime.
Such behaviour does not exist with PTP_SYS_OFFSET, because 
taking getnstimeofday64 is serialized against time changes.

I am not sure whether returning such bizzare values is fine, to 
drop the lock.

Hum... i think it must be because userspace will consider
the new values after realtime is changed as correct.

>  Is the latency acceptable (considering this is a raw spin
> lock) or is there a seqlock that we can use instead (such as tk_core.seq
> like in get_device_system_crosststamp)?

Well can move it after the ->getcrosststamp loop. 
I'll just drop the spinlock and document the behaviour.

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


Thread

[patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 13:30 +0100
  Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Paolo Bonzini <pbonzini@redhat.com> - 2017-01-20 14:10 +0100
    Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 14:20 +0100
      Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Paolo Bonzini <pbonzini@redhat.com> - 2017-01-20 14:40 +0100
        Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Radim Krcmar <rkrcmar@redhat.com> - 2017-01-20 15:10 +0100
          Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Paolo Bonzini <pbonzini@redhat.com> - 2017-01-20 15:30 +0100
            Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Miroslav Lichvar <mlichvar@redhat.com> - 2017-01-20 15:40 +0100
            Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Radim Krcmar <rkrcmar@redhat.com> - 2017-01-20 19:40 +0100
        Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-20 16:00 +0100
  Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Richard Cochran <richardcochran@gmail.com> - 2017-01-20 21:30 +0100
    Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-23 14:50 +0100
      Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Richard Cochran <richardcochran@gmail.com> - 2017-01-23 19:50 +0100
        Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Paolo Bonzini <pbonzini@redhat.com> - 2017-01-23 20:50 +0100
          Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Richard Cochran <richardcochran@gmail.com> - 2017-01-24 06:50 +0100
          Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-24 12:30 +0100
            Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Richard Cochran <richardcochran@gmail.com> - 2017-01-24 12:40 +0100
        Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Marcelo Tosatti <mtosatti@redhat.com> - 2017-01-24 00:10 +0100
          Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Richard Cochran <richardcochran@gmail.com> - 2017-01-24 06:40 +0100
            Re: [patch 4/5] PTP: add PTP_SYS_OFFSET emulation via cross  timestamps infrastructure Miroslav Lichvar <mlichvar@redhat.com> - 2017-01-24 09:20 +0100

csiph-web