lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f36c1973c8147858000dd2a28d046ce@AcuMS.aculab.com>
Date:   Mon, 19 Apr 2021 08:22:21 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     "'wangyanan (Y)'" <wangyanan55@...wei.com>,
        Paolo Bonzini <pbonzini@...hat.com>
CC:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Andrew Jones <drjones@...hat.com>,
        Ben Gardon <bgardon@...gle.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Peter Xu <peterx@...hat.com>,
        "wanghaibin.wang@...wei.com" <wanghaibin.wang@...wei.com>,
        "yuzenghui@...wei.com" <yuzenghui@...wei.com>,
        kvm <kvm@...r.kernel.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v6 03/10] KVM: selftests: Use flag CLOCK_MONOTONIC_RAW for
 timing

From: wangyanan (Y)
> Sent: 19 April 2021 07:40
> 
> Hi Paolo,
> 
> On 2021/4/17 21:23, Paolo Bonzini wrote:
> > On 30/03/21 10:08, Yanan Wang wrote:
> >> In addition to function of CLOCK_MONOTONIC, flag CLOCK_MONOTONIC_RAW can
> >> also shield possiable impact of NTP, which can provide more robustness.
> >>
> >> Suggested-by: Vitaly Kuznetsov<vkuznets@...hat.com>
> >> Signed-off-by: Yanan Wang<wangyanan55@...wei.com>
> >> Reviewed-by: Ben Gardon<bgardon@...gle.com>
> >> Reviewed-by: Andrew Jones<drjones@...hat.com>
> >
> > I'm not sure about this one, is the effect visible?
> >
> In practice, difference between results got with CLOCK_MONOTONIC and
> CLOCK_MONOTONIC_RAW
> actually is too little to be visible. But if just in theory,
> CLOCK_MONOTONIC_RAW can ensure time results
> of the compared tests are based on the same local oscillator frequency,
> which is not subject to possible
> NTP frequency adjustment. Change in this patch seems like a bit of
> optimization.

The real annoyance is when NTP is realigning the local clock.
This typically happens after boot - but can take quite a few
minutes (don't think it can quite get to an hour).
(I think something similar is caused by leap seconds.)

During this period CLOCK_MONOTONIC can run at a significantly
different rate from 'real time'.
This may not matter for timing self tests, but is significant
for RTP audio.

The problem there is that you want the NTP corrected time
during 'normal running' because the small correction (for
crystal error) is useful.

But the kernel HR timers are only defined for CLOCK_MONOTONIC
and the userspace requests for CLOCK_MONOTONIC_RAW are likely
to be real system calls.

What you really want is a clock whose frequency is adjusted
by NTP but doesn't have the NTP offset adjuctments.
In reality this ought to be CLOCK_MONOTONIC.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ