Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp413183pxu; Fri, 11 Dec 2020 05:30:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2Xybow3qmcxbfkSS/Kur0Jb985wSrVHrYl3h0Hh16EFEKCo0ifaRms7/Sc4y6aDjMBx8c X-Received: by 2002:a17:906:5c53:: with SMTP id c19mr11088213ejr.31.1607693437137; Fri, 11 Dec 2020 05:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607693437; cv=none; d=google.com; s=arc-20160816; b=znf+OksE/1vtVQC+pZf99kjOCw7gZt90mqdl+VmAYYu3Uo137PQOilcjDV4OJwT0DG RlefVUFRX7Gc3lJ2E44z08jLmAAzgm2F9nT1BD1U/X+vf5C2X6Ao6bhSXtkIzLw24XY1 a13A1az924czY+PLostmF/oKOAaVdRn4gL0mZcV8rqs97I9SsOGm9q9wQuiOwcHhkD8X gXtR3KKnH5GXmvCkJNDz2uMkPMSk038t9Pb4fkQbXb5jGbaXfWs2XAUfaQTUDjNFtv7M kQwWortAWkwB66z60VWmafnEihAcETymWv4GbHTC/1BzsnkjBc7+j2tcEmnq+ILpWN7E xzaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=SBvGKPV2OVTCkl+8K+EDqN/wn4WkHTO9C6ic/8Pxb8I=; b=qK6hdGhw+F1mL4X5NpcCTqW4NTrjJqsFeedwe/89akt4l9mH77rSokU4K1C4XXWaG2 fA2VPx0nVD0bj+g2PwRCSp8CliRgz0KqucEKkPrT8yFN1VPv2Sy1xEp0yzCSejakfmaH 7G86+LHZMSLkBagT9YTTSCVEMt9IZlcP5D86x+fsnLF0fLcHDS5AC+RoSKkULaiL7cZE GDxC2ETrxu+eH72hFjRKn8n5arnWXZOnP+a2c0gIwWcz9sbsoF5US8E3OBw8AZH/yJq1 jZS4pd4IzbAZT/+kEZmw8+G+aa9rZL9p2acmAcCb7tEsnpqHTzYdZdBsDLt59wP981yL 48Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UjsQan7N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=sUHGLKxz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si5665925edi.312.2020.12.11.05.30.14; Fri, 11 Dec 2020 05:30:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UjsQan7N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=sUHGLKxz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404708AbgLKKJD (ORCPT + 99 others); Fri, 11 Dec 2020 05:09:03 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:33658 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394189AbgLKKIb (ORCPT ); Fri, 11 Dec 2020 05:08:31 -0500 Date: Fri, 11 Dec 2020 10:07:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607681269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SBvGKPV2OVTCkl+8K+EDqN/wn4WkHTO9C6ic/8Pxb8I=; b=UjsQan7NBXyp/wbWAGk+bBhvgaEMYJxFMYePjZez7fk8A4zWr612R0Ua8lZpZNvi1uXIW6 TaTpt0jqTctdEVkbEYZvdBDMKkc1+pP7VvYuPlJ0ApXXwNixjAd7EY4zc1NdGiKk1RvIil Hx0NGgNzXBYRJ8nBSFuaBuXJeP3ZXeW15gZq9Cv/psTZA6YxsBRl3mABklcxaI0atgjFMv gdULIilinFmit0c5glBCOXvX446SW18CHDxYLR6J76bDql6pipArXCbSwZXFD6QXAKhvx0 8yOIf7sYumlYXwj0V1DdnzLw1tjKEft6Nb3V7J8YB7MgErFAhGIs0Qk66y54kg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607681269; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SBvGKPV2OVTCkl+8K+EDqN/wn4WkHTO9C6ic/8Pxb8I=; b=sUHGLKxzlBZloX/azEl7qVTNEBMSHgWfSSV4DklCIPwvSw48VrvjZviH5aCVnqcfHv/vcz rrGaMjwN6N9rqvDg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] rtc: core: Make the sync offset default more realistic Cc: Thomas Gleixner , Jason Gunthorpe , Alexandre Belloni , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201206220541.960333166@linutronix.de> References: <20201206220541.960333166@linutronix.de> MIME-Version: 1.0 Message-ID: <160768126856.3364.5793452465667820989.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 354c796b9270eb4780e59e3bdb83a3ae4930a832 Gitweb: https://git.kernel.org/tip/354c796b9270eb4780e59e3bdb83a3ae4930a832 Author: Thomas Gleixner AuthorDate: Sun, 06 Dec 2020 22:46:17 +01:00 Committer: Thomas Gleixner CommitterDate: Fri, 11 Dec 2020 10:40:52 +01:00 rtc: core: Make the sync offset default more realistic The offset which is used to steer the start of an RTC synchronization update via rtc_set_ntp_time() is huge. The math behind this is: tsched twrite(t2.tv_sec - 1) t2 (seconds increment) twrite - tsched is the transport time for the write to hit the device. t2 - twrite depends on the chip and is for most chips one second. The rtc_set_ntp_time() calculation of tsched is: tsched = t2 - 1sec - (t2 - twrite) The default for the sync offset is 500ms which means that twrite - tsched is 500ms assumed that t2 - twrite is one second. This is 0.5 seconds off for RTCs which are directly accessible by IO writes and probably for the majority of i2C/SPI based RTC off by an order of magnitude. Set it to 5ms which should bring it closer to reality. The default can be adjusted by drivers (rtc_cmos does so) and could be adjusted further by a calibration method which is an orthogonal problem. Signed-off-by: Thomas Gleixner Reviewed-by: Jason Gunthorpe Acked-by: Alexandre Belloni Link: https://lore.kernel.org/r/20201206220541.960333166@linutronix.de --- drivers/rtc/class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 7c88d19..d795737 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -201,7 +201,7 @@ static struct rtc_device *rtc_allocate_device(void) device_initialize(&rtc->dev); /* Drivers can revise this default after allocating the device. */ - rtc->set_offset_nsec = NSEC_PER_SEC / 2; + rtc->set_offset_nsec = 5 * NSEC_PER_MSEC; rtc->irq_freq = 1; rtc->max_user_freq = 64;