From patchwork Mon Jan 19 17:18:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst \(Tixy\)" X-Patchwork-Id: 43334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7FDC22410B for ; Mon, 19 Jan 2015 17:20:31 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf2713720wid.3 for ; Mon, 19 Jan 2015 09:20:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:date :mime-version:cc:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=omrhfZXPjQ6/Hh0Bm6E+Ju4k1XrH+TEej+N6i+UOzeY=; b=akg2+KxvRpEZVBhBr0dUOyWoJGUqMOoQTWHE/73QUFO7Mf1+2jJTm7pw+2sFthHcmM NmGMqW5ZzxXJ2xcY4rnNCQuAA+X3mX0I2S0y23sSBBYGhFDRD4yvmwuAGoxa4j03TDbT bbIn1/lMYinh+NTuWoEPRu6o7KeZygeUDZNKnldeMoBgrIcNHfqln4Y9AFcqfDCLobp1 5BilPuqAoVhJT2g81wm0VFfP/MNcnkcBaGMJe3sZoX+Meo2bCCgx/k+0aIQ7+uq9OtYR ilzk8tsq5PhGqiHcafa8+PKuNyBa/mRscQUeboImYmvu++WHt/mRbcWd27pIU7P/Iifv pqXA== X-Gm-Message-State: ALoCoQlGmeJagWk4FIWqXNh752nPTnjwpc4p2wfQ9ec23EaH19dTPKdfx8CkhCkhYoIQpwEFSWHw X-Received: by 10.180.88.66 with SMTP id be2mr537425wib.1.1421688030751; Mon, 19 Jan 2015 09:20:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.229 with SMTP id v5ls592189lav.11.gmail; Mon, 19 Jan 2015 09:20:30 -0800 (PST) X-Received: by 10.112.198.1 with SMTP id iy1mr26901423lbc.13.1421688030511; Mon, 19 Jan 2015 09:20:30 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id qg8si12549965lbb.139.2015.01.19.09.20.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 09:20:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id l4so3922705lbv.13 for ; Mon, 19 Jan 2015 09:20:30 -0800 (PST) X-Received: by 10.112.44.230 with SMTP id h6mr5312770lbm.98.1421688030422; Mon, 19 Jan 2015 09:20:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1158256lbb; Mon, 19 Jan 2015 09:20:29 -0800 (PST) X-Received: by 10.66.253.168 with SMTP id ab8mr46265267pad.153.1421688028647; Mon, 19 Jan 2015 09:20:28 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kt6si1191075pbc.47.2015.01.19.09.20.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jan 2015 09:20:28 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1YDFyv-0004jH-9o; Mon, 19 Jan 2015 17:19:17 +0000 Received: from smarthost01a.mail.zen.net.uk ([212.23.1.1]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDFyr-0004Z3-Jo for linux-arm-kernel@lists.infradead.org; Mon, 19 Jan 2015 17:19:14 +0000 Received: from [82.69.122.217] (helo=linaro1) by smarthost01a.mail.zen.net.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YDFyV-000A4Q-4m; Mon, 19 Jan 2015 17:18:51 +0000 Message-ID: <1421687930.4201.21.camel@linaro.org> Subject: [PATCH] ARM: kprobes: Eliminate test code's use of BX instruction on ARMv4 CPUs From: "Jon Medhurst (Tixy)" To: linux-arm-kernel@lists.infradead.org, Russell King Date: Mon, 19 Jan 2015 17:18:50 +0000 X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 X-Originating-smarthost01a-IP: [82.69.122.217] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150119_091913_820006_1359A86C X-CRM114-Status: UNSURE ( 8.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.3 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.23.1.1 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.23.1.1 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Wang Nan 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tixy@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Non-T variants of ARMv4 CPUs don't support the BX instruction so eliminate it use. Signed-off-by: Jon Medhurst --- This patch applies on top on my kprobe-opt branch [1] for which I plan on sending a pull request for shortly. [1] git://git.linaro.org/people/tixy/kernel.git kprobe-opt arch/arm/probes/kprobes/test-arm.c | 2 ++ arch/arm/probes/kprobes/test-core.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/probes/kprobes/test-arm.c b/arch/arm/probes/kprobes/test-arm.c index e72b07e..5c6e37e 100644 --- a/arch/arm/probes/kprobes/test-arm.c +++ b/arch/arm/probes/kprobes/test-arm.c @@ -215,9 +215,11 @@ void kprobe_arm_test_cases(void) TEST_UNSUPPORTED("msr cpsr_f, lr") TEST_UNSUPPORTED("msr spsr, r0") +#if (__LINUX_ARM_ARCH__ >= 5) || defined(CONFIG_CPU_32v4T) TEST_BF_R("bx r",0,2f,"") TEST_BB_R("bx r",7,2f,"") TEST_BF_R("bxeq r",14,2f,"") +#endif #if __LINUX_ARM_ARCH__ >= 5 TEST_R("clz r0, r",0, 0x0,"") diff --git a/arch/arm/probes/kprobes/test-core.c b/arch/arm/probes/kprobes/test-core.c index e495127..9775de2 100644 --- a/arch/arm/probes/kprobes/test-core.c +++ b/arch/arm/probes/kprobes/test-core.c @@ -236,6 +236,8 @@ static int tests_failed; #ifndef CONFIG_THUMB2_KERNEL +#define RET(reg) "mov pc, "#reg + long arm_func(long r0, long r1); static void __used __naked __arm_kprobes_test_func(void) @@ -245,7 +247,7 @@ static void __used __naked __arm_kprobes_test_func(void) ".type arm_func, %%function \n\t" "arm_func: \n\t" "adds r0, r0, r1 \n\t" - "bx lr \n\t" + "mov pc, lr \n\t" ".code "NORMAL_ISA /* Back to Thumb if necessary */ : : : "r0", "r1", "cc" ); @@ -253,6 +255,8 @@ static void __used __naked __arm_kprobes_test_func(void) #else /* CONFIG_THUMB2_KERNEL */ +#define RET(reg) "bx "#reg + long thumb16_func(long r0, long r1); long thumb32even_func(long r0, long r1); long thumb32odd_func(long r0, long r1); @@ -494,7 +498,7 @@ static void __naked benchmark_nop(void) { __asm__ __volatile__ ( "nop \n\t" - "bx lr" + RET(lr)" \n\t" ); } @@ -977,7 +981,7 @@ void __naked __kprobes_test_case_start(void) "bic r0, lr, #1 @ r0 = inline data \n\t" "mov r1, sp \n\t" "bl kprobes_test_case_start \n\t" - "bx r0 \n\t" + RET(r0)" \n\t" ); }