From patchwork Wed Mar 11 11:24:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 5983611 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 7D97F9F2A9 for ; Wed, 11 Mar 2015 11:26:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAFE9203AA for ; Wed, 11 Mar 2015 11:26:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0831200F0 for ; Wed, 11 Mar 2015 11:26: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 1YVekv-0004zG-Ps; Wed, 11 Mar 2015 11:24:53 +0000 Received: from cantor2.suse.de ([195.135.220.15] helo=mx2.suse.de) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVekq-0004ge-Bs for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2015 11:24:49 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EB8EAAAC9; Wed, 11 Mar 2015 11:24:21 +0000 (UTC) Message-ID: <550025E0.7030008@suse.de> Date: Wed, 11 Mar 2015 06:24:16 -0500 From: Alexander Graf User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Will Deacon Subject: Re: [PATCH] arm64: Enable CONFIG_COMPAT also for 64k page size References: <1417707993-82290-1-git-send-email-agraf@suse.de> <20141204182049.GB7749@arm.com> <54833BAF.1030405@suse.de> <20141208101026.GD27367@arm.com> In-Reply-To: <20141208101026.GD27367@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150311_042448_587610_0AC09826 X-CRM114-Status: GOOD ( 15.88 ) X-Spam-Score: -5.0 (-----) Cc: Catalin Marinas , Michael Matz , "linux-kernel@vger.kernel.org" , =?windows-1252?Q?Dirk_M=FCller?= , Suravee Suthikulanit , Andreas Schwab , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 On 08.12.14 04:10, Will Deacon wrote: > On Sat, Dec 06, 2014 at 05:23:59PM +0000, Alexander Graf wrote: >> On 04.12.14 19:20, Will Deacon wrote: >>> On Thu, Dec 04, 2014 at 03:46:33PM +0000, Alexander Graf wrote: >>>> With binutils 2.25 the default alignment for 32bit arm sections changed to >>>> have everything 64k aligned. Armv7 binaries built with this binutils version >>>> run successfully on an arm64 system. >>>> >>>> Since effectively there is now the chance to run armv7 code on arm64 even >>>> with 64k page size, it doesn't make sense to block people from enabling >>>> CONFIG_COMPAT on those configurations. >>> >>> Is there a distro available that is built with a recent enough binutils for >>> this? I'd really like to run our regression tests to check that page-size >>> assumptions don't exist for things like shm. >> >> So how much of a distro do you need? I could probably assemble a simple >> very minimalistic rootfs with only bash if that helps. > > I'd like to run LTP, so I'd probably need slightly more than that but I > certainly don't need the whole world. So after recompiling all of the distribution with newer binutils we now have an openSUSE Factory tree that has 64k aligned 32bit binaries. Unfortunately however, the 32bit glibc has a bogus mmap() implementation that hard codes 4k page size. With the patch below applied to glibc, I can successfully run 32bit user space on Seattle with 64k PAGE_SIZE though. So I guess we'll need to fix up glibc next. Do you know of anyone who's fluent enough in 32bit ARM assembly to convert the hard coded assumptions in there to instead use a variable that takes the actual host page size into account? Alex Index: glibc-2.21/sysdeps/unix/sysv/linux/arm/mmap.S =================================================================== --- glibc-2.21.orig/sysdeps/unix/sysv/linux/arm/mmap.S +++ glibc-2.21/sysdeps/unix/sysv/linux/arm/mmap.S @@ -36,7 +36,7 @@ ENTRY (__mmap) /* convert offset to pages */ movs ip, r5, lsl #20 bne .Linval - mov r5, r5, lsr #12 + mov r5, r5, lsr #16 /* do the syscall */ DO_CALL (mmap2, 0) Index: glibc-2.21/sysdeps/unix/sysv/linux/arm/mmap64.S =================================================================== --- glibc-2.21.orig/sysdeps/unix/sysv/linux/arm/mmap64.S +++ glibc-2.21/sysdeps/unix/sysv/linux/arm/mmap64.S @@ -43,9 +43,9 @@ ENTRY (__mmap64) cfi_rel_offset (r4, 0) cfi_remember_state movs r4, ip, lsl $20 @ check that offset is page-aligned - mov ip, ip, lsr $12 + mov ip, ip, lsr $16 it eq - movseq r4, r5, lsr $12 @ check for overflow + movseq r4, r5, lsr $16 @ check for overflow bne .Linval ldr r4, [sp, $8] @ load fd orr r5, ip, r5, lsl $20 @ compose page offset