From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbcEKK4B (ORCPT ); Wed, 11 May 2016 06:56:01 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59776 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbcEKKz7 (ORCPT ); Wed, 11 May 2016 06:55:59 -0400 From: Arnd Bergmann To: Yury Norov Cc: "Zhangjian (Bamvor)" , linux-doc@vger.kernel.org, Andrew Pinski , catalin.marinas@arm.com, heiko.carstens@de.ibm.com, Hanjun Guo , joseph@codesourcery.com, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, "jijun (D)" , Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, agraf@suse.de, pinskia@gmail.com, klimov.linux@gmail.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, Nathan_Lynch@mentor.com, linux-kernel@vger.kernel.org, Andrew Pinski , schwidefsky@de.ibm.com, christoph.muellner@theobroma-systems.com Subject: Re: [PATCH 20/25] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Date: Wed, 11 May 2016 12:55:01 +0200 Message-ID: <5842999.Zgpfq4gkVz@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160511075438.GA15628@yury-N73SV> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <57329320.1000500@huawei.com> <20160511075438.GA15628@yury-N73SV> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:WPa9DSV5hbZS3lk01U3LOJzQm98W7kFYk0q9ikzBFZImeCymWkd quYpmq0+FpjoPbJA6GJbn6/i13W1nAHT7pzpOMRqO59pdQjz9E6+KH3OrLNLdfu7qSK8sFc c2/2cCRZ5BZ7ISn5zbyqeGBbwtLwx9qlprsuZAIqR4if1cNGFeRNsZ/uDLgCvXfBzwa/IZ4 Wb+0LmNCBaEHDZW23+gIg== X-UI-Out-Filterresults: notjunk:1;V01:K0:bsoYCOv3S0w=:jB0BpePBaVOSS/T8/vezZL GF6ttuAOnVvgTN3xEDIgk5upV3mOmzEaw9BfRRU7CfT47v0TddVSyc9zb5IHtRAAcxiUj3+xb zNkW2o5DDO40U0KInya/48IgmKCXN7QZ0OR+ERHSHz/ky6xyO3dvB+k2lY+8L6nDhCKLxLqT6 f0shgNa91opgLzgX2J8OssnIvFPT09qUKygu+fZZiuthgRDMV+FsCj3H+TZFMcMdsGP/Kx2wl 6qO5IDCXtC7ylZTplNbDs2aAOvEJWb3gQ3WshtQBrS/7dsRqfs/4j6g4/VNMIW7BbTq2GqmWf KJ42XYaaWbrId+AD0qlqdrQIqRDgJKhJ1jStfE5D3xISIZlkTgEwVZoCalTMLU/dv3+9Wk7Dh MbHZ6spWm0JiGUUw1p5VBy8yA/ECNIWSUBBfrv4QgKlFV/Rp3UHScZ91hzOBuYkJX11rl6Jfe Qpl5YtxIihqmaymkxvZ9KABiCYm4VeZZnSrB9rCmKdLNxq68jKNc/51/A/fWCJ/4HwBsL37IX kW0R7jjATcfihK9wZIrCnP2sPC+S3GW21TbrfjoYocBtzsXPGvpwOgTBy3q9SDkwhuNnPbN3u 5Fw6YBMOSIuVhut0b0nivlfcKwtNqerBdxyjguxliLm0YGg7fkCoCVFSVI7zfLyI/TVvoKQht vCBIoAwiy5AOjKLIvAMqqy9dZGCJ7U3A1ApuFLHQ7cXk0HB6O3JNZz0AloJ9NgvAnQry1qEgZ e7P+UkIJA52P16Vj Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 11 May 2016 11:04:38 Yury Norov wrote: > On Wed, May 11, 2016 at 10:04:16AM +0800, Zhangjian (Bamvor) wrote: > [...] > > > >>Ok, I will test the ltp syscall test. > > >>With this changes, the issue I mentioned should be fixed. But we still > > >>use mmap2 syscall for ILP32 application when we pass the offset instead > > >>of page offset. Is it correct? > > > > > >I don't remember. It's probably not important whether we have the shift > > >in there, as long as it's independent of the actual kernel page size and > > >user space and kernel agree on the calling conventions. > > Well. I am ok with where to shift the pages size because we get the same > > result. I was just thinking if we should get rid of the name of mmap2 in our > > ILP32 porting. Actually, it is mmap but we name it as mmap2. User may confused > > if they do not know the implementations. > > > > This is what generic unistd.h does. If you want to change it, you'd > change each arch that uses generic unistd.h. > Generic unistd.h has this: #ifdef __SYSCALL_COMPAT #define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) #else #define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) #endif #define __NR3264_mmap 222 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) #define __NR_mmap __NR3264_mmap #else #define __NR_mmap2 __NR3264_mmap #endif So by default we get __NR_mmap2 and sys_mmap2 on 32-bit ABIs, but __NR_mmap and sys_mmap on 64-bit ABIs, as it should be. The problem is that arch/arm64/kernel/sys_ilp32.c now overrides this to use __NR_mmap2 with sys_mmap, so we have a mismatch. I think we should either override both the implementation and the number, or neither of them. I think what happened is that you chose to override sys_mmap because sys_mmap2 sometimes takes an off_t argument, however the kernel just treats it as 'unsigned long', with a range of 44 bits for the offset. Using sys_mmap with a __kernel_loff_t argument gives us 64-bit range, but if we do that, I think it should be __NR_mmap. Arnd