Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2113561imm; Thu, 27 Sep 2018 07:38:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV61UAyGHKL5IEH/M5Dglojo0GnTaGEyXUPuSRz3pw9lMHnfgTl8l56imDmD8/rYBH0m5MfnR X-Received: by 2002:a63:d44:: with SMTP id 4-v6mr10723345pgn.107.1538059114734; Thu, 27 Sep 2018 07:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538059114; cv=none; d=google.com; s=arc-20160816; b=p+yfQ1eCryMzLlfcUgGV90ZBXJfrZXnoGlXkRNKZAAgi+QqVwXL1B25LWAd2BaxQtV pkftfuwdDX975GetGZ63ibA92EwiLwcIYnW/d9rcbMQwrNUzpPimcXeWesiFEMFc3/Vu hCj7w+4uMyDEE9z3ccwFID3GM+z0qB985vZwZltq8heMyFYRqSKm+Zipb/4ErcW0W2BR Q++gwEfheya36NLYB+tS7cToFC/1R+Rhpiz1aMnE59j6mDgHC3ly/ncFO9Futpe1L82t B0zd9RWUdSD8M1xnBwWB/VySAksYzXziFREPS3RTnlajPLmJfAtit9wrnQS6kCzesvrU UDsA== 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=PSWVmLu8RXDpVslFL/mafgGmx2Zk1Eq8zChq5HJ60Ko=; b=nMVHWe3CxeC9+GZE5NUSUJi3Lcp6Zss7NhfG7dbiN6J3VrIlSlVCgX1i+MuSRbv/R0 ymp0tVdXeVA+l+IG3cD9L932Nc70jrlU2zfuGpCBaJ3YP99P/GdlGOvmprzOO8LqOX57 cjXm8HBJFaM3avAOzqDgmWLRAyc3CAqhheb5TCA0tXvAA1TtLcAhOCq2sTV4p7M2bo7S Bvnr1TrUZs1Osnik56N8VYAAHLX30VeiWMNX4V+Et0zavGzk9qIkHzYX4DNAh2y6usPa BYfQmJsK8+Uwyk2rPu60TolnTpOM8sNMvQZNiN3SJBbagHP40OMScc5QbzmInX8ua6Bf TVeg== 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 19-v6si2028494pgy.577.2018.09.27.07.37.52; Thu, 27 Sep 2018 07:38:34 -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 S1727377AbeI0Uz1 (ORCPT + 99 others); Thu, 27 Sep 2018 16:55:27 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:52123 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727262AbeI0Uz1 (ORCPT ); Thu, 27 Sep 2018 16:55:27 -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 1g5XPK-0005Ix-DA; Thu, 27 Sep 2018 16:36:46 +0200 Date: Thu, 27 Sep 2018 16:36:45 +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: 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-882047337-1538059006=:8118" 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-882047337-1538059006=:8118 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 19 Sep 2018, Thomas Gleixner wrote: > 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. I got it working, but first of all the gain is close to 0. There is this other subtle issue that we've seen TSCs slowly drifting apart which is caught by the TSC watchdog eventually, but if it exeeds the offset _before_ the watchdog triggers, we're back to square one. So I rather stay on the safe side and just accept that we have to deal with that. Sigh. Thanks, tglx --8323329-882047337-1538059006=:8118--