Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2115106imm; Thu, 27 Sep 2018 07:39:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV60BT35+CbE9XSyGMOeWKNO3spJd8W+kPVTXJyXHkoffVP2ySiSpk1H2D5jp3JRIEZTxrHkv X-Received: by 2002:a63:b518:: with SMTP id y24-v6mr6531402pge.436.1538059198360; Thu, 27 Sep 2018 07:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538059198; cv=none; d=google.com; s=arc-20160816; b=X/2FrBIr8MDIHSX5Fqw2csk25/0eRdsQk/cFZZNCNo4gJ0PFafIPawrOJlPYZXNvWp tq7FNAhxF7CWgBbW3tksLqFdoH59CbgM5EnViughv0xdQPj4v+b93cB/ApUtJAySXDkm fZsQoPrB5r4yldQtAjDQgh/z/AMhz3An4Yd8UqLEwzEJjxs7naTsq0fADZ2szNw8rsXJ pJ0y6QY9obqTczRBAj/zwmanBraOcT3BfRXlbNNLFiWovAnbf5hAtDtVNabHAZ8RlpLb TyvQPzNxAiqJp0uRVUhV5VcnLVAeEBKvhq3HUTtegr7stHvTjAL0HHwG0Uv8WCPJKfQj SS+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=DYsgbCn5njmRP2uXseDX3RspyQyFqKQhi2Q4EObCBdU=; b=fGfCqZm06stHA7mPsMFAalOU3u/c4Nlecwu9F14T0Xoy5dQVzUyQC1rdAxyoUg8GSs hxkrcIoyJRwyRB4LJVia3UAYLbHc+g60AGsGm8PDYOwwxxLg4RLxhcKkU8juLSTuVisV ++TOxgwO81O4MKnTQIOuh6rffQa2NtZrE2bm51HX7baZnYDqlbh5DPs0ZH9qGF4zW/mf TZfnNRJ4OLJZEhZFuR+wmc4R8qAoaKtNlDmpbV9BiZIQIRX9MR39QyoBVFw9W5DorQaO FrqlmAg070SwTnl65oBopDBMgrnj9TuT4JYrDSPGLAAEqyWDxAGLXuGGQO4y1aF76tz6 hETQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=qwulYmxK; 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 p23-v6si2080458pgl.394.2018.09.27.07.39.35; Thu, 27 Sep 2018 07:39:58 -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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=qwulYmxK; 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 S1727725AbeI0U5o (ORCPT + 99 others); Thu, 27 Sep 2018 16:57:44 -0400 Received: from mail-pf1-f177.google.com ([209.85.210.177]:33504 "EHLO mail-pf1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727338AbeI0U5o (ORCPT ); Thu, 27 Sep 2018 16:57:44 -0400 Received: by mail-pf1-f177.google.com with SMTP id d4-v6so2095428pfn.0 for ; Thu, 27 Sep 2018 07:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DYsgbCn5njmRP2uXseDX3RspyQyFqKQhi2Q4EObCBdU=; b=qwulYmxK/7Lmw6/KPX6JM51jofZrOXisPKB6FHpwXVQmAmGcqTJGuhHx2MUHn5Zu5S W/lhQ8nPagHMWt7ZF3Jm9JTwK5f6SNVxDyDNvZvCCTa7R/4cSrj5hWl1wGZDWkgjF+/q pxAXNpof5zoiOGqRQFLMDvwIk1lgA6nUn4vTQR9U5DPbXv5iO3H8JRNrPUMZxnyejgeW gfcLMuInZZGGYTCIxy1bQI0SMfnPgYX2gbPAst0WEkrTwJo3p8U8gWNZbMhLoB1QuZJU XgDlsN6EnBKEP62koCeb547Yv+bH3tutfyONH42jZptrFn+zwvQvWVbxjXBr4gWFpyJa L5fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DYsgbCn5njmRP2uXseDX3RspyQyFqKQhi2Q4EObCBdU=; b=PGm31THwgcUCufTJ09Nw8E0OZ9KLcJLYOMtr7cMswI2G99gjvxzqfd+bmi9gb43O/M lpAU6JEHn4BG6Iful3A5O+ij7p7u+s7dTU6fxwLg1ubE7Ci5cbaJVewkZbmKMT+B+08j KOdwpqv29uY27zp3qf3UO/SfwVWEpYaS6tjWWbzOTBScIhxSpUjVREujVe6+nxbtQk0G wkSLpGDPjKApz1G7uWBcwPJY2ovmNHysuCWMEEMHyv1df9w1+5m8ujvnqHta8cDxIzKP r429pPAihkMjkHEB4BOhUFUrwIpvwBUd7NLkf+sfj7kT4DBekoVwXp3Ow7otzEK8r9oU wUNA== X-Gm-Message-State: ABuFfogpC9bj8O2k8SII6BcDwvTug2F3g3RKR48tngliriGICSE+uSf/ gy1EvGe4o5z+W4Z2fZ6pLPwsEg== X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr10600687pgb.274.1538059149251; Thu, 27 Sep 2018 07:39:09 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:65ac:9fec:cd12:82c1? ([2601:646:c200:7429:65ac:9fec:cd12:82c1]) by smtp.gmail.com with ESMTPSA id v81-v6sm4681822pfj.25.2018.09.27.07.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 07:39:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [patch 09/11] x86/vdso: Simplify the invalid vclock case From: Andy Lutomirski X-Mailer: iPhone Mail (16A366) In-Reply-To: Date: Thu, 27 Sep 2018 07:39:06 -0700 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 Content-Transfer-Encoding: quoted-printable 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> To: Thomas Gleixner Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 27, 2018, at 7:36 AM, Thomas Gleixner wrote: >=20 >> 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 resu= lt. >>>>> Or we could offset everything so that we=E2=80=99d have to go back sev= eral >>>>> hundred ms before we cross zero. >>>>=20 >>>> That would be probably the better solution as signed math would be >>>> problematic when the resulting ns value becomes negative. As the delta i= s >>>> really small, otherwise the TSC sync check would have caught it, the ca= ller >>>> should never be able to observe time going backwards. >>>>=20 >>>> I'll have a look into that. It needs some thought vs. the fractional pa= rt >>>> of the base time, but it should be not rocket science to get that >>>> correct. Famous last words... >>>>=20 >>>=20 >>> It=E2=80=99s also fiddly to tune. If you offset it too much, then the fa= ncy >>> divide-by-repeated-subtraction loop will hurt more than the comparison t= o >>> last. >>=20 >> Not really. It's sufficient to offset it by at max. 1000 cycles or so. Th= at >> won't hurt the magic loop, but it will definitely cover that slight offse= t >> case. >=20 > I got it working, but first of all the gain is close to 0. >=20 > There is this other subtle issue that we've seen TSCs slowly drifting apar= t > which is caught by the TSC watchdog eventually, but if it exeeds the offse= t > _before_ the watchdog triggers, we're back to square one. >=20 > So I rather stay on the safe side and just accept that we have to deal wit= h > that. Sigh. >=20 >=20 Seems okay to me. Oh well.=20=