Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-10 Thread Ananth N Mavinakayanahalli
On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:
> From: Suzuki K. Poulose 
> 
> Introduce routines for saving and restoring the context
> befre/after the single step. No functional changes involved.
> 
> These will be extended later to save/restore more info about
> the process once we replace the ptrace helpers.
> 
> Signed-off-by: Suzuki K. Poulose 

Acked-by: Ananth N Mavinakayanahalli 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-10 Thread Ananth N Mavinakayanahalli
On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:
 From: Suzuki K. Poulose suz...@in.ibm.com
 
 Introduce routines for saving and restoring the context
 befre/after the single step. No functional changes involved.
 
 These will be extended later to save/restore more info about
 the process once we replace the ptrace helpers.
 
 Signed-off-by: Suzuki K. Poulose suz...@in.ibm.com

Acked-by: Ananth N Mavinakayanahalli ana...@in.ibm.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Suzuki K. Poulose

On 12/03/2012 08:45 PM, Ananth N Mavinakayanahalli wrote:

On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:

From: Suzuki K. Poulose 

Introduce routines for saving and restoring the context
befre/after the single step. No functional changes involved.

These will be extended later to save/restore more info about
the process once we replace the ptrace helpers.

Signed-off-by: Suzuki K. Poulose 
---
  arch/powerpc/kernel/uprobes.c |   16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834..1a62353 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
return 0;
  }

+static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
+{
+   autask->saved_trap_nr = current->thread.trap_nr;
+}
+
+static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
+{
+   current->thread.trap_nr = autask->saved_trap_nr;
+}


Can't the two above be inline?

I had this discussion with Srikar and he was of the opinion that, we
should leave it as just static and let the compiler do the optimization.


Thanks
Suzuki

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Ananth N Mavinakayanahalli
On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:
> From: Suzuki K. Poulose 
> 
> Introduce routines for saving and restoring the context
> befre/after the single step. No functional changes involved.
> 
> These will be extended later to save/restore more info about
> the process once we replace the ptrace helpers.
> 
> Signed-off-by: Suzuki K. Poulose 
> ---
>  arch/powerpc/kernel/uprobes.c |   16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
> index bc77834..1a62353 100644
> --- a/arch/powerpc/kernel/uprobes.c
> +++ b/arch/powerpc/kernel/uprobes.c
> @@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
>   return 0;
>  }
> 
> +static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
> +{
> + autask->saved_trap_nr = current->thread.trap_nr;
> +}
> +
> +static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
> +{
> + current->thread.trap_nr = autask->saved_trap_nr;
> +}

Can't the two above be inline?

Ananth

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Suzuki K. Poulose
From: Suzuki K. Poulose 

Introduce routines for saving and restoring the context
befre/after the single step. No functional changes involved.

These will be extended later to save/restore more info about
the process once we replace the ptrace helpers.

Signed-off-by: Suzuki K. Poulose 
---
 arch/powerpc/kernel/uprobes.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834..1a62353 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
return 0;
 }
 
+static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
+{
+   autask->saved_trap_nr = current->thread.trap_nr;
+}
+
+static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
+{
+   current->thread.trap_nr = autask->saved_trap_nr;
+}
+
 /*
  * arch_uprobe_pre_xol - prepare to execute out of line.
  * @auprobe: the probepoint information.
@@ -61,7 +71,7 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct 
pt_regs *regs)
 {
struct arch_uprobe_task *autask = >utask->autask;
 
-   autask->saved_trap_nr = current->thread.trap_nr;
+   uprobe_save_context_sstep(autask);
current->thread.trap_nr = UPROBE_TRAP_NR;
regs->nip = current->utask->xol_vaddr;
 
@@ -111,7 +121,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, 
struct pt_regs *regs)
 
WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR);
 
-   current->thread.trap_nr = utask->autask.saved_trap_nr;
+   uprobe_restore_context_sstep(>autask);
 
/*
 * On powerpc, except for loads and stores, most instructions
@@ -164,7 +174,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, 
struct pt_regs *regs)
 {
struct uprobe_task *utask = current->utask;
 
-   current->thread.trap_nr = utask->autask.saved_trap_nr;
+   uprobe_restore_context_sstep(>autask);
instruction_pointer_set(regs, utask->vaddr);
 
user_disable_single_step(current);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Suzuki K. Poulose
From: Suzuki K. Poulose suz...@in.ibm.com

Introduce routines for saving and restoring the context
befre/after the single step. No functional changes involved.

These will be extended later to save/restore more info about
the process once we replace the ptrace helpers.

Signed-off-by: Suzuki K. Poulose suz...@in.ibm.com
---
 arch/powerpc/kernel/uprobes.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834..1a62353 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
return 0;
 }
 
+static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
+{
+   autask-saved_trap_nr = current-thread.trap_nr;
+}
+
+static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
+{
+   current-thread.trap_nr = autask-saved_trap_nr;
+}
+
 /*
  * arch_uprobe_pre_xol - prepare to execute out of line.
  * @auprobe: the probepoint information.
@@ -61,7 +71,7 @@ int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct 
pt_regs *regs)
 {
struct arch_uprobe_task *autask = current-utask-autask;
 
-   autask-saved_trap_nr = current-thread.trap_nr;
+   uprobe_save_context_sstep(autask);
current-thread.trap_nr = UPROBE_TRAP_NR;
regs-nip = current-utask-xol_vaddr;
 
@@ -111,7 +121,7 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, 
struct pt_regs *regs)
 
WARN_ON_ONCE(current-thread.trap_nr != UPROBE_TRAP_NR);
 
-   current-thread.trap_nr = utask-autask.saved_trap_nr;
+   uprobe_restore_context_sstep(utask-autask);
 
/*
 * On powerpc, except for loads and stores, most instructions
@@ -164,7 +174,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, 
struct pt_regs *regs)
 {
struct uprobe_task *utask = current-utask;
 
-   current-thread.trap_nr = utask-autask.saved_trap_nr;
+   uprobe_restore_context_sstep(utask-autask);
instruction_pointer_set(regs, utask-vaddr);
 
user_disable_single_step(current);

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Ananth N Mavinakayanahalli
On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:
 From: Suzuki K. Poulose suz...@in.ibm.com
 
 Introduce routines for saving and restoring the context
 befre/after the single step. No functional changes involved.
 
 These will be extended later to save/restore more info about
 the process once we replace the ptrace helpers.
 
 Signed-off-by: Suzuki K. Poulose suz...@in.ibm.com
 ---
  arch/powerpc/kernel/uprobes.c |   16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)
 
 diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
 index bc77834..1a62353 100644
 --- a/arch/powerpc/kernel/uprobes.c
 +++ b/arch/powerpc/kernel/uprobes.c
 @@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
   return 0;
  }
 
 +static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
 +{
 + autask-saved_trap_nr = current-thread.trap_nr;
 +}
 +
 +static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
 +{
 + current-thread.trap_nr = autask-saved_trap_nr;
 +}

Can't the two above be inline?

Ananth

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 3/4] uprobes/powerpc: Introduce routines for save/restore context

2012-12-03 Thread Suzuki K. Poulose

On 12/03/2012 08:45 PM, Ananth N Mavinakayanahalli wrote:

On Mon, Dec 03, 2012 at 08:39:35PM +0530, Suzuki K. Poulose wrote:

From: Suzuki K. Poulose suz...@in.ibm.com

Introduce routines for saving and restoring the context
befre/after the single step. No functional changes involved.

These will be extended later to save/restore more info about
the process once we replace the ptrace helpers.

Signed-off-by: Suzuki K. Poulose suz...@in.ibm.com
---
  arch/powerpc/kernel/uprobes.c |   16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834..1a62353 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -52,6 +52,16 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
return 0;
  }

+static void uprobe_save_context_sstep(struct arch_uprobe_task *autask)
+{
+   autask-saved_trap_nr = current-thread.trap_nr;
+}
+
+static void uprobe_restore_context_sstep(struct arch_uprobe_task *autask)
+{
+   current-thread.trap_nr = autask-saved_trap_nr;
+}


Can't the two above be inline?

I had this discussion with Srikar and he was of the opinion that, we
should leave it as just static and let the compiler do the optimization.


Thanks
Suzuki

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/