From patchwork Sat Mar 26 12:36:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangjian X-Patchwork-Id: 8674541 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 490339F326 for ; Sat, 26 Mar 2016 12:42:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2225E20259 for ; Sat, 26 Mar 2016 12:42: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 E61FE20251 for ; Sat, 26 Mar 2016 12:42:18 +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 1ajnVJ-0006Nq-1K; Sat, 26 Mar 2016 12:39:45 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ajnVG-0006Nh-TI for linux-arm-kernel@bombadil.infradead.org; Sat, 26 Mar 2016 12:39:42 +0000 Received: from [58.251.152.52] (helo=szxga04-in.huawei.com) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ajnVD-00057y-I2 for linux-arm-kernel@lists.infradead.org; Sat, 26 Mar 2016 12:39:41 +0000 Received: from 172.24.1.138 (EHLO lggeml422-hub.china.huawei.com) ([172.24.1.138]) by szxrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AWE13986; Sat, 26 Mar 2016 20:33:30 +0800 (CST) Received: from [127.0.0.1] (10.111.72.170) by lggeml422-hub.china.huawei.com (10.72.61.32) with Microsoft SMTP Server id 14.3.235.1; Sat, 26 Mar 2016 20:36:51 +0800 Subject: Re: [RFC5 PATCH v6 00/21] ILP32 for ARM64 To: Arnd Bergmann , Andreas Schwab References: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> <20160318154918.GA1595@yury-N73SV> <6653982.FK62mVSCZO@wuerfel> From: "Zhangjian (Bamvor)" Message-ID: <56F6825B.7000906@huawei.com> Date: Sat, 26 Mar 2016 20:36:43 +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: <6653982.FK62mVSCZO@wuerfel> X-Originating-IP: [10.111.72.170] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.56F68270.0017, 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: e75bdbceb8d92e1758f7fafa28b65c6f X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160326_083940_818840_B30D152D X-CRM114-Status: GOOD ( 27.67 ) 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: young.liuyang@huawei.com, "Zhangjian \(Bamvor\)" , pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, catalin.marinas@arm.com, broonie@kernel.org, "jijun \(D\)" , heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, agraf@suse.de, klimov.linux@gmail.com, Yury Norov , jan.dakinevich@gmail.com, joseph@codesourcery.com, gaoyongliang@huawei.com, schwidefsky@de.ibm.com, Nathan_Lynch@mentor.com, Bamvor Zhang Jian , linux-arm-kernel@lists.infradead.org, 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.2 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/3/21 17:43, Arnd Bergmann wrote: > On Monday 21 March 2016 10:07:49 Andreas Schwab wrote: >> This patch may fix a few LTP tests. >> > > Thanks for analyzing. > >> diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h >> index 3631903..d1010db 100644 >> --- a/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h >> +++ b/sysdeps/unix/sysv/linux/aarch64/bits/fcntl.h >> @@ -25,18 +25,29 @@ >> #define __O_NOFOLLOW 0100000 >> #define __O_DIRECT 0200000 >> >> -#define __O_LARGEFILE 0 >> +#ifdef __ILP32__ >> +# define __O_LARGEFILE 0400000 >> +#else >> +# define __O_LARGEFILE 0 >> +#endif >> > > I guess this means I screwed up when I said I'd merged the kernel patch > that Yury did to fix it, sorry about that. > > We need the patch to make all new architecture in the kernel default to > O_LARGEFILE, and not do this in user space. I'd suggest now to keep the > patches as part of the ILP32 series after all, to make sure they are > merged at the point when they are needed. I am a little bit confuse about off_t. In "[PATCH 08/33] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option", it mentioned that all the new 32bit architecture should use 64bit off_t. Should we define off_t in aarch64(for both ilp32 and lp64) in typesize.h as following? diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h index 7073493..13b77c5 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h @@ -33,7 +33,7 @@ #define __INO64_T_TYPE __UQUAD_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE -#define __OFF_T_TYPE __SLONGWORD_TYPE +#define __OFF_T_TYPE __SQUAD_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE Then we could remove the __USE_FILE_OFFSET64 in stat.h and fcnt.h in aarch64. And truncate and ftruncate is same as truncate64 and ftruncate64. Otherwise we need to handle the pad like yury do it in stat.h, and we need to handle the bigendian as well: From 61949bf70527b9cc450e7bbdba9182f7f120c5bd Sun March 26 00:00:00 2016 From: j00321192 Date: Thu, 24 Mar 2016 22:10:25 +0800 Subject: [PATCH] Fix endian issue in struct stat and stat64 There is endian issue in the existence bits/stat.h in aarch64. Fix it by add the __AARCH64EB__ with proper pad. Tested in our arm64 hardware. It could fix all the *stat test cases. Signed-off-by: Yongliang Gao Signed-off-by: Jun Ji Signed-off-by: Yang Liu(Young) Signed-off-by: Zhang Jian(Bamvor) --- sysdeps/unix/sysv/linux/aarch64/bits/stat.h | 38 +++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h index 3d50e7a..4c6e072 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h @@ -35,12 +35,21 @@ struct stat { __dev_t st_dev; /* Device. */ #ifdef __ILP32__ + +#if !defined(__AARCH64EB__) unsigned int __st_ino_pad; +#endif + # ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ # else __ino_t __st_ino; /* 32bit file serial number. */ # endif + +#if defined(__AARCH64EB__) + unsigned int __st_ino_pad; +#endif + #else # ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ @@ -55,10 +64,17 @@ struct stat __dev_t st_rdev; /* Device number, if device. */ __dev_t __pad1; #ifndef __USE_FILE_OFFSET64 + +#if defined(__ILP32__) && defined(__AARCH64EB__) + int __st_size_pad; +#endif + __off_t st_size; /* Size of file, in bytes. */ -# ifdef __ILP32__ + +#if defined(__ILP32__) && !defined(__AARCH64EB__) int __st_size_pad; -# endif +#endif + #else __off64_t st_size; /* Size of file, in bytes. */ #endif @@ -66,10 +82,17 @@ struct stat int __pad2; #ifndef __USE_FILE_OFFSET64 + +#if defined (__ILP32__) && defined(__AARCH64EB__) + int __st_blocks_pad; +#endif + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __ILP32__ + +#if defined (__ILP32__) && !defined(__AARCH64EB__) int __st_blocks_pad; -# endif +#endif + #else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ #endif @@ -94,7 +117,7 @@ struct stat __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ #endif -#if !defined __ILP32__ || !defined __USE_FILE_OFFSET64 +#if !defined (__ILP32__) || !defined __USE_FILE_OFFSET64 int __glibc_reserved[2]; #else __ino64_t st_ino; /* File serial number. */ @@ -106,8 +129,13 @@ struct stat64 { __dev_t st_dev; /* Device. */ # ifdef __ILP32__ + #if !defined(__AARCH64EB__) unsigned int __st_ino_pad; + #endif __ino_t __st_ino; /* 32bit file serial number. */ + #if defined(__AARCH64EB__) + unsigned int __st_ino_pad; + #endif # else __ino64_t st_ino; /* File serial number. */ # endif