From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932303AbcELNHt (ORCPT ); Thu, 12 May 2016 09:07:49 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:56625 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbcELNHr (ORCPT ); Thu, 12 May 2016 09:07:47 -0400 From: Arnd Bergmann To: "Zhangjian (Bamvor)" Cc: Catalin Marinas , linux-doc@vger.kernel.org, Andrew Pinski , heiko.carstens@de.ibm.com, Yury Norov , 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: Thu, 12 May 2016 15:06:39 +0200 Message-ID: <4521594.dSmlmmAdFg@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <57347BD4.8010105@huawei.com> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <2733875.IzutTZKHMc@wuerfel> <57347BD4.8010105@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:OFnnc/PlDr2fZ1pNliU7Z3D502gydbFHfr8vx53Kn0hw3vaENlf hXMUy18i6M9oR7N1QE9kWZm1t1ntgJ6COpVqmxkw4MIrEC4LzI791WLmj7BFDAmOpojMpVM 9f0yUeIBTzhRwHNwyb8ETYKoocuYNJGwg7kyRS0WBLqCbJRh3FoVC8VGkDWPVYFJa/s1jJw r6/3Sl6XrsaJFcuo6BpLg== X-UI-Out-Filterresults: notjunk:1;V01:K0:bDPC9JpgCoM=:FX1DHrMdKdlfFfPcGPH1+g iTXCC0NdW7S2TayDaeaCz0iBDv5qyn7G9UjvWVxdnZSJmF+z1cTecL0LaMbtZ4qZ8PixEFuc1 vmrcKdp76tusov8G+V8eNugfuS5cq7+qBHgh2AVHmTJW90hqR5qAmvpLpkrkk6welCmX5ydt/ stuvtBARTv8U7rrSl1PWpMSRIEPRQ4zVxKBdcHAYGlsigMp3euUB33nftJwo0UxS4eXPFdHfv zCTtd5cJpDGRE0C+Cb6lF1xsH8gwRqo9lV71AXpozBgb1AuwD97yqle9EjNWKnXjig1fnvJPE hNfysMPNIQv8fatWWt0Mfjk0PZLQl1GVoDbV8GV3SrLwtzSJj+JiZc2vQkEEF6ty5hnS7TUva KMThwaXvA6fyLhHmCC16WZjs+bEBfXUN0JpUGFmr2Ym1o+2IEq7Bc+UwsbZz16RxmVAPURyTS PNV6NYlEkBmGSceEmB0WF1B3iXEnIKOOk2jeSqTqlf2l0AioHqcshcqIc92J778NDMtpY8oJE HZRQz3RitAa4C7e6igiHnl3XVe22E3yadZbRWzM/mBszsHfdWl8cMOmyYaHt2QagS1bRiuuwv p6EPuzBdxWsyErK9+4CzqCKRLddCeRbvrzSbfzZ4b8gHDeyFY5Xlr+DRKrjVMBJS2sLI0fQ/3 dz6cUw0Fp2l5js8aWtwRMksV8LpdHZMIuJ6dwjjmMVz7waBhkutXIkDYB11b2s/oIGmJLirWG IBGeYTKhvQ00lXAI Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 12 May 2016 20:49:24 Zhangjian wrote: > Hi, > > On 2016/5/12 17:21, Arnd Bergmann wrote: > > On Thursday 12 May 2016 10:17:58 Catalin Marinas wrote: > >> On Wed, May 11, 2016 at 09:30:07PM +0200, Arnd Bergmann wrote: > >>> On Wednesday 11 May 2016 17:59:01 Catalin Marinas wrote: > >>> > >>> I don't think the shifts are a problem, the main downside would be > >>> the limit to 44 bits of file offsets (16TB files), but it's also > >>> unclear if that is a practical problem at all. If it is, we run > >>> into the same problem on all other 32-bit architectures too. > >> > >> I hope people are seriously thinking of moving to an LP64 ABI if they > >> have such large file offset needs. > > > > Good point. 44 bits of file size is certainly enough for mmap() > > on a 32-bit task: you would only be able to map a very small fraction > > of the file anyway, and if you want to map larger files, and should > > move to 64-bit tasks long before this becomes a limitation. > Hi, > > I apply the following patch in order to make use of the REAL mmmap2. LTP > test pass in litle endian. mmap16 successful with segfault in big endian. > > BTW, I saw the similar code in tile, mips, microblaze and s390 compat. Should > we merge these code into a common syscall wrapper? I think that's a good idea. The function used to be slightly different for each architecture, but now it seems we have a significant number of identical implementations that we could just merge them together into one. sys_mmap_pgoff was originally introduced as the common implementation and it reduced the amount of duplication a lot, but as its units are based on PAGE_SIZE rather than hardwired 4096 bytes, it's not as useful. > diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c > index d85fe94..2cd72eb 100644 > --- a/arch/arm64/kernel/sys_ilp32.c > +++ b/arch/arm64/kernel/sys_ilp32.c > @@ -41,7 +41,16 @@ > #define compat_sys_sync_file_range sys_sync_file_range > #define compat_sys_truncate64 sys_truncate > #define sys_llseek sys_lseek > -#define sys_mmap2 sys_mmap > + > +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > + unsigned long, prot, unsigned long, flags, unsigned long, fd, > + unsigned long, pgoff) > +{ > + if (pgoff & (~PAGE_MASK >> 12)) > + return -EINVAL; > + > + return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12)); > +} > Looks good to me. Arnd