Received: by 10.192.165.148 with SMTP id m20csp850823imm; Wed, 2 May 2018 09:46:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoOZaNXxp3ejiC9ygtshQykWLOv9TWNvVc2eWRZoShwVrm3tO6CO+jiuiresO3T04qKkT+k X-Received: by 10.98.118.130 with SMTP id r124mr19917660pfc.80.1525279593338; Wed, 02 May 2018 09:46:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525279593; cv=none; d=google.com; s=arc-20160816; b=LGHFQ6UUZB1zWIxTmDppqH8QM1KUeD/PGpJyKG/cIcBgfGp30GLHfzGG+Ik/sp9l3O 3U/XiG8s825ObHsu+xF88NzzkpJShREmALhUuJCgWKYREyi97jpNabxxBwKt6GrNGGhD rTEzvbXBFbodY5IaTtpojBOietfyL2fmadB6VxU+a1OY8WzIwiQptoC/VAOOGCVR0REh lJ0NEQxGrAbofGDQkO/aSqwopkWSpvlnXYhrHXMLG1MF7mSgBq4lmcSrbt1HEXair4P6 s6lSuHIGpUKQoOlmoJcleCWmTNWV1NFVQd3cHPGgt3mgzeqyahpH7MG0bYPt0NgOf0ew ZBUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:dkim-signature:arc-authentication-results; bh=coqaIJrFvMPHzpnUUx6TkNvkOoZG3zfJqn5jfPBJ3xc=; b=Cu/li9kQAdKTAjxIV/6O242l7NU5t75B0v1MspxyaDVcb8V9TQudtANP/MK6yw3f2z 2pqm3ZoUA2qBiTEHjqpA7C87neJQnuDTjBYJA/fHbdDKpmOSzgq7FQnvGKxzU8yaS/zn xy9mNvo4HoakXaFxN7ALjhcryJeIfR3TDStNwS3ZTI3Lt4Xv+mJ0focDkRtAShir0my6 qa2JvHTEzhMlaVzzSSrmLeml10ujM9Bd1WMQX83HQezOkxdxv1w0HERoXTg3dtnrLADK jeGqmzpsWuziR8WOgS3DvJkl0ahA9JBfnaPs6BEVngQ5NsJHlxdlKrJR1FIXptCp25lC 1a7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Ujb/gD4U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6-v6si10319720pls.462.2018.05.02.09.46.18; Wed, 02 May 2018 09:46:33 -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=@oracle.com header.s=corp-2017-10-26 header.b=Ujb/gD4U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751736AbeEBQp7 (ORCPT + 99 others); Wed, 2 May 2018 12:45:59 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52748 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbeEBQp4 (ORCPT ); Wed, 2 May 2018 12:45:56 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w42GfXpR025083; Wed, 2 May 2018 16:45:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=coqaIJrFvMPHzpnUUx6TkNvkOoZG3zfJqn5jfPBJ3xc=; b=Ujb/gD4UMhsFqsqgDpuen+wyNsVeeLioF45jn0nC5V+j2T3XsCyoYaop28NxmqDlG6cG 3l8QKwiP5S2TwuDIykE7zEGMHLlbButwdvkKnK4MIF6X1VR37EzuKqQjpvdzVS5Fn2tu BRjEQ2rCVMJEOQ37qEDCFdPvjgtw6cK3PPMHF4lgY+wT3VH8JmG9ymoc+DMdxMgQ4zlH 77r2LeAnQkf9SHkQ1GB2rifMzmRoz2rGvfOf5/U6B0j8xemWX48VLVbZ4s0ix3hQvxcK ByHZygchDCXuNQ6ctLKlu6lat4i8k8jYnLI6fRYNqf68bkJLLQC1bPmwSYMVFrrp3Heo kw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2hmgxfx2by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 May 2018 16:45:00 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w42GivwH012186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 May 2018 16:44:58 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w42GitQL010898; Wed, 2 May 2018 16:44:55 GMT Received: from [10.175.194.190] (/10.175.194.190) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 May 2018 09:44:55 -0700 Subject: Re: [PATCH] [v3] x86: Convert x86_platform_ops to timespec64 To: Arnd Bergmann Cc: Thomas Gleixner , y2038 Mailman List , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , Jan Kiszka , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Boris Ostrovsky , Juergen Gross , "Rafael J. Wysocki" , Andy Shevchenko , Borislav Petkov , Andy Lutomirski , John Stultz , Linux Kernel Mailing List , jailhouse-dev@googlegroups.com, kvm@vger.kernel.org, xen-devel References: <20180427201435.3194219-1-arnd@arndb.de> From: Joao Martins Message-ID: <92ef9d3a-d2bc-59db-de43-4845a46fd2d8@oracle.com> Date: Wed, 2 May 2018 17:44:47 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8881 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805020140 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/28/2018 11:09 AM, Arnd Bergmann wrote: > On Sat, Apr 28, 2018 at 12:21 AM, Joao Martins > wrote: >> On 04/27/2018 09:13 PM, Arnd Bergmann wrote: >>> diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c >>> index 761f6af6efa5..637982efecd8 100644 >>> --- a/arch/x86/kernel/pvclock.c >>> +++ b/arch/x86/kernel/pvclock.c >>> @@ -123,28 +123,35 @@ u64 pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) >>> >>> void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock, >>> struct pvclock_vcpu_time_info *vcpu_time, >>> - struct timespec *ts) >>> + struct timespec64 *ts) >>> { >>> u32 version; >>> u64 delta; >>> - struct timespec now; >>> + struct timespec64 now; >>> >>> /* get wallclock at system boot */ >>> do { >>> version = wall_clock->version; >>> rmb(); /* fetch version before time */ >>> + /* >>> + * 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. >>> + */ >>> now.tv_sec = wall_clock->sec; >> >> IIUC the interface you're probably speaking about is common to both ARM and x86 >> on Xen[*] (since Xen 4.6) i.e. >> >> now.tv_sec = ((uint64_t)s->wc_sec_hi << 32) | s->wc_sec; >> >> s representing struct shared_info like on ARM (there's a 32-bit hole where >> wc_sec_hi is placed on x86_64/ARM). Except on x86 32-bit guests wc_sec_hi is >> located elsewhere. >> >> Joao >> >> [*] >> https://xenbits.xen.org/docs/4.6-testing/hypercall/x86_64/include,public,xen.h.html#incontents_startofday_shared > > Ah, good. How portable is that? Will it do the right thing (i.e. > guarantee to have > zeroes on the upper half, or the epoch if supported) on all versions of both KVM > and Xen, or do we need an additional check in there? > The whole shared info page is zeroed out by Xen when allocated, so on unsupported platforms that includes the upper half. But I don't know if this is considered ABI or not. FWIW, the oldest release (2.0) has that behavior. But this is Xen that I'm speaking about; KVM doesn't support this IIUC. On KVM, there's HC_CLOCK_PAIRING hypercall or else *maybe* host could just write wc_sec_hi at the end of the wall_clock struct (with the current MSR) and given that it's (PAGE_SIZE aligned) guest memory, guest could always keep it zeroed out for unsupported platforms (that won't write more than 12bytes). > I'd suggest leaving the implementation of that to a follow-up patch that you > can add once my patch is merged. /nods Joao