Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp820656pxu; Thu, 3 Dec 2020 13:33:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9r6Ems2mbSZMK4tDn4vRgppvqJka1+djWDPEHpPs5p93n/g7Cem8qpwGE2x6eKcb5355V X-Received: by 2002:a17:906:a51:: with SMTP id x17mr4386160ejf.97.1607031209157; Thu, 03 Dec 2020 13:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607031209; cv=none; d=google.com; s=arc-20160816; b=X3DScUVgiu/aYkABMGk8v2I745rcCt6wmBx528g2StwFXUvF+Z3jU2MVOWkJmY64cn g/AB0rIHnx1SuZbzXtw3U19AwAjEtyif0nJTaxDShgx6rxkJWWxY5TZfpQxMIwXxN+eg 0QdgIo+Zy8YxAoytSeN7g4u79JHIPEyQkdFZ6ki7hxjKyold6XgYSD95ShlsHtAXu4OR Ew2f53JRKfKMPa2jFt3Z7vjsjWhpQrs5JtjVjP++s6/hB+EJcqvUhqh5YvEX4J0kug75 IKv3gzTT28L0iMcJi/WsNc5w/hHj0eT7CBw+jk055GP5IWt1lsJCIX90+W4RmGwCjLog 8UeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=y6t87COzzxb5+LKoDByx21aiE9mMgZNsbodr8zb3eR0=; b=gGADofwAQtguag5PuOlZE+HAzL1433fBcP71DmuvoFlQE/ZJan/PfwM+AiJzUov6/I 0pM8jQC4bvSKTh1+AJ3zGIko7q3AwuyGNqD0sb0ffHO468Fa0obm5eGxMBYs8Rha/O66 +Eid0pZm3CLAoBWV+uIJYOdJQTWU1ByWP//e46oVaVFegZQ5n44zUqMhagCMPsFvPkHf vFmpcI911VN3O2axt/C5m6gcbjwQvcYNGpUBp0Uhwq1U8uuIz+P4MivH2+SnfqwySYgP +3ViqG6yq6JzOYGqM81hg6yyUfQak2X3AnsT9wEAkr91QCCAe0EJN/JzG/Z3jTL/UGcF ++1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FTKTIhQ+; dkim=neutral (no key) header.i=@linutronix.de; 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 x20si157892ejb.165.2020.12.03.13.33.04; Thu, 03 Dec 2020 13:33:29 -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=FTKTIhQ+; dkim=neutral (no key) header.i=@linutronix.de; 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 S1727513AbgLCVbo (ORCPT + 99 others); Thu, 3 Dec 2020 16:31:44 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42838 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgLCVbo (ORCPT ); Thu, 3 Dec 2020 16:31:44 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607031062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y6t87COzzxb5+LKoDByx21aiE9mMgZNsbodr8zb3eR0=; b=FTKTIhQ+z6vRwq3w1QmnlFuypMlY3MkX1wogolO0pE+V+odbzG73Ji0cyvCzDqtcjcfIKj pcguVmUorAOXDIZVwT3GHthKLftKsN/LKPwvgpU4YZAJPXIZJsbu8eRDvYfig3FQvF9B2A FpQbJKBiu44+n9H8yc/Ne4v2lvERN3gFYbn8ws6tHo3P3HnyLlT6gBCV0krM3OwOVxeD9P ugIhON0V1af10d9erFLk31sFLlUUsKBI7c4jhzBfvJI/pPaYiTRzhtREV0jlUCjKhDJB5v NTVZbaImuApmriYSKnUyt9S6tOXRG8SbQCt3msWMas8GW3cY1wj6jjDX6A9F8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607031062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=y6t87COzzxb5+LKoDByx21aiE9mMgZNsbodr8zb3eR0=; b=Ydqaubx/r3c4q0uzu+msHcYDpVRj/O+qc+ZtJT27uPp0QvPOUqWbp/CwvC+0YAPNd9VHBt H9MXCxAFyUULfAAw== To: Jason Gunthorpe Cc: Alexandre Belloni , Miroslav Lichvar , linux-kernel@vger.kernel.org, John Stultz , Prarit Bhargava , Alessandro Zummo , linux-rtc@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH] rtc: adapt allowed RTC update error In-Reply-To: <87zh2ubny2.fsf@nanos.tec.linutronix.de> References: <20201201171420.GN1900232@localhost> <20201201173540.GH5487@ziepe.ca> <87mtywe2zu.fsf@nanos.tec.linutronix.de> <20201202162723.GJ5487@ziepe.ca> <87a6uwdnfn.fsf@nanos.tec.linutronix.de> <20201202205418.GN5487@ziepe.ca> <874kl3eu8p.fsf@nanos.tec.linutronix.de> <87zh2vd72z.fsf@nanos.tec.linutronix.de> <20201203021047.GG3544@piout.net> <87pn3qdhli.fsf@nanos.tec.linutronix.de> <20201203161622.GA1317829@ziepe.ca> <87zh2ubny2.fsf@nanos.tec.linutronix.de> Date: Thu, 03 Dec 2020 22:31:02 +0100 Message-ID: <87wnxybmqx.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03 2020 at 22:05, Thomas Gleixner wrote: > On Thu, Dec 03 2020 at 12:16, Jason Gunthorpe wrote: > So now we have two options to fix this: > > 1) Use a negative sync_offset for devices which need #1 above > (rtc_cmos & similar) > > That requires setting tsched to t2 - abs(sync_offset) > > 2) Use always a positive sync_offset and a flag which tells > rtc_tv_nsec_ok() whether it needs to add or subtract. > > #1 is good enough. All it takes is a comment at the timer start code why > abs() is required. > > Let me hack that up along with the hrtimer muck. That comment in rtc.h makes me cry: /* Number of nsec it takes to set the RTC clock. This influences when * the set ops are called. An offset: * - of 0.5 s will call RTC set for wall clock time 10.0 s at 9.5 s * - of 1.5 s will call RTC set for wall clock time 10.0 s at 8.5 s * - of -0.5 s will call RTC set for wall clock time 10.0 s at 10.5 s */ Setting the wall clock time 10.0 at 10.5 is only possible for time traveling RTCs. It magically works, but come on ... Thanks, tglx