Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp48967imm; Tue, 18 Sep 2018 16:18:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaXWsXlW5mZk0B5/wipK8aWs8jn0/9M8uy3T0DsIlloWdJUwKzyNLyKi8u4g6fE0Xav5Afv X-Received: by 2002:a63:4606:: with SMTP id t6-v6mr29613292pga.271.1537312710932; Tue, 18 Sep 2018 16:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537312710; cv=none; d=google.com; s=arc-20160816; b=Ztz26neVZeT8mnISHpS/mDozvZ+QAxDfyfpK17vD3Ip+l+1Xdt39qi7arySNsJqkDS pn2pV42a06NyjjycH+IroXTNnRVHw2M5t5qRYdauC0wBouRiok5Z3Ql3MgeTQ1lZQbV3 Plu4yJsCq6ceVFcRKe689ytH1Dm87XjeFH1bHceEczqmA/ELrezKz7Cejs/8/vn5X+xa rlJy6mux7YthQuLcPLhoa0PyH57o314vHRRYY9DXzgpCm/iXlFSfrnmhoi39D9AvdaHW yt4rZ8Zdjvzx+T8o0yoLF72wTxybck0P2K6xxvzn8agLTYWCCaRuqv3Xpp/MloFYVTF3 TOWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=k/dt3K+8CecDQeZGeKyGtIB5oI4IeYwpu/HyX5ZnBIw=; b=wXKtPQMRITyiV43UF5L1Uevzb9reIP8FVQzkrgWRjutjMf6IeUuS+jIr0mGLozRXxQ ecuMddpjTa7Ch26ubYLUN2bZ1vYaEKIeP+tC7S1PiCPykkbttdTtK7GCetBsAWO1ZnNG 1zIWbsBykOOxTI1tJ0YC0o44IRhMvylbjQNf2OqgC0iFd0xXvCr5+iCObT+XmVjI0eA0 Teegb1IBzhCB47kcXPUTYHj2zvd/mzFJcGXPfMqzPsTMTdtNjruZhxPGD+2jQB87pjMi 6G5+wJGVtT/MNjddQbfdPxDSdAq5sim2oUdbBIfrnWnSOndHKK7P1Jf9TxvuMv2KIZoO 4iBg== 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 t19-v6si17041840pgu.285.2018.09.18.16.18.15; Tue, 18 Sep 2018 16:18:30 -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 S1727987AbeISEvp (ORCPT + 99 others); Wed, 19 Sep 2018 00:51:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59134 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbeISEvo (ORCPT ); Wed, 19 Sep 2018 00:51:44 -0400 Received: from p5492e4c1.dip0.t-ipconnect.de ([84.146.228.193] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1g2PEd-00067g-21; Wed, 19 Sep 2018 01:16:47 +0200 Date: Wed, 19 Sep 2018 01:16:46 +0200 (CEST) From: Thomas Gleixner To: Andy Lutomirski cc: John Stultz , Andy Lutomirski , LKML , X86 ML , Peter Zijlstra , Matt Rickard , Stephen Boyd , Florian Weimer , "K. Y. Srinivasan" , Vitaly Kuznetsov , devel@linuxdriverproject.org, Linux Virtualization , Paolo Bonzini , Arnd Bergmann , Juergen Gross Subject: Re: [patch 09/11] x86/vdso: Simplify the invalid vclock case In-Reply-To: <439A3E73-E4FF-4D66-800E-5BEE58EDE8F6@amacapital.net> Message-ID: References: <20180914125006.349747096@linutronix.de> <20180914125118.909646643@linutronix.de> <863331ED-B04A-4B94-91A2-D34002C9CCDC@amacapital.net> <439A3E73-E4FF-4D66-800E-5BEE58EDE8F6@amacapital.net> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1986204183-1537312607=:1468" X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1986204183-1537312607=:1468 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 18 Sep 2018, Andy Lutomirski wrote: > > On Sep 18, 2018, at 3:46 PM, Thomas Gleixner wrote: > > On Tue, 18 Sep 2018, Andy Lutomirski wrote: > >> Do we do better if we use signed arithmetic for the whole calculation? > >> Then a small backwards movement would result in a small backwards result. > >> Or we could offset everything so that we’d have to go back several > >> hundred ms before we cross zero. > > > > That would be probably the better solution as signed math would be > > problematic when the resulting ns value becomes negative. As the delta is > > really small, otherwise the TSC sync check would have caught it, the caller > > should never be able to observe time going backwards. > > > > I'll have a look into that. It needs some thought vs. the fractional part > > of the base time, but it should be not rocket science to get that > > correct. Famous last words... > > > > It’s also fiddly to tune. If you offset it too much, then the fancy > divide-by-repeated-subtraction loop will hurt more than the comparison to > last. Not really. It's sufficient to offset it by at max. 1000 cycles or so. That won't hurt the magic loop, but it will definitely cover that slight offset case. Thanks, tglx --8323329-1986204183-1537312607=:1468--