Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp420666imm; Fri, 5 Oct 2018 06:06:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60MuVn4/9Jge1H1//XXBg7WVGAnb7R0A9mnt14DIp2s3vjCzjVAUi1REXfPbP7AAE7JC0IE X-Received: by 2002:a17:902:a40c:: with SMTP id p12-v6mr11665218plq.165.1538744761560; Fri, 05 Oct 2018 06:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538744761; cv=none; d=google.com; s=arc-20160816; b=LjFl1RO22ya0I+vyPelOJofK2G+g5SHVoNbjpuR5wHBlEvi04CjmjJPwPRvFCUJB3B CP/SZCNuWbAyeGpqAFmzGfB67PbjilBnQwxoFSBlHhdzMzyWiNTGwvQ4166dGUqJU5Mx xHgg0KmLptg7HAREY03nk3waXAp3u0xumRuvv1Py8duyq3W8a0HOTuRSTFqRUlS6b7zb tES0wR0Kkr7bk+7emQuKYRbDMdHdXuzr1mdPYc8jnNFL77BaTKmY5mO9Kv1My6r96KPV ofOGjzSdTE2+jGY0gd7iCuV68Z6HspYxhLkMY/U7nJJEUBZBYi7sczBOcpWm6EVCJDP4 ZmgQ== 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=kmNpzrPUwSJEcrF2MnaX0RUNEoh+3w1XDK35HodlZJ8=; b=Kcor1AoW6bFcU+k5Md9yYm01u+bkaYo/8w2IvBAi+/93UDFDJhkayXmMg7EnBb38ym +OmHTLRKwcOxY0WZWbk2rEK4Q6AMXvRXc9ti3jCkqalH/H5PZivqdpMJxWQ+wV59LkiG /jx9uGOjBduJYDfUL7xcz/JQzNnxSOjC0PwuKLMDpIDYVE2jhltRBw3t0LTpXixmYaiL vbZ1mlFi6n+dKtVaNJ0s+kQIH/tLssiureJ1SPL9Xkq+f+UnEyZuTCn3d5RMXflL5C62 vG9Mj3HD14eD3lN9WqOuMW6QmwgBa4WfWO/fdZ4mFLpgq5QWmPh88raI79behgcyazY3 fenw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b="cfLl43/i"; 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 m11-v6si7912394pgs.33.2018.10.05.06.05.44; Fri, 05 Oct 2018 06:06:01 -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="cfLl43/i"; 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 S1728453AbeJEUEB (ORCPT + 99 others); Fri, 5 Oct 2018 16:04:01 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35695 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727701AbeJEUEB (ORCPT ); Fri, 5 Oct 2018 16:04:01 -0400 Received: by mail-pf1-f194.google.com with SMTP id l17-v6so695599pff.2 for ; Fri, 05 Oct 2018 06:05:22 -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=kmNpzrPUwSJEcrF2MnaX0RUNEoh+3w1XDK35HodlZJ8=; b=cfLl43/iORKobz/NffaO7PBhTxQuegVdT+moQw2dCaKHjVBhLmMKG2CKdmjHmpBziL AUnnoX1tt5CijIdi5Ht8OFgV8BisPH7sqa0FTcSH+TgU5sHTMPlZ4L6qcha4QdinFIse 7F8pm5X5Lrx6krWaDnO3CTpVDpvuan+7iaXqH4PIn/CYoqNMTvFbTjY9D9feMWD4hMB1 rUpBrEQMjd36qQ2zIDSvT/a2+xGoZp3mvynw994zg3DnQCXS3cE2Ju9xuayV/EtyaBAy Y8FUuye0fXQU1dpqZg1KtLrM7NwlyuawwfMaUY8fxLri4iye3LYWCumEv8hgSI9/dmDc akfg== 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=kmNpzrPUwSJEcrF2MnaX0RUNEoh+3w1XDK35HodlZJ8=; b=g9nU/tGcp8n+kGsGNlOUfY63UJTJuHiEuvGx3olrzTuT4jL7Ncu39cqqAQzbzujqow gWycX2XbCPkesNXBLtJxQIqFyYYUrVeFHCH0qj7PxReuBPBV66GkY2dBXXH01QDfXGdx kx4YHrG7Bv5pdTdczxXyY6f/cvm/LZvrdFxSgRS9JxTAbNQSDPQCzV3IoisHYEhcl2+P iqfyMtHA40N3blIzdIkAoeyHv4/CjFju7GJ0nvemKNw+Lz1gsiUUI4PxiZ3oojB3hBvP YUBeV0PVgFHZqpuNSgbJBHYDj/CeXUcSYNd5Jv8bcGRhjoeZbAoWyyplPUqV6kgp9ykS tu8w== X-Gm-Message-State: ABuFfojoQjU+pom8lxCIUmZV7qBgwESo2ST4PPmXgkooeG29Nq0FfTHN Raq/jgQTb3mjSjIbD8BsYJ/IWSqlJek= X-Received: by 2002:a62:7a81:: with SMTP id v123-v6mr12059229pfc.240.1538744721729; Fri, 05 Oct 2018 06:05:21 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:d01e:eb5d:f949:e221? ([2601:646:c200:7429:d01e:eb5d:f949:e221]) by smtp.gmail.com with ESMTPSA id n17-v6sm13340882pfj.84.2018.10.05.06.05.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 06:05:20 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 2/3] x86/vdso: Rearrange do_hres() to improve code generation From: Andy Lutomirski X-Mailer: iPhone Mail (16A366) In-Reply-To: Date: Fri, 5 Oct 2018 06:05:19 -0700 Cc: Andy Lutomirski , x86@kernel.org, LKML Content-Transfer-Encoding: quoted-printable Message-Id: <9CF548E6-37EC-450D-A670-7826BC9F7F08@amacapital.net> References: <99e93a6be59916959ad259482f4cf347e8af9bac.1538689401.git.luto@kernel.org> To: Thomas Gleixner Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Oct 4, 2018, at 11:00 PM, Thomas Gleixner wrote: >=20 >> On Thu, 4 Oct 2018, Andy Lutomirski wrote: >> index 18c8a78d1ec9..419de7552c2f 100644 >> --- a/arch/x86/entry/vdso/vclock_gettime.c >> +++ b/arch/x86/entry/vdso/vclock_gettime.c >> @@ -147,10 +147,9 @@ notrace static int do_hres(clockid_t clk, struct tim= espec *ts) >>=20 >> do { >> seq =3D gtod_read_begin(gtod); >> - ts->tv_sec =3D base->sec; >> + cycles =3D vgetcyc(gtod->vclock_mode); >> ns =3D base->nsec; >> last =3D gtod->cycle_last; >> - cycles =3D vgetcyc(gtod->vclock_mode); >> if (unlikely((s64)cycles < 0)) >> return vdso_fallback_gettime(clk, ts); >> if (cycles > last) >> @@ -158,7 +157,7 @@ notrace static int do_hres(clockid_t clk, struct time= spec *ts) >> ns >>=3D gtod->shift; >> } while (unlikely(gtod_read_retry(gtod, seq))); >>=20 >> - ts->tv_sec +=3D __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); >> + ts->tv_sec =3D base->sec + __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns)= ; >=20 > You cannot access base->sec outside of the seqcount protected region. It > might have been incremented by now and you'll get a time jump by a full > second. Duh. Let me try this again. >=20 > Thanks, >=20 > tglx >=20 >=20