Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5781158ybl; Tue, 27 Aug 2019 09:33:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNkbmU4eD/QHci/aftjx2sDhW5fYjHCQhilUhHCublKgWawZIfWj3QzHfjiJaOM6NEJkFQ X-Received: by 2002:a63:6106:: with SMTP id v6mr21754820pgb.36.1566923600053; Tue, 27 Aug 2019 09:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566923600; cv=none; d=google.com; s=arc-20160816; b=pT3N7r2Yhk9Ktrn0CY7a6ACNZ/tCvhVSKwpfr64xhaNdbAhLfkEQcoZbbvYsGDflso P5iUqOxW/DzwuRzyVBtRr+RB/cgcs7tJhFEBWnvq5B5kOmF2n3yklzkc9br6hdtLvRzP UDrgxZ37ATOoOpx1+qGI4sdG8kp+ed6+z0Wj0V4C5f9bsk8KOnZVeIO6AN5nWdni5Fm8 BR5a/VbfTfV1q2YrJ62fJGcDfp1WlxW2JMfF2nLendNNygNNlZWaENrBkQMYruDDVv1y vanbAJqvanqR+ebXbRvS03CFryLdiBuAYKrATkjXwNl8IkAPUe2yZLZv794gwQpiaAun H69A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tbpK84pqEKp0kq7pwPeW4HXUAuR4bHJ6f2HomkBJhVI=; b=PH3HTqcSjab0K5zaIq6S36qjBFaUgu5JYjeH5efxKgvMuSGKdIWKBfPG+6BjXt0Feu pomaHiTqxitlpFAWdFMmHcaDaOrxV09GOwMenZeRyrGKLBOd9ZzNewCgfjqpzXtvH9fJ gabKfYQMlGepDpjl8BquKVDp1/MY93dMawVKt3DLeSR5qR8lz9O4gxFRQ3lQDOhFUOS5 gpv5FB2XazPTS6eR0jXw70xzPdyA8fFuiwlhtC9qDizjsQwtpf0/ZtrLb/4yT1Ao1WIP 6lWtZ1jHZWb3QoEHdJZFjo13QHbEjJHbFJ3dJglNbyK5/wE1Wyp9IOywb0DS2oLazyAa LTnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si6594447pfe.259.2019.08.27.09.33.04; Tue, 27 Aug 2019 09:33:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730185AbfH0Qbn (ORCPT + 99 others); Tue, 27 Aug 2019 12:31:43 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:40221 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfH0Qbm (ORCPT ); Tue, 27 Aug 2019 12:31:42 -0400 X-Originating-IP: 86.207.98.53 Received: from localhost (aclermont-ferrand-651-1-259-53.w86-207.abo.wanadoo.fr [86.207.98.53]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id CFBC124000E; Tue, 27 Aug 2019 16:31:37 +0000 (UTC) Date: Tue, 27 Aug 2019 18:31:34 +0200 From: Alexandre Belloni To: Arnd Bergmann Cc: Karel Zak , Lennart Poettering , "Theodore Y. Ts'o" , Linus Torvalds , Linux Kernel Mailing List , Thomas Gleixner , John Stultz , Stephen Boyd , Florian Weimer , "H. Peter Anvin" , Palmer Dabbelt , Alistair Francis , GNU C Library , OGAWA Hirofumi Subject: Re: New kernel interface for sys_tz and timewarp? Message-ID: <20190827163134.GC21922@piout.net> References: <20190814000622.GB20365@mit.edu> <20190814090936.GB10516@gardel-login> <20190814093208.GG3600@piout.net> <20190819110903.if3dzhvfnlqutn6s@ws.net.home> <20190820185830.GQ3545@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/08/2019 18:27:32+0200, Arnd Bergmann wrote: > On Tue, Aug 20, 2019 at 8:58 PM Alexandre Belloni > wrote: > > > > 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. > > Would you use the regular RTC_SET_TIME ioctl for that, or > add a new RTC_SYS_TO_HC command that takes an explicit > offset? It sounds to me that the synchronization bit (actually > waiting for the right moment to update the rtc registers) is better > done in the kernel, while the decision about the offset and when > to call into the driver is better done in user space. > The existing ioctls are fine to do that, see: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git/tree/rtc-sync.c -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com