linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Pali Rohár" <pali@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Missing CLOCK_BOOTTIME_RAW?
Date: Mon, 18 May 2020 14:13:48 +0200	[thread overview]
Message-ID: <87d071xwxv.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20200518113522.y6sj7ypunsu6pi3s@pali>

Pali Rohár <pali@kernel.org> writes:
> On Monday 18 May 2020 13:26:14 Thomas Gleixner wrote:
>> System clock shifted by one hour? You mean DST change?
>
> Yes, clock was shifted by one hour.
>
>> If chronyd
>> adjusts that by smoothing the frequency, that's just broken and really
>> not the kernel's problem.
>
> And what other can time synchronization daemon does?

DST switching is a matter of switching time zones and has absolutely
nothing to do with frequencies. In fact smearing DST is a blantant
violation of the timekeeping guarantees.

I've never heard about that before. All I know is that chronyd can be
configured to smear leap seconds, but that doesn't take 6 hours and does
not screw with the time accuracy in the range of 20 minutes.

> Well, I think this is not related to chronyd. Any userspace application
> may call adjtime(). It is not privilege that only chronyd is allowed to
> use that syscall.

Of course not, but the kernel relies on that application behaving
sanely. If it does not then the time stamps you are complaining about
are the least of your worries.

> I agree that this is not a kernel problem.
>
> But I'm asking, how my userspace application can measure time difference?
> As I wrote CLOCK_MONITONIC is not suitable as it is affected by those
> NTP adjustments and that is why I thought that CLOCK_MONITONIC_RAW is
> better as it is not affected by these NTP problems.
>
> But CLOCK_MONITONIC_RAW has a problem that is stopped during system
> sleep and that is why I thought that CLOCK_BOOTTIME_RAW should be there.

And how do you make CLOCK_BOOTTIME_RAW accurate? The clock hardware
can stop accross suspend/resume and the kernel then uses RTC or some
other hardware to inject the sleep time. That injection is not and
cannot be correct vs. the raw clock.

So exposing CLOCK_BOOTTIME_RAW would just provide yet another illusion
of time.

Thanks,

        tglx

  reply	other threads:[~2020-05-18 12:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 20:18 Missing CLOCK_BOOTTIME_RAW? Pali Rohár
2020-05-08 20:59 ` Thomas Gleixner
2020-05-08 21:31   ` Pali Rohár
2020-05-09  9:49     ` Thomas Gleixner
2020-05-18 11:11       ` Pali Rohár
2020-05-18 11:26         ` Thomas Gleixner
2020-05-18 11:35           ` Pali Rohár
2020-05-18 12:13             ` Thomas Gleixner [this message]
2020-05-18 12:49               ` Pali Rohár
2020-05-18 13:01                 ` Thomas Gleixner

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=87d071xwxv.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).