From patchwork Tue May 10 09:47:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangjian X-Patchwork-Id: 9055931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E13F5BF29F for ; Tue, 10 May 2016 09:50:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF53020142 for ; Tue, 10 May 2016 09:50:20 +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 07FB2200EC for ; Tue, 10 May 2016 09:50:20 +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 1b04Hg-0000Tt-Om; Tue, 10 May 2016 09:48:56 +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 1b04HX-0008U2-RJ for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2016 09:48:50 +0000 Received: from 172.24.1.46 (EHLO lggeml429-hub.china.huawei.com) ([172.24.1.46]) by szxrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AYP76233; Tue, 10 May 2016 17:38:24 +0800 (CST) Received: from [127.0.0.1] (10.111.72.170) by lggeml429-hub.china.huawei.com (10.72.61.81) with Microsoft SMTP Server id 14.3.235.1; Tue, 10 May 2016 17:47:29 +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 , References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <20160506123731.GA11959@yury-N73SV> <573190CF.6030408@huawei.com> <9651510.pg5Vmm8vKS@wuerfel> From: "Zhangjian (Bamvor)" Message-ID: <5731AE2E.2050403@huawei.com> Date: Tue, 10 May 2016 17:47:26 +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: <9651510.pg5Vmm8vKS@wuerfel> X-Originating-IP: [10.111.72.170] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5731AE3F.0240, 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-20160510_024848_746851_463832CE X-CRM114-Status: GOOD ( 12.96 ) 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 , catalin.marinas@arm.com, 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, "bamvor >> Zhangjian \(Bamvor\)" , 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=-6.3 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, Arnd On 2016/5/10 16:36, Arnd Bergmann wrote: > On Tuesday 10 May 2016 15:42:07 Zhangjian wrote: >> On 2016/5/6 20:37, Yury Norov wrote: >>> On Fri, May 06, 2016 at 08:16:48PM +0800, Zhangjian (Bamvor) wrote: >>> >>> AFAIR, here we don't shift offset, as it's 64-bit both in user- >>> and kernel-space, >> In your ilp32-2.22 branch, you wrapper mmap to mmap2 in which type of >> offset is off_t. And off_t is 32bit in ilp32, correct? >> "sysdeps/unix/sysv/linux/aarch64/ilp32/mmap64.c" >> /* 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, __fd, __offset); >> return result; >> } > > __off_t should be 'long long' on new architectures, and map > to __kernel_loff_t. > > Can you see how it is defined? For kernel part, in "include/uapi/asm-generic/posix_types.h": #ifndef __kernel_long_t typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; #endif typedef __kernel_long_t __kernel_off_t; in "include/linux/types.h": typedef __kernel_off_t off_t; "include/uapi/asm-generic/posix_types.h" is uapi, we could not check "ARCH_32BIT_OFF_T" here. Besides, the `__kernel_long_t` is long which mean it is 32bit in ILP32. should we define something like x32? ``` diff --git a/arch/arm64/include/uapi/asm/posix_types.h b/arch/arm64/include/uapi/asm/posix_types.h index 7985ff6..9baa8d3 100644 --- a/arch/arm64/include/uapi/asm/posix_types.h +++ b/arch/arm64/include/uapi/asm/posix_types.h @@ -5,6 +5,9 @@ typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; #define __kernel_old_uid_t __kernel_old_uid_t +typedef long long __kernel_long_t; +typedef unsigned long long __kernel_ulong_t; + #include #endif /* __ASM_POSIX_TYPES_H */u ``` After this definition, the following kernel types is 64bit in ILP32: typedef __kernel_long_t __kernel_suseconds_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; typedef __kernel_long_t __kernel_off_t; typedef __kernel_long_t __kernel_time_t; typedef __kernel_long_t __kernel_clock_t; typedef __kernel_ulong_t __kernel_ino_t; typedef __kernel_ulong_t __kernel_size_t; But it is not a generic way to define off_t to 64bit if ARCH_32BIT_OFF_T is not defined. How about this one? We need to define `__kernel_off_t` on all the old 32bit architecture like arm: ``` ``` On the other hand, glibc define it own off_t in "bits/types.h": __STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ __STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ in "sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h": #define __OFF_T_TYPE __SLONGWORD_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE If we define off_t as 64bit in glibc: #define __OFF_T_TYPE __SQUAD_TYPE Should We need to align all the off_t syscall to 64bit syscall in kernel? Regards Bamvor > Arnd > diff --git a/arch/arm/include/uapi/asm/posix_types.h b/arch/arm/include/uapi/asm/posix_types.h index d2de9cb..f9d065c 100644 --- a/arch/arm/include/uapi/asm/posix_types.h +++ b/arch/arm/include/uapi/asm/posix_types.h @@ -32,6 +32,9 @@ typedef unsigned short __kernel_gid_t; typedef unsigned short __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t +typedef __kernel_long_t __kernel_off_t; +#define __kernel_off_t + #include #endif ``` And We could change the generic posix_types.h a little bit: ``` diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h index fe74fcc..7bbaf04 100644 --- a/include/uapi/asm-generic/posix_types.h +++ b/include/uapi/asm-generic/posix_types.h @@ -80,10 +80,13 @@ typedef struct { } __kernel_fsid_t; #endif +#ifndef __kernel_off_t +typedef long long __kernel_off_t; +#endif + /* * anything below here should be completely generic */ -typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_time_t; typedef __kernel_long_t __kernel_clock_t;