Received: by 10.223.185.116 with SMTP id b49csp3612088wrg; Mon, 19 Feb 2018 03:05:46 -0800 (PST) X-Google-Smtp-Source: AH8x2260cE5M6+N80Mo866oxYgWQdTdqMbSHz3B7Ald82/FvKy5TgmZ7ImKHt5G9X+O/cR+7N+zR X-Received: by 2002:a17:902:2f03:: with SMTP id s3-v6mr14214457plb.112.1519038346213; Mon, 19 Feb 2018 03:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519038346; cv=none; d=google.com; s=arc-20160816; b=bPT6g+L+gWxpYXCMKqKdq/P2TLHotbTeNGiRydlVUc+zHsnZFeAuk2qnT5KEDGzyEA HxDdX4trrIn6No7rq9Udb+Eggj5ort6lcOn3Af/AW+57fknpzdj0GkBLSuBmUoeCTB7t 99vv9XrVnybpPPcy+oYz/a+4DBMS1CY1LQjtzM8WEzzropT5soZoXpXnqrU9KbzIqmzp v3MaEZ56Rfy52v54PnM6QyRP4IJ/MxOu9ALEYPeV3hY8tjyCU58c6hwfHgzZrMwM1Ohd BgFyCrxFQSIotdbSfwbqgUdB80v/bLFxDNGbroCvhdeEPzEfFZAZU7iG5rwO0sfr00BS 3Nxg== 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:arc-authentication-results; bh=4uU3rmr5Tn7NleIGPiQuwabCEb1XU7emWopuSdKtCQo=; b=RagnpSRve4dZkj0Hij7YFpZCFkrYlyUYOefO9FbA1u8jdh+Nm/UUkT6+1cUc3hQjGZ Ta+QLQYXi8HYZ8BBWDLGYKG+sbkss7FtJjSa0ZnwWyHcwKo994IFq4+o8sqYFbXgR2Q+ hfX9+Ti30mz3/YftM7y1+1Pz4BDiKm8s+8D5uNl4Q9IKUR22bqbaDo4jM//sow8QMwBy T3t6gzRlz937M0WgdTS2mw1Y2JAIAkCbEhdgo+yO0OYeWGumGp6lW/EjXn9+Ug4yYMkR j2gewXurif3CHmWHcZcvHmC9b8lxNr1ca5CfEHlD8eLDputS8h1Ep25Uyk+fetfxFxbW iqGg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si5697261plg.575.2018.02.19.03.05.31; Mon, 19 Feb 2018 03:05:46 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbeBSLDe (ORCPT + 99 others); Mon, 19 Feb 2018 06:03:34 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46980 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752486AbeBSLDc (ORCPT ); Mon, 19 Feb 2018 06:03:32 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35E5380125D6; Mon, 19 Feb 2018 11:03:32 +0000 (UTC) Received: from ws.net.home (ovpn-116-94.ams2.redhat.com [10.36.116.94]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7139A10B0F37; Mon, 19 Feb 2018 11:03:30 +0000 (UTC) Date: Mon, 19 Feb 2018 12:03:28 +0100 From: Karel Zak To: Rasmus Villemoes Cc: Igor Plyatov , linux-kernel@vger.kernel.org, Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, util-linux@vger.kernel.org, J William Piggott Subject: Re: 500 ms delay in time saved into RTC Message-ID: <20180219110328.n7yjorinjm3xxckr@ws.net.home> References: <30ae185f-28c9-54f1-2884-4ee7801b130e@gmail.com> <34f50661-85f5-eb46-3ff7-45f0c2bb5960@prevas.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34f50661-85f5-eb46-3ff7-45f0c2bb5960@prevas.dk> User-Agent: NeoMutt/20170912-66-504cd9 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 19 Feb 2018 11:03:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 19 Feb 2018 11:03:32 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kzak@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 19, 2018 at 08:11:05AM +0100, Rasmus Villemoes wrote: > It's because util-linux's hwclock still assumes the world is x86. See > this comment in the util-linux source code: > > /* > * The Hardware Clock can only be set to any integer time plus one > * half second. The integer time is required because there is no > * interface to set or get a fractional second. The additional half > * second is because the Hardware Clock updates to the following > * second precisely 500 ms (not 1 second!) after you release the > * divider reset (after setting the new time) - see description of > * DV2, DV1, DV0 in Register A in the MC146818A data sheet (and note > > So if hwclock is asked to --systohc at time 01:02:03.x, it waits until > the time is 01:02:03.5 to set the rtc to 01:02:03, or if that has > already passed, waits until 01:02:04.5 and sets it to 01:02:04. > > On our ARM BSP we patch util-linux to have the "implicit fractional > part" configurable, and trying to upstream something like that has been > on my todo-list for quite a while. See > > https://raw.githubusercontent.com/oe-lite/base/master/recipes/util-linux/util-linux-2.29/hwclock-tweak-delay.patch > > for the patch we currently use (on top of that, we change the 0.5 > initializer to 0.0 to avoid having to always pass the --delay argument). > Incidentally, it seems we're on the same util-linux version, so you > should be able to try out that patch and see if it works for you. Would be possible to somehow detect what is the right default setting for --delay? I mean for example detect architecture / clock HW, etc. I have no problem with --delay, but it's tuning for advanced users and HW specific stuff. It would be nice to have something more portable. Karel -- Karel Zak http://karelzak.blogspot.com