linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v19 02/11] ARM: kprobes: remove unused ARM decoder actions.
Date: Wed, 07 Jan 2015 11:50:36 +0000	[thread overview]
Message-ID: <1420631436.4044.26.camel@linaro.org> (raw)
In-Reply-To: <1420457354-77099-1-git-send-email-wangnan0@huawei.com>

On Mon, 2015-01-05 at 19:29 +0800, Wang Nan wrote:
> There are 3 actions which is never used:
> 
>  PROBES_MOV_HALFWORD,
>  PROBES_SEV,
>  PROBES_WFE,
> 
> This patch removes them.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>

I think that PROBES_MOV_HALFWORD should be used, for MOVW and MOVT.
Currently those instructions use PROBES_DATA_PROCESSING_IMM which,
whilst it will work it ends up using a less efficient emulation routine
than necessary.

The other unused actions, PROBES_SEV and PROBES_WFE, could possibly be
removed as redundant, but there are are Thumb equivalents for those
which are used, so for symmetry I think we should use them. That will
let us remove PROBES_EMULATE_NONE and PROBES_SIMULATE_NOP.

So how about the following patch instead...

----------------------------------------------------------------------------

From: Jon Medhurst <tixy@linaro.org>
Date: Wed, 7 Jan 2015 11:42:30 +0000
Subject: [PATCH] ARM: probes: Use correct action types for MOVW, SEV and WFI

This doesn't correct any bugs when probing these instructions but makes
MOVW slightly faster and makes everything more symmetric with the Thumb
instruction cases.

We can also remove the now redundant PROBES_EMULATE_NONE and
PROBES_SIMULATE_NOP actions.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
---
 arch/arm/probes/decode-arm.c          | 6 +++---
 arch/arm/probes/decode-arm.h          | 2 --
 arch/arm/probes/kprobes/actions-arm.c | 2 --
 arch/arm/probes/uprobes/actions-arm.c | 2 --
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/arm/probes/decode-arm.c b/arch/arm/probes/decode-arm.c
index f46d8fc..f72c33a 100644
--- a/arch/arm/probes/decode-arm.c
+++ b/arch/arm/probes/decode-arm.c
@@ -370,17 +370,17 @@ static const union decode_item arm_cccc_001x_table[] = {
 
 	/* MOVW			cccc 0011 0000 xxxx xxxx xxxx xxxx xxxx */
 	/* MOVT			cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx */
-	DECODE_EMULATEX	(0x0fb00000, 0x03000000, PROBES_DATA_PROCESSING_IMM,
+	DECODE_EMULATEX	(0x0fb00000, 0x03000000, PROBES_MOV_HALFWORD,
 						 REGS(0, NOPC, 0, 0, 0)),
 
 	/* YIELD		cccc 0011 0010 0000 xxxx xxxx 0000 0001 */
 	DECODE_OR	(0x0fff00ff, 0x03200001),
 	/* SEV			cccc 0011 0010 0000 xxxx xxxx 0000 0100 */
-	DECODE_EMULATE	(0x0fff00ff, 0x03200004, PROBES_EMULATE_NONE),
+	DECODE_EMULATE	(0x0fff00ff, 0x03200004, PROBES_SEV),
 	/* NOP			cccc 0011 0010 0000 xxxx xxxx 0000 0000 */
 	/* WFE			cccc 0011 0010 0000 xxxx xxxx 0000 0010 */
 	/* WFI			cccc 0011 0010 0000 xxxx xxxx 0000 0011 */
-	DECODE_SIMULATE	(0x0fff00fc, 0x03200000, PROBES_SIMULATE_NOP),
+	DECODE_SIMULATE	(0x0fff00fc, 0x03200000, PROBES_WFE),
 	/* DBG			cccc 0011 0010 0000 xxxx xxxx ffff xxxx */
 	/* unallocated hints	cccc 0011 0010 0000 xxxx xxxx xxxx xxxx */
 	/* MSR (immediate)	cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx */
diff --git a/arch/arm/probes/decode-arm.h b/arch/arm/probes/decode-arm.h
index a7b0398..b3b80f6 100644
--- a/arch/arm/probes/decode-arm.h
+++ b/arch/arm/probes/decode-arm.h
@@ -18,8 +18,6 @@
 #include "decode.h"
 
 enum probes_arm_action {
-	PROBES_EMULATE_NONE,
-	PROBES_SIMULATE_NOP,
 	PROBES_PRELOAD_IMM,
 	PROBES_PRELOAD_REG,
 	PROBES_BRANCH_IMM,
diff --git a/arch/arm/probes/kprobes/actions-arm.c b/arch/arm/probes/kprobes/actions-arm.c
index 1e67839..06988ef 100644
--- a/arch/arm/probes/kprobes/actions-arm.c
+++ b/arch/arm/probes/kprobes/actions-arm.c
@@ -303,8 +303,6 @@ emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t insn,
 }
 
 const union decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = {
-	[PROBES_EMULATE_NONE] = {.handler = probes_emulate_none},
-	[PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop},
 	[PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop},
 	[PROBES_PRELOAD_REG] = {.handler = probes_simulate_nop},
 	[PROBES_BRANCH_IMM] = {.handler = simulate_blx1},
diff --git a/arch/arm/probes/uprobes/actions-arm.c b/arch/arm/probes/uprobes/actions-arm.c
index 1dd4916..76eb449 100644
--- a/arch/arm/probes/uprobes/actions-arm.c
+++ b/arch/arm/probes/uprobes/actions-arm.c
@@ -195,8 +195,6 @@ uprobe_decode_ldmstm(probes_opcode_t insn,
 }
 
 const union decode_action uprobes_probes_actions[] = {
-	[PROBES_EMULATE_NONE] = {.handler = probes_simulate_nop},
-	[PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop},
 	[PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop},
 	[PROBES_PRELOAD_REG] = {.handler = probes_simulate_nop},
 	[PROBES_BRANCH_IMM] = {.handler = simulate_blx1},
-- 
2.1.4

  reply	other threads:[~2015-01-07 11:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 11:28 [PATCH v19 00/11] ARM: kprobes: OPTPROBES and other improvements Wang Nan
2015-01-05 11:29 ` [PATCH v19 01/11] ARM: probes: move all probe code to dedicate directory Wang Nan
2015-01-09  2:19   ` [PATCH v20 " Wang Nan
2015-01-09  9:47     ` Jon Medhurst (Tixy)
2015-01-09  9:50       ` Wang Nan
2015-01-09  2:28   ` [PATCH v19 " Wang Nan
2015-01-05 11:29 ` [PATCH v19 02/11] ARM: kprobes: remove unused ARM decoder actions Wang Nan
2015-01-07 11:50   ` Jon Medhurst (Tixy) [this message]
2015-01-05 11:29 ` [PATCH v19 03/11] ARM: kprobes: introduces checker Wang Nan
2015-01-05 11:29 ` [PATCH v19 04/11] ARM: kprobes: collects stack consumption for store instructions Wang Nan
2015-01-05 11:29 ` [PATCH v19 05/11] ARM: kprobes: disallow probing stack consuming instructions Wang Nan
2015-01-05 11:29 ` [PATCH v19 06/11] ARM: kprobes: Add test cases for " Wang Nan
2015-01-05 11:29 ` [PATCH v19 07/11] kprobes: Pass the original kprobe for preparing optimized kprobe Wang Nan
2015-01-05 11:29 ` [PATCH v19 08/11] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2015-01-07 13:01   ` Jon Medhurst (Tixy)
2015-01-09  6:37   ` [PATCH v20 " Wang Nan
2015-01-09 10:25     ` Jon Medhurst (Tixy)
2015-01-09 10:55       ` Wang Nan
2015-01-09 16:35       ` Russell King - ARM Linux
2015-01-09 17:28         ` Jon Medhurst (Tixy)
2015-01-09 17:57           ` Russell King - ARM Linux
2015-01-09 19:18             ` Jon Medhurst (Tixy)
2015-01-09  6:51   ` [PATCH v19 " Wang Nan
2015-01-05 11:29 ` [PATCH v19 09/11] ARM: kprobes: Fix unreliable MRS instruction tests Wang Nan
2015-01-05 11:29 ` [PATCH v19 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2015-01-13 15:01   ` Jon Medhurst (Tixy)
2015-01-13 16:13     ` [PATCH] " Jon Medhurst (Tixy)
2015-01-19 10:37       ` Wang Nan
2015-01-05 11:34 ` [PATCH v19 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2015-01-07 13:40 ` [PATCH v19 00/11] ARM: kprobes: OPTPROBES and other improvements Jon Medhurst (Tixy)
2015-01-20  2:17   ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420631436.4044.26.camel@linaro.org \
    --to=tixy@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).