Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5270054imm; Tue, 18 Sep 2018 07:02:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY0bxrqLIZbiqxx8WB0KJ6GY1SoNdphIPKXEhcHJI/UHbiw4zxZRXh2HE3NJR/WqGQHe43n X-Received: by 2002:a62:6d02:: with SMTP id i2-v6mr31712591pfc.218.1537279320112; Tue, 18 Sep 2018 07:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537279320; cv=none; d=google.com; s=arc-20160816; b=aXeM4NFC/Zd4sUNLqWM9ERfBPDIldEyonsHSUAnSaUTILSOOXONtVjvbeOfc2u8BX2 JE+KAZvAc97VOcn+R01RlTOpm8K63rQJBRW5uc0CwylM6zu31pBxmuAnIfbTtAcKhvO8 SuYwJXfufeBaYFhuCXtF8VIJUb+b7THKVy9D7yXBvWOFTGJ8K3I4vxewvhIniVMp865m 7qVlcF7/pOJ0iQoXr3hF/Y4gOGSv2gTjRVNguVlKTT08KDgCF1Kgy/UN0+wuphsRAoND PmPkMVqHcBhuaNkS4IdUa9thykJc4OOp1Ou5kU5XHFVqZ6et6IKFH50KpT9H7NaKuHBA uOXQ== 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=ePd0BmLd7k+HzeRPI35wXT3U39n7XgyJHaY3HtekcL8=; b=XvZ4pVHFLxTnSn6VC2lfDSn/F4iouL24epR/kJ7e9ynD1VIM6bHj/lRErc+S9+78Tq Gqts8YokChF1VZ5XxQcJnrOGdvmH9QjwH4ZXuvPkModARlzv9V1jZZ+c75ZkpkuQ07vO fBzw9b8JJ8Ui6Om9BSsRFkeji61jP8u2HAn+52qgLKpUnTkv90jGPk8/o3o6CbykJFCK d6wekTNHDMmz3PFMZLws5CbGHoyzhYzEUaskKPtQI9FOihDMzxzFhe5vi75L50yP8zae uSPLAf0ey20BBxq3cXJTxcTumhghTsLoSAULzyjQU2vxdPVoRbjO78flKj+TT5xgH37m xj5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=S52ZTFsD; 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 r39-v6si18279686pld.218.2018.09.18.07.01.35; Tue, 18 Sep 2018 07:02:00 -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=S52ZTFsD; 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 S1729837AbeIRTd7 (ORCPT + 99 others); Tue, 18 Sep 2018 15:33:59 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:40079 "EHLO mail-pl1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727846AbeIRTd7 (ORCPT ); Tue, 18 Sep 2018 15:33:59 -0400 Received: by mail-pl1-f180.google.com with SMTP id s17-v6so1054658plp.7 for ; Tue, 18 Sep 2018 07:01:14 -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=ePd0BmLd7k+HzeRPI35wXT3U39n7XgyJHaY3HtekcL8=; b=S52ZTFsD4U0GMA7wQIDNfCyPYXrUvtnAogpzWMYalgC8H/Yz2k5GgTOXZjBXH4n/e4 VQ48tWJazHoK0I7ytpQEo15AbF7NWpnm++9Cm1/Jm08cFksNzpL9i9mEsXS8mx1ZOD89 Wrpvuu36fpt4WiOxke6by7KAyLwJl/GjlVZ4jL+euD/M/oguN8woim/UHco6cwspGWNU 2AKdbqxp6D7s5GVs/pc8K6JnkGO0wPNM1x3rtcOqbByX7eNGll2dKEYA7yZijQyMMK1A UDo+BnTOLKQRyiUS7iC9+Hi1eGCrRvH4PYxdyaQBVJZJMGh4+P0eZ23B+XQX9Nj4rnyL TGnw== 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=ePd0BmLd7k+HzeRPI35wXT3U39n7XgyJHaY3HtekcL8=; b=EjtfApttXY1vb2oT9k1aEwUCRKaeTrozkg6GqMLQ4F61zH6LrbFkdHg7PxQcOk9sGp yjIIibzYE5DDkF2FpbxJIwnhrs5rnzCeZHcvgq+lA11rfeTslIo6eQYfRmLDKIXzB5w/ kWvARxNSp/Psrk81bb1toB+crapJnwApUSsb0TKupYCfZECaR29g/yOM8eoqz+Dn1LR2 uGs6Rw0SNFoHzDxg4N2HyyQD/KbkKswTw3cSC1+8li494xC6t0Ud0xE7rdIq6pHeM1OL a1xsjXXZKfbQg9h2mGF3MUgsDcDrNZrgLZq2aCL64V4DBhGlioqZsnsOVIcbHHy04dh/ sKCg== X-Gm-Message-State: APzg51Ck5OUWA0bAI0uTi6FfpWLnDtdT9MXcbn8D3+3jBuRKlDlDTfP6 bc+DwuduFHnmfeIhN6iJBkyXNQ== X-Received: by 2002:a17:902:5998:: with SMTP id p24-v6mr29759822pli.36.1537279274524; Tue, 18 Sep 2018 07:01:14 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:984f:8987:f568:9bca? ([2601:646:c200:7429:984f:8987:f568:9bca]) by smtp.gmail.com with ESMTPSA id u11-v6sm29080033pfd.117.2018.09.18.07.01.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 07:01:13 -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 (15G77) In-Reply-To: Date: Tue, 18 Sep 2018 07:01:12 -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: <863331ED-B04A-4B94-91A2-D34002C9CCDC@amacapital.net> References: <20180914125006.349747096@linutronix.de> <20180914125118.909646643@linutronix.de> To: Thomas Gleixner Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 18, 2018, at 12:52 AM, Thomas Gleixner wrote: >=20 >> On Mon, 17 Sep 2018, John Stultz wrote: >>> On Mon, Sep 17, 2018 at 12:25 PM, Andy Lutomirski wrot= e: >>> Also, I'm not entirely convinced that this "last" thing is needed at >>> all. John, what's the scenario under which we need it? >>=20 >> So my memory is probably a bit foggy, but I recall that as we >> accelerated gettimeofday, we found that even on systems that claimed >> to have synced TSCs, they were actually just slightly out of sync. >> Enough that right after cycles_last had been updated, a read on >> another cpu could come in just behind cycles_last, resulting in a >> negative interval causing lots of havoc. >>=20 >> So the sanity check is needed to avoid that case. >=20 > Your memory serves you right. That's indeed observable on CPUs which > lack TSC_ADJUST. >=20 > @Andy: Welcome to the wonderful world of TSC. >=20 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 c= ould offset everything so that we=E2=80=99d have to go back several hundred m= s before we cross zero.=