Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755057AbcDICoY (ORCPT ); Fri, 8 Apr 2016 22:44:24 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:64399 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752601AbcDICoV (ORCPT ); Fri, 8 Apr 2016 22:44:21 -0400 From: Arnd Bergmann To: Andrew Pinski Subject: Re: [RFC6 PATCH v6 00/21] ILP32 for ARM64 Date: Sat, 9 Apr 2016 04:42:54 +0200 User-Agent: KMail/1.12.2 (Linux/3.19.0-58-generic; KDE/4.3.2; x86_64; ; ) Cc: Adam Borowski , LKML , Geert Uytterhoeven , Catalin Marinas , "linux-arm-kernel@lists.infradead.org" , Martin Schwidefsky , Heiko Carstens , Prasun Kapoor , Andreas Schwab , Nathan Lynch , Alexander Graf , Alexey Klimov , Mark Brown , "Joseph S. Myers" , christoph.muellner@theobroma-systems.com, "Zhangjian (Bamvor)" , "linux-doc@vger.kernel.org" , "Linux-Arch" , "linux-s390" , Yury Norov References: <20160407121838.GA22098@angband.pl> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201604090442.54328.arnd@arndb.de> X-Provags-ID: V03:K0:r1etM9fQi78/lsESC8C90A6DZyeG0VWmEIVmwrOuWzdKil7rHm+ Sgrye4Ok3MqBnFkTziLtLp4oOMgX3sgNh6RXoc9JTsrOm0QhQvKWDX4x+T56kuPUZLBZRea +iX+86u6w4FyUbX1ymNTGuSQ48VZ9ALXJ0xCIJHMm08x0RXCu26XGCGlJ9/JTsjKCynk0Bm +B2Rx9e66JpwDW78Na8fw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Z4RbXZYUB8Y=:I7hiHCYPs4dnUQuMxY0x6R etSTVD8Sk9dRsErYUsbLBfIOQ8WQTt2bSXiBu9KG04YxPwpenbWvNb3qzee0euRoKC/1+ZzQu 3QnhZ1pSdxMiFlc1kpsX/wK20ZkcaWdnX1jqNNHDXTWvXkG3lEuxKFBY8BtdvDaSPGJfkwJNP fhKYagJl001WvrYGz8jO1JkFJ3uYA5fcKgwfnBLKiAeG8iOgUWXj/4hdyH62NbwpUp8ArjnrY LOUKL6GcwngvWvdAvzi2dL/5RZL4Xls+fcKOtcA7+rJYKgrlrmahFzaPMzQGc3sl/gSvJS42O cNrYlskWb55J5jkB0TxyFmcBpzCBjSyohCQsr5WA+u9X9rQDov7cib0MX+/BWRlzccCMmIaB6 TIq7Yfifuap5FdHEkzFUIhHoV8c7WNCki4A8o+EHjwleiZSr1gOANaJ7gFIaXlSiEqpU4aRiI uKQ91qKR/TDHjKjcwUTKLtjz358KqFvqZJncAj9Gti2fRxcNwvojsggK3/RFTQeMOPE9yNST5 95R9VTsnn3L6kClC2okDcBORpfUX25XklzAL/vF8zeniTB7VNMK2Joi/WGaZkMUD7Bqt45Bm1 yI7mV5V24Qys8oZ8MUwKrUAkUh1y693erqG833mq8E3WCvA57AJirQsZdIi57tB74dFV44L7W jyFsIPKPZqS1d94tA0Lv71LU/ttn95Jg4kx4TK74+o0KZhcoiQ//0GOWY4waEcxUAPzDSFsiY FDsnMbvwkuLWHD9A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4407 Lines: 86 On Friday 08 April 2016, Andrew Pinski wrote: > On Thu, Apr 7, 2016 at 5:18 AM, Adam Borowski wrote: > > On Wed, 6 Apr 2016, Geert Uytterhoeven wrote: > >> On Wed, Apr 6, 2016 at 12:08 AM, Yury Norov wrote: > >>> v6: > >>> - time_t, __kenel_off_t and other types turned to be 32-bit > >>> for compatibility reasons (after v5 discussion); > > > > Introducing a new arch today with y2038 problems is not a good idea. > > Linus said so with appropriately pointy words in 2011. This was before we made the decision to fix the y2038 problem for all architectures. > This is the third time we had this discussion on time_t for ILP32. I > had originally it as 32bit, then Catalin suggested I change it to > 64bit and then Arnd (with his work for 2038 issue on 32bit arch) said > ILP32 should match all other 32bit targets and the other 64bit time_t > be fixed by the current work he was working on. Now you are > suggesting we change it again. > Arnd can you please comment more on why we want 32bit time_t instead > of the 64bit one? I Know there was some POSIX (or was it C90) > violation but I suspect there is an easy way to workaround this inside > the kernel but the discussion to move over to 32bit time_t was already > made by the time I started to look into that. x32 still runs into new problems today, and will continue to have problems with newly added drivers that pass time_t (or other __kernel_long_t) arguments through ioctl. To avoid having to audit every new driver for interfaces that behave differently based on the __kernel_long_t definition, arm64 is not following the same route as x86 here and instead uses the normal 32-bit ABI like any other architecture. This means we use 32-bit time_t, aio_context_t, size_t and clock_t and share the system call implementation with the compat handling for arm (aarch32) mode. Once we have the interfaces for 64-bit time_t in place in the kernel, we will be able to rebuild glibc on all 32-bit architectures including arm and arm64/ilp32 that way. The POSIX and C99 incompatibility you mention is about struct timespec, which uses 'long' as the type for the tv_nsec member. This is vaguely related to the issue of 64-bit time_t, but is not the reason for starting out with 32-bit time_t for the new ABI here. [side note: How to precisely handle tv_nsec on 32-bit architectures is still an open issue that will have to be solved when we nail down the new system call interfaces: The issue specifically is what happens when the upper half of the second 64-bit word in struct timespec argument passed into a system call is nonzero: the normal 64-bit syscalls must return an error, while the 32-bit user space expects the kernel to ignore the upper bits. This means something between the application and the native system call has to clear the bits, and this can either be done by copying the data inside of glibc (as done on x32) or by adding an extra system call entry point in the kernel.] > >> We're already closer to the (future) y2038 than to the (past) introduction of > >> LP64... > >> > >> These unfixable legacy applications have been spreading through x32 to > >> the shiny new arm64 server architecture (does ppc64el also have an ILP32 mode, > >> or is it planned)? Lots of resources are spent on maintaining the status quo, > >> instead of on fixing the real problems. > > > > As an x32 (userland) porter, I can tell you that time_t!=long _did_ cause > > non-trivial amounts of work. But that work is already done (at least in > > Debian), so you might as well benefit from it. > > There is actually private code out there which uses timespec and > timeval to pass time over the wire; yes I know bad coding style and > all but they did it that way. This is code which was working for x86 > and we are porting it to ARM64; a data center code by the way; not > some networking code even. This means they have not ported the code > to fully 64bit yet and they might never. This code will run into the same problem on arm64/ilp32 when built against a future libc implementation that defines time_t as 64-bit, but at least the glibc maintainers so far plan to leave this as a per-application option for the forseeable future: even on a system that uses 64-bit time_t in user space and kernel by default, you should be able to build an application using a 32-bit time_t. Arnd