Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4042711ybd; Tue, 25 Jun 2019 13:01:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/LWEwhfwleoX+/AMltV2TWNuzGtnfRwux5bieMJcLrk6DA7h6ZHLqCKzEiHMOcJ9IEgb4 X-Received: by 2002:a17:90a:c481:: with SMTP id j1mr680170pjt.96.1561492888879; Tue, 25 Jun 2019 13:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561492888; cv=none; d=google.com; s=arc-20160816; b=Ef6gFlMqoI5IgxF0JxPU3gYNCsjyTqFeb4h5ppifL4U2TRzuUBdsTxA+xwaok3bRHQ iPgeDtQVbgBQWQ5QzjSO4dnefow9SPz7wkxu+wlfl4a5QPjqdFKsCMpHr+TIg70LcHma YRLrqED+7ihbHF/8vL80+MkOu4Tuew545Ifrc5d664Mqzo6sWgdeEf1Cvu/xsmxA6t0+ QpbyL72CBDfSdizuPRgoyIFwoFd6rIH17ZfZao+QNqjMVYXXjyak9XSESRD/wlNiNS4d 92U2MF4fTNm0r/OxrxtKx5LxAhXDISY4e47cXHQ3iMj8ot/GegRwnlCZby0QFo96cFRz Lf5w== 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=bfl5phhcTlGb6GcxMB4qVudWFvvEfOt3qVSEo6c54C0=; b=YeNkTUM2QupENGGAcPyOtEkZc3OVb7LiLXRU3Z3ULHKLjpdvR+Z0QqmTEzfC+pbitP hCIfTt4Pigd2AkEAkfyuBZkTJJyMfINswIxmri5BYmovQnF8xBvEwMSI8yWhD6eb/uDa 0ycDjIYEi4eiDnyX9Kgh9QD/ZYQ05A60/xdq21ZkalO64QY1irYhgkcbxWfXaHuOD4vR Rri2U9vuIbbr5zPSWj5Lcy2yvCtwXPFT47toO0wFGl7xEvpLhiN5Y4YRf27J3aPFenoV mDHaHtPbQ5O3aQGJoXB33tOcWpuT/ZMMAj+BiXVuuPJ+v96a16Z9ddoTMCDHn87jtOeL zsFA== 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 d5si2190809pgc.596.2019.06.25.13.00.49; Tue, 25 Jun 2019 13:01:28 -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 S1727711AbfFYTTx (ORCPT + 99 others); Tue, 25 Jun 2019 15:19:53 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:58627 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbfFYTTw (ORCPT ); Tue, 25 Jun 2019 15:19:52 -0400 X-Originating-IP: 90.65.161.137 Received: from localhost (lfbn-1-1545-137.w90-65.abo.wanadoo.fr [90.65.161.137]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 18B5DC000B; Tue, 25 Jun 2019 19:19:46 +0000 (UTC) Date: Tue, 25 Jun 2019 21:19:45 +0200 From: Alexandre Belloni To: Trent Piepho Cc: "fthain@telegraphics.com.au" , "linux-rtc@vger.kernel.org" , "a.zummo@towertech.it" , "userm57@yahoo.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] rtc: Don't state that the RTC holds UTC in case it doesn't Message-ID: <20190625191945.GH5690@piout.net> References: <3e1e24a326b8b623b1a8b66a905ac6494ef74a07.1561081886.git.fthain@telegraphics.com.au> <20190624195705.GD5690@piout.net> <20190625092926.GE5690@piout.net> <1561483011.2343.6.camel@impinj.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1561483011.2343.6.camel@impinj.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/06/2019 17:16:52+0000, Trent Piepho wrote: > On Tue, 2019-06-25 at 11:29 +0200, Alexandre Belloni wrote: > > Userspace is certainly adjusting the timezone after the kernel did. Can > > you run the same commands without running your init? > > > > On stable, you have /etc/init.d/hwclock.sh that still runs and does the > > correct thing. My understanding is that systemd also handles the TZ > > properly after hctosys (see clock_is_localtime()). > > > > Seriously, hctosys does a really bad job at setting the system time, it > > is guaranteed to be always wrong on most platforms. My plan is still to > > try to get distros to stop enabling it and do that properly in > > userspace. This is already ok when using sysV but systemd would need a > > few changes to stop relying on it when then is no hwclock initscript. > > Unfortunately, I didn't have time to work on that yet. > > hctosys is very handy in that it sets the system time before any log > messages are generated. Either in a main boot or in an initramfs. > Having property time-stamped log messages is very important for > managing a large deployment. > > If the system time is set by some script or systemd unit, then there > will always be all the things that need to run before that script or > unit can work. E.g., udev creating rtc device nodes, mounting /sys and > /proc, systemd generator for local file system unis, the other parts of > systemd to do that, etc. All this won't be able to log with correct > system time. > I'd argue that this system time is not correct anyway and hence is not that useful. Especially since the boot time to anything reading the RTC will still be smaller than the maximum error hctosys can have (that is up to two seconds). This is even worse if the RTC sotres local time. Instead of using a systemd unit, we could make systemd read the RTC as soon as possible and set the system time correctly (at least, that is my plan). This would be especially useful when using NTP because as already reported, it may take a few hours to actually synchronize because hctosys didn't set the correct time. I would agree that there are remaining use cases for hctosys, e.g. when wanting to boot a rootfs over a network filesystem and without an initramfs. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com