Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4861172rdb; Fri, 15 Sep 2023 14:56:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuoRM+Kw/WlFqjQ4GFDXNy+o/alRW0F+ImSITgwTMssGgQCnPUojj2ndzyyr4hLxDj8aj2 X-Received: by 2002:a17:90a:1506:b0:274:7de5:10c7 with SMTP id l6-20020a17090a150600b002747de510c7mr6785904pja.11.1694814961108; Fri, 15 Sep 2023 14:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694814961; cv=none; d=google.com; s=arc-20160816; b=UpkXGTiwgFD8Vg+OWCUyZGhNPSuP6wU8qVJIpE5kimsnOAUPAoW42BHf9YKVM1kELd /DOb7+pkSXzq1aLi0Sm1v7yEGnDeUU61a5xOUFyFYTqW+h3mxkwA3K/AP6APEM4Cv28e dSI3QxZaWGg3Kq5r1C4N73GopOAYC6Xn3gjIkb+9JUa29Y4c/JG7JXRN9VOFb6RQPPcl hl2x/QAv93qTKJD6GgR+qk26oearrEKfplJoA4IxxeK2zR9zKGaNypE9vGhOJ6V2AdHK tWV/Y8SJocArIEK4jsEzuIzYYkomfF0AO4qjC+3IKXmAal7Pd9D4VeVM9i2ncw0u54HZ ZdoA== 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=sLPP8onuSARsCwSAyYrp8gYtOMK/jw8QlFYWJcq0fcE=; fh=gMvK7JK5tekdbBHDV6qPzJcai+54eIwtEYX8fDtRLY0=; b=XJBdLJcoH3AAGa+0milyUzvtpxREBWCnG4NSXkC+N/REKLJDyIqwopC0HDecQvZjNJ Q9Ew7yiFfrRf0g+QI1NECl1VT9lNa9XcDhoqqP/beNn1XBAfjdae4XLJDbvbHgHfiz3x 5JfK7WUIovLSD1OHcBagrIqZHo47Vid1dcTvYYNup0HRASYfkt5rSNLBx6QP6zuFgmi9 8CFXY7t53cjGNuvs/TmkS5Rrpv6dDy/sBQSDeS57dKKJuUPU+oJnDo6MRAgeDVchdzAm 6dKOnU71kz/rBRg/SHABZJTozIJr9R+voIUQPBs27sPhLFaJfacXUPQrGr1S8OvQ5SiE Q1Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oRn7XqWn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id kb7-20020a17090ae7c700b002680cee323dsi812838pjb.119.2023.09.15.14.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oRn7XqWn; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DF9F081BFA96; Fri, 15 Sep 2023 09:11:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234645AbjIOQK6 (ORCPT + 99 others); Fri, 15 Sep 2023 12:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236527AbjIOQKq (ORCPT ); Fri, 15 Sep 2023 12:10:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B1710D9 for ; Fri, 15 Sep 2023 09:10:41 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694794239; 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=sLPP8onuSARsCwSAyYrp8gYtOMK/jw8QlFYWJcq0fcE=; b=oRn7XqWnkQnAmaJV6aBUM/oKsxviO5+GNKo1OwPVxanXWOZQHXavRSTuAXYLtBELrBVyin +fSBVxmYP4v9GP99Y+xXxsacOyucTbGGoUu59E9yThIhYi34LRERtmbtuBcCq+ojF7WaJe ktoyF3D9XsUmQoYtNPEio9KyhXooIIwssu3HV9FnFZIo0TbRD96on/m81OT7H4USqwciY9 UCFJXWlYGOhk1f2ML35qEisreUNoJFTZrD8N34KUjuu0FfOX9n+736NbpIioa4O3bzPYLj rDRE+dn65ghnx2bqxoSljR/n2QSOkCNgD2saOYI+wTfOVHlC0Y/XWUzsb5J5ow== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694794239; 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=sLPP8onuSARsCwSAyYrp8gYtOMK/jw8QlFYWJcq0fcE=; b=mnTcMeZs9Sbv0Bn2wQxLtttoppMBS99jcRXgk8P4ouf0GqPzbxAoCqqrM0uBttSvnPVVMF JXkLGdrRh0fmo5BQ== To: Peter Hilber , linux-kernel@vger.kernel.org Cc: Peter Hilber , John Stultz , Stephen Boyd , "Christopher S. Hall" Subject: Re: [RFC PATCH v2 2/6] timekeeping: Fix cross-timestamp interpolation corner case decision In-Reply-To: <20230818012014.212155-3-peter.hilber@opensynergy.com> References: <20230818012014.212155-1-peter.hilber@opensynergy.com> <20230818012014.212155-3-peter.hilber@opensynergy.com> Date: Fri, 15 Sep 2023 18:10:29 +0200 Message-ID: <87a5tn1kp6.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 09:11:34 -0700 (PDT) On Fri, Aug 18 2023 at 03:20, Peter Hilber wrote: > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -1247,7 +1247,8 @@ int get_device_system_crosststamp(int (*get_time_fn) > */ > now = tk_clock_read(&tk->tkr_mono); > interval_start = tk->tkr_mono.cycle_last; > - if (!cycle_between(interval_start, cycles, now)) { > + if (!cycle_between(interval_start, cycles, now) && > + cycles != interval_start) { > clock_was_set_seq = tk->clock_was_set_seq; > cs_was_changed_seq = tk->cs_was_changed_seq; > cycles = interval_start; So the explanation in the changelog makes some sense, but this code without any further explanation just makes my brain explode. This whole thing screams for a change to cycle_between() so it becomes: timestamp_in_interval(start, end, ts) and make start inclusive and not exclusive, no? That's actually correct for both usage sites because for interpolation the logic is the same. history_begin->cycles is a valid timestamp, no? Thanks, tglx