From patchwork Wed Apr 9 16:01:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 3956451 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C8AFF9F371 for ; Wed, 9 Apr 2014 16:04:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F380F205BB for ; Wed, 9 Apr 2014 16:04:52 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 D5B2B205B9 for ; Wed, 9 Apr 2014 16:04:51 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXuzN-0002Zk-SQ; Wed, 09 Apr 2014 16:04:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXuzL-0000Aa-K0; Wed, 09 Apr 2014 16:04:35 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXuyw-0008LX-NZ for linux-arm-kernel@lists.infradead.org; Wed, 09 Apr 2014 16:04:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=O+iX7Ord9dHKQh0tGyRm6d+CLzeiugCogY4lRkgB4/g=; b=Pe3i3BITo3tEOnwVRLZhvHZZif7svxnZzuVKgkuVOF0eKHGHmW0u7P6cBuEC0siw8bX7kFCMjkM/h2VRhTdVLXgkoTTvz/1jWnsptMjmzPwNaxArMmkBTRqDjJZQa8ra5H0cQQGV90Yl1QLekPgTGqDreLPPkflkpKHkqsmrulk=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:45587) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1WXuwU-0008NE-RE; Wed, 09 Apr 2014 17:01:38 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1WXuw1-0005Ap-FH; Wed, 09 Apr 2014 17:01:09 +0100 Date: Wed, 9 Apr 2014 17:01:09 +0100 From: Russell King - ARM Linux To: Arnd Bergmann Subject: Re: [PATCH] ARM: reinsert ARCH_MULTI_V4 Kconfig option Message-ID: <20140409160108.GU16119@n2100.arm.linux.org.uk> References: <1386922149-4561-1-git-send-email-jonas.jensen@gmail.com> <20140409151326.GY29751@pengutronix.de> <20140409152711.GT16119@n2100.arm.linux.org.uk> <5844640.QRALKyBQaa@wuerfel> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5844640.QRALKyBQaa@wuerfel> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140409_120411_218978_666B5C6A X-CRM114-Status: GOOD ( 22.51 ) X-Spam-Score: -2.3 (--) Cc: ulli.kroll@googlemail.com, "linux-kernel@vger.kernel.org" , Jonas Jensen , "arm@kernel.org" , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Olof Johansson , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Wed, Apr 09, 2014 at 05:50:57PM +0200, Arnd Bergmann wrote: > On Wednesday 09 April 2014 16:27:11 Russell King - ARM Linux wrote: > > If it's called from ARM code, then \reg will contain a 4-byte aligned > > address. If it's called from Thumb code, \reg will contain a 2-byte > > aligned address with bit 0 *always* set. > > Right, that is the assumption. > > > So, with the code originally quoted above, if the helper is called from > > thumb code, and CONFIG_CPU_32v4 is enabled, then we end up falling past > > the moveq to the "b ." and entering an infinite loop. > > As Uwe said, that "b ." was not meant to be in the patch used for > submission, it was to check what goes wrong when running this code > on ARMv4 -- either crash user space or hang in an infinite loop. > I forgot what the result of that experiment was. > > The trouble is that this code: > > .macro usr_ret, reg > #ifdef CONFIG_ARM_THUMB > #ifdef CONFIG_CPU_32v4 > tst \reg, #3 > moveq pc, \reg > #endif > bx \reg > #else > mov pc, \reg > #endif > .endm > > for some reason does the wrong thing running on ARMv4 (fa526) with non-thumb > user space when both CONFIG_CPU_32v4 and CONFIG_ARM_THUMB are enabled: > it still tries to do the 'bx' and triggers an invalid opcode exception. I assume this has been discussed in off-list (maybe on some irc channel somewhere), because there's nothing on-list apart from these emails... So, let's repeat the debugging which probably has already occured, but this time on-list... It would be useful to see the register state from the undefined instruction exception. That needs this patch, CONFIG_DEBUG_USER in the kernel config enabled, and user_debug=1 passed on the kernel command line. diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 172ee18ff124..abd2fc067736 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -445,6 +445,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) if (user_debug & UDBG_UNDEFINED) { printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", current->comm, task_pid_nr(current), pc); + __show_regs(regs); dump_instr(KERN_INFO, regs); } #endif