From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
To: bigeasy@linutronix.de, oleg@redhat.com, ananth@in.ibm.com,
srikar@linux.vnet.ibm.com
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org, anton@redhat.com, mingo@elte.hu
Subject: [PATCH v2 2/4] powerpc: Move the single step enable code to a generic path
Date: Mon, 03 Dec 2012 20:38:37 +0530 [thread overview]
Message-ID: <20121203150754.7727.42629.stgit@suzukikp> (raw)
In-Reply-To: <20121203150438.7727.74924.stgit@suzukikp>
From: Suzuki K. Poulose <suzuki@in.ibm.com>
This patch moves the single step enable code used by kprobe to a generic
routine header so that, it can be re-used by other code, in this case,
uprobes. No functional changes.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Ananth N Mavinakaynahalli <ananth@in.ibm.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
arch/powerpc/include/asm/probes.h | 25 +++++++++++++++++++++++++
arch/powerpc/kernel/kprobes.c | 21 +--------------------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
index 5f1e15b..f94a44f 100644
--- a/arch/powerpc/include/asm/probes.h
+++ b/arch/powerpc/include/asm/probes.h
@@ -38,5 +38,30 @@ typedef u32 ppc_opcode_t;
#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+#define MSR_SINGLESTEP (MSR_DE)
+#else
+#define MSR_SINGLESTEP (MSR_SE)
+#endif
+
+/* Enable single stepping for the current task */
+static inline void enable_single_step(struct pt_regs *regs)
+{
+ regs->msr |= MSR_SINGLESTEP;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+ /*
+ * We turn off Critical Input Exception(CE) to ensure that the single
+ * step will be for the instruction we have the probe on; if we don't,
+ * it is possible we'd get the single step reported for CE.
+ */
+ regs->msr &= ~MSR_CE;
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
+#ifdef CONFIG_PPC_47x
+ isync();
+#endif
+#endif
+}
+
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_PROBES_H */
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 4901b34..92f1be7 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -36,12 +36,6 @@
#include <asm/sstep.h>
#include <asm/uaccess.h>
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
-#define MSR_SINGLESTEP (MSR_DE)
-#else
-#define MSR_SINGLESTEP (MSR_SE)
-#endif
-
DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
@@ -104,20 +98,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{
- regs->msr |= MSR_SINGLESTEP;
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- /*
- * We turn off Critical Input Exception(CE) to ensure that the single
- * step will be for the instruction we have the probe on; if we don't,
- * it is possible we'd get the single step reported for CE.
- */
- regs->msr &= ~MSR_CE;
- mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
-#ifdef CONFIG_PPC_47x
- isync();
-#endif
-#endif
-
+ enable_single_step(regs);
/*
* On powerpc we should single step on the original
* instruction even if the probed insn is a trap
WARNING: multiple messages have this Message-ID (diff)
From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
To: bigeasy@linutronix.de, oleg@redhat.com, ananth@in.ibm.com,
srikar@linux.vnet.ibm.com
Cc: peterz@infradead.org, benh@kernel.crashing.org,
Kumar Gala <galak@kernel.crashing.org>,
linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
anton@redhat.com, mingo@elte.hu
Subject: [PATCH v2 2/4] powerpc: Move the single step enable code to a generic path
Date: Mon, 03 Dec 2012 20:38:37 +0530 [thread overview]
Message-ID: <20121203150754.7727.42629.stgit@suzukikp> (raw)
In-Reply-To: <20121203150438.7727.74924.stgit@suzukikp>
From: Suzuki K. Poulose <suzuki@in.ibm.com>
This patch moves the single step enable code used by kprobe to a generic
routine header so that, it can be re-used by other code, in this case,
uprobes. No functional changes.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Ananth N Mavinakaynahalli <ananth@in.ibm.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
arch/powerpc/include/asm/probes.h | 25 +++++++++++++++++++++++++
arch/powerpc/kernel/kprobes.c | 21 +--------------------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
index 5f1e15b..f94a44f 100644
--- a/arch/powerpc/include/asm/probes.h
+++ b/arch/powerpc/include/asm/probes.h
@@ -38,5 +38,30 @@ typedef u32 ppc_opcode_t;
#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
#endif /* CONFIG_PPC64 */
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+#define MSR_SINGLESTEP (MSR_DE)
+#else
+#define MSR_SINGLESTEP (MSR_SE)
+#endif
+
+/* Enable single stepping for the current task */
+static inline void enable_single_step(struct pt_regs *regs)
+{
+ regs->msr |= MSR_SINGLESTEP;
+#ifdef CONFIG_PPC_ADV_DEBUG_REGS
+ /*
+ * We turn off Critical Input Exception(CE) to ensure that the single
+ * step will be for the instruction we have the probe on; if we don't,
+ * it is possible we'd get the single step reported for CE.
+ */
+ regs->msr &= ~MSR_CE;
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
+#ifdef CONFIG_PPC_47x
+ isync();
+#endif
+#endif
+}
+
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_PROBES_H */
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 4901b34..92f1be7 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -36,12 +36,6 @@
#include <asm/sstep.h>
#include <asm/uaccess.h>
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
-#define MSR_SINGLESTEP (MSR_DE)
-#else
-#define MSR_SINGLESTEP (MSR_SE)
-#endif
-
DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
@@ -104,20 +98,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{
- regs->msr |= MSR_SINGLESTEP;
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- /*
- * We turn off Critical Input Exception(CE) to ensure that the single
- * step will be for the instruction we have the probe on; if we don't,
- * it is possible we'd get the single step reported for CE.
- */
- regs->msr &= ~MSR_CE;
- mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
-#ifdef CONFIG_PPC_47x
- isync();
-#endif
-#endif
-
+ enable_single_step(regs);
/*
* On powerpc we should single step on the original
* instruction even if the probed insn is a trap
next prev parent reply other threads:[~2012-12-03 15:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-03 15:07 [PATCH v2 0/4] uprobes/powerpc: Replace ptrace helpers for single stepping Suzuki K. Poulose
2012-12-03 15:07 ` [PATCH v2 1/4] kprobes/powerpc: Do not disable External interrupts during single step Suzuki K. Poulose
2012-12-03 15:07 ` Suzuki K. Poulose
2012-12-11 5:48 ` Suzuki K. Poulose
2012-12-11 5:48 ` Suzuki K. Poulose
2013-01-04 4:42 ` Benjamin Herrenschmidt
2013-01-04 4:42 ` Benjamin Herrenschmidt
2013-01-07 12:03 ` Sebastian Andrzej Siewior
2013-01-07 12:03 ` Sebastian Andrzej Siewior
2012-12-03 15:08 ` Suzuki K. Poulose [this message]
2012-12-03 15:08 ` [PATCH v2 2/4] powerpc: Move the single step enable code to a generic path Suzuki K. Poulose
2012-12-10 10:34 ` Ananth N Mavinakayanahalli
2012-12-10 10:34 ` Ananth N Mavinakayanahalli
2012-12-03 15:09 ` [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context Suzuki K. Poulose
2012-12-03 15:15 ` Ananth N Mavinakayanahalli
2012-12-03 15:48 ` Suzuki K. Poulose
2012-12-10 10:35 ` Ananth N Mavinakayanahalli
2012-12-03 15:10 ` [PATCH v2 4/4] uprobes/powerpc: Make use of generic routines to enable single step Suzuki K. Poulose
2012-12-10 10:35 ` Ananth N Mavinakayanahalli
2012-12-14 20:02 ` Oleg Nesterov
2012-12-18 5:11 ` Suzuki K. Poulose
2012-12-18 5:36 ` Ananth N Mavinakayanahalli
2012-12-18 19:10 ` Oleg Nesterov
2012-12-19 4:53 ` Ananth N Mavinakayanahalli
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=20121203150754.7727.42629.stgit@suzukikp \
--to=suzuki@in.ibm.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.