From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3F62C43387 for ; Fri, 18 Jan 2019 16:28:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA47020850 for ; Fri, 18 Jan 2019 16:28:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FVQzGKvf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA47020850 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L/olmg0kgEdd2Xegof0Uhg/YIf50DJgadwXZWC03X+c=; b=FVQzGKvfqIBGjo lO7wtkCyQuxCwLJIb/OA7Z0NdWLG1oTrm3XDSJiIM5Zvh5SXzocXuEtSwBJS58MRonwsbWY+9gmAa gXecMYkwenLEbConzEh30LwALH5Ld27pPS/M8bWeA35Pgdo60hdEkTa1zktwIJHyHuKm3lakgpPuL I4RW5/jivbma8+vtQhyERMB0lifQUd2fzZW68VUhIX0vLZTT4Cn2gXZlTcmPxXZrUTrNe5HVOBKY5 rVAYxkEFFjt7En6S4XsRWOYF472fHu/bk/6LxPpJXo6oOTiuwO9CpI/DMeeY4VNOFNLxd9H3G4nil UwRsorA8E4ItCgFGhiQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkX0K-0000gz-Fm; Fri, 18 Jan 2019 16:28:24 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkWzZ-000054-8H for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2019 16:27:40 +0000 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1Myb8N-1h9Ji41bDh-00ywxC; Fri, 18 Jan 2019 17:19:41 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH v2 19/29] time: Add struct __kernel_timex Date: Fri, 18 Jan 2019 17:18:25 +0100 Message-Id: <20190118161835.2259170-20-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190118161835.2259170-1-arnd@arndb.de> References: <20190118161835.2259170-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:av64eTYsi2K0oecdlvrPbJkEidlMY8tIQkQX919n78kQTRWxVDT AEO8Y1y0Gg3kMOTk7Ytz+hp122eH4GS/wmnGxvETpi223F8qYnKQ5nHdS9Db1csvd53Shzx NsB3jwfJVeKLCMpEtzJ6rD0oxXHOu/EqsAk4NKBNiImSlEYGKZSuJcfe8UblsPBnSmc+GR8 WjMe1ho0oEOGsrwgXNtMg== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZqLpqSp+JSc=:3wmY17H+Tchv+PQ6N+iT8Y HSsbDhKMQssrWjovl7zvqvr7ySGB1787IqnV7kggqJMg4HXL3OKZdBoE8hs+iCxZ9d8fr+9st xZOJFYdkGzUwa7f3vvJsRQZqUcnJOEM6MXdP/PayW1iZneMGsFBN5nMfAdchuKivKd38axkzQ +GiYmGMBn9dFICXNwh1WIw+X7uLL8pnC2uGmlztXkZ9zVaxIXYa4FlxfZog0jbf8F92+ELuhS b6DYpAzHWITBCBUQ4s4uk/f0dpdoyytA5CoMcztDo64eIKSNsyy2Ohyvs6Kgje5MwbBpFq2co 1LrhY0qPzV9PXv7tUHoc621Oaaen66NN9917DZZ4iyW20hFFvoNN1WBSGX2PsuC8wNR0cNOlL 0r89wn4eVc9DJ1WGBtr1dJNyePQ5O5tuJQowMFaHihuX9/5pkoH/5O3Oswe3azVMZjtAjljwE BI7BWEEEL7qtcfKjN5otD+l8oupFEcwjvxFEvx+e4r06FXSt6VAtpf8mNBk26W0LZoXTj1t2B x5xWV3IX7ITyaT4OA1S7h76nqNgrx7rmhe5+sQi3WYIcmE+wcqitu+nCg2FoIUYCWOG32mkKB A59fxK85ovK2coQb8NAuTgDrirQXY9SW8rGoyLs4HRZBx2smDk4i0StGdDfhyxvG7md28kwjT 5ZhwVeSrNthRHyX8bpJe1JHcaMimfRVlScP2FK6mX/t6n1TyVbN66Q6K9Nk5O5DsaK0ZfBzJe jqd/trk2TwKS/udUCH7l7bF124tg5kTPH9ymtg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190118_082737_756624_812A16C0 X-CRM114-Status: GOOD ( 14.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dalias@libc.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, jcmvbkbc@gmail.com, deepa.kernel@gmail.com, hpa@zytor.com, sparclinux@vger.kernel.org, linux-s390@vger.kernel.org, mpe@ellerman.id.au, deller@gmx.de, x86@kernel.org, linux@armlinux.org.uk, mingo@redhat.com, geert@linux-m68k.org, benh@kernel.crashing.org, firoz.khan@linaro.org, mattst88@gmail.com, fenghua.yu@intel.com, Arnd Bergmann , heiko.carstens@de.ibm.com, linux-fsdevel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, luto@kernel.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, monstr@monstr.eu, tony.luck@intel.com, linux-parisc@vger.kernel.org, netdev@vger.kernel.org, linux-mips@vger.kernel.org, paul.burton@mips.com, ebiederm@xmission.com, linux-alpha@vger.kernel.org, schwidefsky@de.ibm.com, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, davem@davemloft.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Deepa Dinamani struct timex uses struct timeval internally. struct timeval is not y2038 safe. Introduce a new UAPI type struct __kernel_timex that is y2038 safe. struct __kernel_timex uses a timeval type that is similar to struct __kernel_timespec which preserves the same structure size across 32 bit and 64 bit ABIs. struct __kernel_timex also restructures other members of the structure to make the structure the same on 64 bit and 32 bit architectures. Note that struct __kernel_timex is the same as struct timex on a 64 bit architecture. The above solution is similar to other new y2038 syscalls that are being introduced: both 32 bit and 64 bit ABIs have a common entry, and the compat entry supports the old 32 bit syscall interface. Alternatives considered were: 1. Add new time type to struct timex that makes use of padded bits. This time type could be based on the struct __kernel_timespec. modes will use a flag to notify which time structure should be used internally. This needs some application level changes on both 64 bit and 32 bit architectures. Although 64 bit machines could continue to use the older timeval structure without any changes. 2. Add a new u8 type to struct timex that makes use of padded bits. This can be used to save higher order tv_sec bits. modes will use a flag to notify presence of such a type. This will need some application level changes on 32 bit architectures. 3. Add a new compat_timex structure that differs in only the size of the time type; keep rest of struct timex the same. This requires extra syscalls to manage all 3 cases on 64 bit architectures. This will not need any application level changes but will add more complexity from kernel side. Signed-off-by: Deepa Dinamani --- include/linux/timex.h | 7 +++++++ include/uapi/linux/timex.h | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/include/linux/timex.h b/include/linux/timex.h index 39c25dbebfe8..7f40e9e42ecc 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -53,6 +53,13 @@ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H +/* CONFIG_64BIT_TIME enables new 64 bit time_t syscalls in the compat path + * and 32-bit emulation. + */ +#ifndef CONFIG_64BIT_TIME +#define __kernel_timex timex +#endif + #include #define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */ diff --git a/include/uapi/linux/timex.h b/include/uapi/linux/timex.h index 92685d826444..a1c6b73016a5 100644 --- a/include/uapi/linux/timex.h +++ b/include/uapi/linux/timex.h @@ -92,6 +92,47 @@ struct timex { int :32; int :32; int :32; }; +struct __kernel_timex_timeval { + __kernel_time64_t tv_sec; + long long tv_usec; +}; + +#ifndef __kernel_timex +struct __kernel_timex { + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror;/* maximum error (usec) */ + long long esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + int :32; /* pad */ + long long constant;/* pll time constant */ + long long precision;/* clock precision (usec) (read only) */ + long long tolerance;/* clock frequency tolerance (ppm) + * (read only) + */ + struct __kernel_timex_timeval time; /* (read only, except for ADJ_SETOFFSET) */ + long long tick; /* (modified) usecs between clock ticks */ + + long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int :32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +}; +#endif + /* * Mode codes (timex.mode) */ -- 2.20.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel