Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7515437ybl; Tue, 24 Dec 2019 04:05:30 -0800 (PST) X-Google-Smtp-Source: APXvYqywd5S50hLj/JE+yKKDvLwQxWW5u5rHqaO28xIfB/cA2t0oQF5tUImWEn5AsA62IvmbWB/m X-Received: by 2002:a9d:2c68:: with SMTP id f95mr38797875otb.33.1577189130742; Tue, 24 Dec 2019 04:05:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577189130; cv=none; d=google.com; s=arc-20160816; b=XL3Z4VXpJLdKc0D7Z65LpbwdxDM1hZFwzTToFT9CpBPheqypz09BlXAkqpdks+mW7f JfZrYctZB2Xr1k2U19987dXU39xll+yG+YfZ1pBSMW3TN+CzX45jtbRKVZWJCbcBwEKy RhvyzoSV6Re+vQBAsRU498CExIvw3FLmQffNNUXvBW6Xta4QQnLN5przBpao+9o6mI5X w4k6q1TeaJgjnyqtxX0nFqacwbxbIzHN7TA1ReUrqaiEyaq2hfYt2kpsekZeRfFzMMc8 x0EmPs3UPR2FSZcfVsy4ubc+QZVyBjTBRcZXhQ3URV+JXxx7EGp1kINf4/ms/IHdt9CT RnVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=VHzH6WH6Y51Hv8qWhxgK6vx35XDhgJUQtiy7D9VMqAM=; b=gKxV9NgYoCqdmuhq5xuwY+Y8E9ecdYf5WnDpkS+PLsvY/vGs4Ht9aP3HVI5AJ7oBBW A8a8kYLGnkrLjHe07npfeqYUxiH/MrIROWcJmeZRhkwHTkD66/j7Fr7MrHzRIUamnqsG cfKfK+W+yk3dDN1RUwX3kv4nbBGjGxPs3W5vd2aDNavas43WmTgLOJi2XmtL8XZBTzv8 LD4ZlrocZKNnZOg2J8qYaG9nweYz7JUljYNnZn34OmAgbrNHiV0IZPnh80SSTfaRWRXZ /DBnVQsfSd9suU1q+psTRZyKWw/Xi4ln9pFM4aMi6YA72VBvJZ8qD1npUAbZM5zrNzeJ 7uwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=AQugnPU1; 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 n14si12276419otk.179.2019.12.24.04.05.18; Tue, 24 Dec 2019 04:05:30 -0800 (PST) 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=AQugnPU1; 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 S1726237AbfLXMEi (ORCPT + 99 others); Tue, 24 Dec 2019 07:04:38 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36056 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfLXMEh (ORCPT ); Tue, 24 Dec 2019 07:04:37 -0500 Received: by mail-pl1-f194.google.com with SMTP id a6so7668261plm.3 for ; Tue, 24 Dec 2019 04:04:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=VHzH6WH6Y51Hv8qWhxgK6vx35XDhgJUQtiy7D9VMqAM=; b=AQugnPU1j3l+UliZJ1cFDWfn1gfoQcO/nzfL11rOcYeTLX/P87iqPaaJmBaMlSz7f1 /DhGazm2NTR2ZIaiN+mUvEAnOZrI7Ge0Mg1zI2ZlVdeTi0aTgDWcWRqSCId8E113LX3m 6HCYlixeRMc9TaLMlaAzwKbLAUzigX1Ncl8C866LmmeME3vMRc45SQjPLyr6MHX+L6Cw vv52P5dueRyUQBwwusD+tHpoqoHbOj8XjhE0q9U9hlqCHn27d/gBrcaQanBO29ITAp34 bn7tzg79vFow2UHY2TlVVezhuLVq4rXQXKJzfTff9415HHT3maptkAcWgSZsizcHzud6 8efg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=VHzH6WH6Y51Hv8qWhxgK6vx35XDhgJUQtiy7D9VMqAM=; b=qZ6jw0fR2Jp8BINT1XgnIq9yXFJXpnI+a1IcBnhsmLXTuJr3xKIf0OsarH58A/ku3P mUSJOrO9toF45jlT/S8VVoT2pr22/Bdr5vaGfL9gBCszmFzt2zfM55fCv111E2IMy+/0 slIXJM4fRHSdg+2/m+s/mr9Sk0kogzca4VCsb5QxFlvMXlMVVbExgM+5NhKUOClETcHs +bOmLmCAGNwQCR62l++0h/lJa8XjpnvVY+1ASmNEPDCV2yP3KO9YOvkrZCH8TLd+jF79 b2ZVUqU0Z685TY0WShFfmeOtMk3vIyc4GW1yYOQ5E3lo+bTDjBvn7FSDitR3Ie9hx7qs /9Zg== X-Gm-Message-State: APjAAAWmsDy2WUy+hT+RHGvpJ+fnUYJRU2JVlv2JqGV4eTg6PY+h/AQL Gn5kJsxN37DYjnfFv0WTBXzOsw== X-Received: by 2002:a17:902:7288:: with SMTP id d8mr34182926pll.341.1577189076952; Tue, 24 Dec 2019 04:04:36 -0800 (PST) Received: from [192.168.0.9] (111-255-104-19.dynamic-ip.hinet.net. [111.255.104.19]) by smtp.gmail.com with ESMTPSA id k21sm14926039pfa.63.2019.12.24.04.04.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Dec 2019 04:04:36 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH v2 07/10] lib: vdso: don't use READ_ONCE() in __c_kernel_time() Date: Tue, 24 Dec 2019 20:04:33 +0800 Message-Id: <98C1F790-7647-4203-9B31-4B8FED8CCA12@amacapital.net> References: Cc: Andy Lutomirski , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , Thomas Gleixner , Vincenzo Frascino , LKML , linuxppc-dev , linux-arm-kernel , "open list:MIPS" , X86 ML In-Reply-To: To: christophe leroy X-Mailer: iPhone Mail (17C54) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 24, 2019, at 7:12 PM, christophe leroy wr= ote: >=20 > =EF=BB=BF >=20 >> Le 24/12/2019 =C3=A0 02:58, Andy Lutomirski a =C3=A9crit : >>> On Mon, Dec 23, 2019 at 6:31 AM Christophe Leroy >>> wrote: >>>=20 >>> READ_ONCE() forces the read of the 64 bit value of >>> vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec allthough >>> only the lower part is needed. >> Seems reasonable and very unlikely to be harmful. That being said, >> this function really ought to be considered deprecated -- 32-bit >> time_t is insufficient. >> Do you get even better code if you move the read into the if statement? >=20 > Euh ... >=20 > How can you return t when time pointer is NULL if you read t only when tim= e pointer is not NULL ? >=20 >=20 Duh, never mind. But this means your patch may be buggy: you need to make sure the compiler r= eturns the *same* value it stores. Maybe you=E2=80=99re saved by the potenti= al aliasing between the data page and the passed parameter and the value you= read, but that=E2=80=99sa bad thing to rely on. Try barrier() after the read.=