From patchwork Tue Jul 23 18:02:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 2832120 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0DE26C0319 for ; Tue, 23 Jul 2013 18:03:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD5752026D for ; Tue, 23 Jul 2013 18:03:26 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B96120262 for ; Tue, 23 Jul 2013 18:03:25 +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 1V1gvb-0007oq-Um; Tue, 23 Jul 2013 18:03:16 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1gvX-0002lh-N8; Tue, 23 Jul 2013 18:03:11 +0000 Received: from ducie-dc1.codethink.co.uk ([37.128.190.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1gvM-0002jV-GK for linux-arm-kernel@lists.infradead.org; Tue, 23 Jul 2013 18:03:01 +0000 Received: from localhost (localhost [127.0.0.1]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTP id 1115D4608AD; Tue, 23 Jul 2013 19:02:39 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at ducie-dc1.codethink.co.uk Received: from ducie-dc1.codethink.co.uk ([127.0.0.1]) by localhost (ducie-dc1.codethink.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Md3mRAG-NmQ8; Tue, 23 Jul 2013 19:02:35 +0100 (BST) Received: from [192.168.24.134] (rainbowdash.dyn.ducie.codethink.co.uk [192.168.24.134]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTPSA id 8F9834609E1; Tue, 23 Jul 2013 19:02:34 +0100 (BST) Message-ID: <51EEC53A.8070608@codethink.co.uk> Date: Tue, 23 Jul 2013 19:02:34 +0100 From: Ben Dooks Organization: Codethink Limited. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Victor Kamensky Subject: Re: updates for be8 patch series References: In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130723_140300_753372_89B6DF35 X-CRM114-Status: GOOD ( 24.11 ) X-Spam-Score: -1.9 (-) Cc: 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.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 On 23/07/13 18:40, Victor Kamensky wrote: > [resend in plain-text mode] > > Hi Ben, > > Wrt BE8 little endian instructions you will need to fix couple more places: > ftrace arch/arm/kernel/ftrace.c > kprobes arch/arm/kernel/kprobes.c > Also in big endian mode atomic64_xxx function will need fixes, otherwise perf > counters will be truncated on max of 32bit values > atomic64 arch/arm/include/asm/atomic.h > > I've attached board independent (core) patch from my work that made > Pandaboard ES > kernel run in BE mode. You can check my version of fixes for above issues in the > patch. Look for corresponding files changes. Please rework them > according to style > and rules of your patch series. Note the patch itself contains fixes > for few other > issues that already fixed in your series. I'll cross check and compare > individual > areas latter. I think you may find attached patch interesting as well, > it was developed > independent from yours but matches it very well. > > Wrt of testing: ftrace was tested on Pandaboard ES, krprobes changes were tested > with SystemTap at some point of patch version on Pandaboard ES (not > thumb mode though), > also it may deteriorated while ported across different kernel version, > good idea to > rested last patch. atomic64 were tested on Pandaboard ES and Marvell Armada XP. Please wrap your emails to <80 characters, it was really difficult to read this. The atomic64 ops is an interesting one, I still think the in-kernel one is correct. Why are atomic64 being used on 32bit? If you are trying to decompose a 64bit into two 32bits, then that's probably the problem. The relocation code, the R_ARM instruction relocations should only be instructions and therefore can be safely swapped using the correct op-code accesses. The R_ARM_ABS32 IIRC is always in the same ordering as the CPU would access data. The kprobes stuff I am surprised if it works, due to the fact it calls patch_text() which already uses to do the relevant byte-swapping. I think you only need to apply swaps to anything that it loads from memory. Which version of Linux did you patch? I think this is the necessary change to kprobes: decode_insn = thumb16_kprobe_decode_insn; @@ -73,7 +74,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) thumb = false; if (addr & 0x3) return -EINVAL; - insn = *p->addr; + insn = __mem_to_opcode_arm(*p->addr); decode_insn = arm_kprobe_decode_insn; #endif diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index 170e9f3..c548356 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "kprobes.h" @@ -62,10 +63,10 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) #ifdef CONFIG_THUMB2_KERNEL thumb = true; addr &= ~1; /* Bit 0 would normally be set to indicate Thumb code */ - insn = ((u16 *)addr)[0]; + insn = __mem_to_opcode_thumb16(((u16 *)addr)[0]); if (is_wide_instruction(insn)) { insn <<= 16; - insn |= ((u16 *)addr)[1]; + insn |= __mem_to_opcode_thumb16(((u16 *)addr)[1]); decode_insn = thumb32_kprobe_decode_insn; } else