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


Groups > linux.kernel > #1551122

Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts

From Stephen Hemminger <stephen@networkplumber.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts
Date 2017-01-04 20:20 +0100
Message-ID <sVZgl-rO-3@gated-at.bofh.it> (permalink)
References <sVXHA-7LF-27@gated-at.bofh.it> <sVXRg-7OT-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed,  4 Jan 2017 18:24:39 +0100
Vitaly Kuznetsov <vkuznets@redhat.com> wrote:

> If we happen to receive interrupts during hv_set_host_time() execution
> our adjustments may get inaccurate. Make the whole function atomic.
> Unfortunately, we can's call do_settimeofday64() with interrupts
> disabled as some cross-CPU work is being done but this call happens
> very rarely.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Ok, the race is between timer interrupts and calling do_adjtimex().
NTP has the same issue already.

The getnstimeofday64() (or ktime_get) return an atomic value.
If a clock tick interrupt happens during this code, then the value
is still correct just old.

If you want to avoid all races here, it looks like it would
be better to get timekeeper_lock and call __do_adjtimex. The existing
code in do_adjtimex() is expecting to be called from a system call
and changing it's assumptions is probably not a good idea.

Rather than calling system call from user space. Maybe better
to provide real kernel API in time subsystem for this use case.
What does KVM do?

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


Thread

[PATCH v2 0/4] hv_util: adjust system time smoothly Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-04 18:40 +0100
  [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-04 18:50 +0100
    Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts Stephen Hemminger <stephen@networkplumber.org> - 2017-01-04 20:20 +0100
      Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-05 13:40 +0100
        Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts Stephen Hemminger <stephen@networkplumber.org> - 2017-01-05 18:50 +0100
    Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by  disabling interrupts John Stultz <john.stultz@linaro.org> - 2017-01-07 02:10 +0100
      Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-09 14:10 +0100
  Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Thomas Gleixner <tglx@linutronix.de> - 2017-01-09 22:30 +0100
    Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-10 15:40 +0100
      Re: [PATCH v2 0/4] hv_util: adjust system time smoothly Thomas Gleixner <tglx@linutronix.de> - 2017-01-10 16:00 +0100
        [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 14:10 +0100
          Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Richard Cochran <richardcochran@gmail.com> - 2017-01-13 16:00 +0100
            Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 16:40 +0100
          Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Olaf Hering <olaf@aepfle.de> - 2017-01-13 16:30 +0100
            Re: [PATCH RFC] hv_utils: implement Hyper-V PTP source Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-01-13 16:40 +0100

csiph-web