All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Karel Zak <kzak@redhat.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>,
	Arnd Bergmann <arnd@arndb.de>, "Theodore Y. Ts'o" <tytso@mit.edu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <john.stultz@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Florian Weimer <fweimer@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Subject: Re: New kernel interface for sys_tz and timewarp?
Date: Tue, 20 Aug 2019 20:58:30 +0200	[thread overview]
Message-ID: <20190820185830.GQ3545@piout.net> (raw)
In-Reply-To: <20190819110903.if3dzhvfnlqutn6s@ws.net.home>

On 19/08/2019 13:09:03+0200, Karel Zak wrote:
> On Wed, Aug 14, 2019 at 11:32:08AM +0200, Alexandre Belloni wrote:
> > On 14/08/2019 11:09:36+0200, Lennart Poettering wrote:
> > > On Mi, 14.08.19 10:31, Arnd Bergmann (arnd@arndb.de) wrote:
> > > 
> > > > - glibc stops passing the caller timezone argument to the kernel
> > > > - the distro kernel disables CONFIG_RTC_HCTOSYS,
> > > >   CONFIG_RTC_SYSTOHC  and CONFIG_GENERIC_CMOS_UPDATE
> > > 
> > > What's the benefit of letting userspace do this? It sounds a lot more
> > > fragile to leave this syncing to userspace if the kernel can do this
> > > trivially on its own.
> 
> Good point, why CONFIG_RTC_SYSTOHC has been added to the kernel? 
> 
> If I good remember than it's because synchronize userspace hwclock 
> with rtc is pretty fragile and frustrating. We have improved this
> hwclock code many times and it will never be perfect. See for example
> hwclock --delay= option, sometimes hwclock has no clue about RTC behaviour.
>  

With a bit of care, we can reliably set the rtc to the system time from
userspace. It takes a bit of time (up to 2 seconds) but it can be
reliably set with an accuracy of a few ms on a slow system and an rtc on
a slow bus or a few ns with a fast system and a fast bus.
I know I did say I would implement it in hwclock and I still didn't
(sorry) but we could do better than the --delay option.

> > It does it trivially and badly:
> > 
> >  -  hctosys will always think the RTC is in UTC so if the RTC is in
> >     local time, you will anyway have up to 12 hours difference until
> > userspace fixes that.
> 
> Cannot we provide all necessary information for example on kernel
> command line, or/and as rtc module option?
> 

We could but from a distro point of view, would that be convenient?

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2019-08-20 18:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  9:05 New kernel interface for sys_tz and timewarp? Arnd Bergmann
2019-08-13 17:10 ` John Stultz
2019-08-13 21:45   ` Alexandre Belloni
2019-08-13 17:30 ` Linus Torvalds
2019-08-13 17:49   ` Paul Eggert
2019-08-13 19:31     ` Florian Weimer
2019-08-13 20:04       ` Arnd Bergmann
2019-08-13 21:56   ` Alexandre Belloni
2019-08-14  0:06   ` Theodore Y. Ts'o
2019-08-14  8:31     ` Arnd Bergmann
2019-08-14  9:09       ` Lennart Poettering
2019-08-14  9:32         ` Alexandre Belloni
2019-08-14 12:15           ` Lennart Poettering
2019-08-19 11:09           ` Karel Zak
2019-08-19 13:43             ` Thomas Gleixner
2019-08-19 13:49               ` Thomas Gleixner
2019-08-20 18:45                 ` Alexandre Belloni
2019-08-20 18:47               ` Alexandre Belloni
2019-08-20 18:58             ` Alexandre Belloni [this message]
2019-08-27 16:27               ` Arnd Bergmann
2019-08-27 16:31                 ` Alexandre Belloni
2019-08-14 16:26     ` David Laight
2019-08-14 16:47       ` hpa
2019-08-15 13:22         ` Arnd Bergmann
2019-08-15 15:05           ` Theodore Y. Ts'o
2019-08-15 15:24             ` hpa

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=20190820185830.GQ3545@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=alistair.francis@wdc.com \
    --cc=arnd@arndb.de \
    --cc=fweimer@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=kzak@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mzxreary@0pointer.de \
    --cc=palmer@dabbelt.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.