From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbdJMUpL (ORCPT ); Fri, 13 Oct 2017 16:45:11 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:22095 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbdJMUpK (ORCPT ); Fri, 13 Oct 2017 16:45:10 -0400 Subject: Re: [PATCH] x86: convert x86_platform_ops to timespec64 To: Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org References: <20171013183933.3757079-1-arnd@arndb.de> Cc: y2038@lists.linaro.org, Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Juergen Gross , Marcos Paulo de Souza , Dmitry Torokhov , John Stultz , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org From: Boris Ostrovsky Message-ID: Date: Fri, 13 Oct 2017 16:45:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20171013183933.3757079-1-arnd@arndb.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2017 02:37 PM, Arnd Bergmann wrote: > The x86 platform operations are fairly isolated, so we can > change them from using timespec to timespec64. I checked that > All the users and callers are safe, and there is only one > critical function that is broken beyond 2106: > > pvclock_read_wallclock() uses a 32-bit number of seconds since > the epoch to communicate the boot time between host and guest > in a virtual environment. This will work until 2106, but we > should ideally find a replacement anyway. I've added a comment > about it there. > > Signed-off-by: Arnd Bergmann > --- > arch/x86/include/asm/intel_mid_vrtc.h | 4 ++-- > arch/x86/include/asm/mc146818rtc.h | 4 ++-- > arch/x86/include/asm/pvclock.h | 2 +- > arch/x86/include/asm/x86_init.h | 6 +++--- > arch/x86/kernel/kvmclock.c | 4 ++-- > arch/x86/kernel/pvclock.c | 12 +++++++++--- > arch/x86/kernel/rtc.c | 16 ++++++++-------- > arch/x86/platform/intel-mid/intel_mid_vrtc.c | 10 +++++----- > arch/x86/xen/time.c | 10 +++++----- > 9 files changed, 37 insertions(+), 31 deletions(-) Xen bits: Reviewed-by: Boris Ostrovsky with a couple of nits: > @@ -136,11 +136,17 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock, > rmb(); /* fetch time before checking version */ > } while ((wall_clock->version & 1) || (version != wall_clock->version)); > > + /* > + * Note: wall_clock->sec is a u32 value, so it can only store dates > + * between 1970 and 2106. To allow times beyond that, we need to > + * create a new hypercall interface with an extended pvclock_wall_clock > + * structure like ARM has. > + */ I think this comment block should be moved up above 'now.tv_sec = wall_clock->sec;' > delta = pvclock_clocksource_read(vcpu_time); /* time since system boot */ > delta += now.tv_sec * (u64)NSEC_PER_SEC + now.tv_nsec; Now that tv_sec is a 64-bit quantity the cast can be dropped. -boris > > now.tv_nsec = do_div(delta, NSEC_PER_SEC); > now.tv_sec = delta; > > - set_normalized_timespec(ts, now.tv_sec, now.tv_nsec); > + set_normalized_timespec64(ts, now.tv_sec, now.tv_nsec); > } >