From patchwork Thu May 12 12:49:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangjian X-Patchwork-Id: 9080611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB9059F1C3 for ; Thu, 12 May 2016 12:52:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD871201EC for ; Thu, 12 May 2016 12:52:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E92862012B for ; Thu, 12 May 2016 12:52:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0q5B-0001Po-PL; Thu, 12 May 2016 12:51:13 +0000 Received: from [119.145.14.199] (helo=szxga05-in.huawei.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0q57-0001K5-S5 for linux-arm-kernel@lists.infradead.org; Thu, 12 May 2016 12:51:11 +0000 Received: from 172.24.1.138 (EHLO lggeml426-hub.china.huawei.com) ([172.24.1.138]) by szxrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AZB04056; Thu, 12 May 2016 20:40:22 +0800 (CST) Received: from [127.0.0.1] (10.111.72.170) by lggeml426-hub.china.huawei.com (10.72.61.36) with Microsoft SMTP Server id 14.3.235.1; Thu, 12 May 2016 20:49:39 +0800 Subject: Re: [PATCH 20/25] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it To: Arnd Bergmann , Catalin Marinas References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <4989778.Fs81NJurjH@wuerfel> <20160512091758.GB11226@e104818-lin.cambridge.arm.com> <2733875.IzutTZKHMc@wuerfel> From: "Zhangjian (Bamvor)" Message-ID: <57347BD4.8010105@huawei.com> Date: Thu, 12 May 2016 20:49:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <2733875.IzutTZKHMc@wuerfel> X-Originating-IP: [10.111.72.170] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.57347BF1.0014, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 653e91fddc8f3a25f20215ce2f6e565f X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160512_055110_276101_B704F843 X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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, "Zhangjian \(Bamvor\)" , 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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? kernel: Regards Bamvor > Arnd > 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)); +} asmlinkage long ilp32_sys_rt_sigreturn_wrapper(void); #define compat_sys_rt_sigreturn ilp32_sys_rt_sigreturn_wrapper glibc: diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c index e69de29..f75e251 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap.c @@ -0,0 +1,2 @@ +#include + diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c index c6c7f1d..6f1a141 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c @@ -1,29 +1 @@ -#include -#include -#include -#include - -#include -#include - -/* mmap is provided by mmap as they are the same. */ -void *__mmap (void *__addr, size_t __len, int __prot, - int __flags, int __fd, __off_t __offset) -{ - void *result; - result = (void *) INLINE_SYSCALL (mmap2, 6, __addr, __len, __prot, __flags, - return result; -} -/* mmap64 is provided by mmap as they are the same. */ -void *__mmap64 (void *__addr, size_t __len, int __prot, - int __flags, int __fd, __off64_t __offset) -{ - void *result; - result = (void *) - INLINE_SYSCALL (mmap2, 6, __addr, - __len, __prot, __flags, __fd, __offset); - return result; -} -weak_alias (__mmap, mmap) -weak_alias (__mmap64, mmap64) +#include