linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>
Cc: Jordan Niethe <jniethe5@gmail.com>,
	linuxppc-dev@lists.ozlabs.org,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH 4/5] powerpc/kprobes: Setup consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE
Date: Thu, 20 Oct 2022 22:59:00 +0530	[thread overview]
Message-ID: <1d0cb183f48c4179646c0c5e183fd296da58f4ca.1666262278.git.naveen.n.rao@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1666262278.git.naveen.n.rao@linux.vnet.ibm.com>

Ensure a more consistent pt_regs across kprobes, optprobes and
KPROBES_ON_FTRACE:
- Drop setting trap to 0x700 under optprobes. This is not accurate and
  is unnecessary. Instead, zero it out for both optprobes and
  KPROBES_ON_FTRACE.
- Save irq soft mask in the ftrace handler, similar to what we do in
  optprobes and trap-based kprobes.
- Drop setting orig_gpr3 and result to zero in optprobes. These are not
  relevant under kprobes and should not be used by the handlers.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/optprobes_head.S        | 5 +----
 arch/powerpc/kernel/trace/ftrace_mprofile.S | 6 ++++++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/optprobes_head.S b/arch/powerpc/kernel/optprobes_head.S
index cd4e7bc32609d3..06df09b4e8b155 100644
--- a/arch/powerpc/kernel/optprobes_head.S
+++ b/arch/powerpc/kernel/optprobes_head.S
@@ -49,11 +49,8 @@ optprobe_template_entry:
 	/* Save SPRS */
 	mfmsr	r5
 	PPC_STL	r5,_MSR(r1)
-	li	r5,0x700
-	PPC_STL	r5,_TRAP(r1)
 	li	r5,0
-	PPC_STL	r5,ORIG_GPR3(r1)
-	PPC_STL	r5,RESULT(r1)
+	PPC_STL	r5,_TRAP(r1)
 	mfctr	r5
 	PPC_STL	r5,_CTR(r1)
 	mflr	r5
diff --git a/arch/powerpc/kernel/trace/ftrace_mprofile.S b/arch/powerpc/kernel/trace/ftrace_mprofile.S
index d031093bc43671..f82004089426e6 100644
--- a/arch/powerpc/kernel/trace/ftrace_mprofile.S
+++ b/arch/powerpc/kernel/trace/ftrace_mprofile.S
@@ -107,6 +107,12 @@
 	PPC_STL	r9, _CTR(r1)
 	PPC_STL	r10, _XER(r1)
 	PPC_STL	r11, _CCR(r1)
+#ifdef CONFIG_PPC64
+	lbz     r7, PACAIRQSOFTMASK(r13)
+	std     r7, SOFTE(r1)
+#endif
+	li	r8, 0
+	PPC_STL	r8, _TRAP(r1)
 	.endif
 
 	/* Load &pt_regs in r6 for call below */
-- 
2.38.0


  parent reply	other threads:[~2022-10-20 17:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 17:28 [PATCH 0/5] powerpc/kprobes: preempt related changes and cleanups Naveen N. Rao
2022-10-20 17:28 ` [PATCH 1/5] powerpc/kprobes: Remove preempt disable around call to get_kprobe() in arch_prepare_kprobe() Naveen N. Rao
2022-11-07 10:14   ` Nicholas Piggin
2022-11-08 10:33     ` Naveen N. Rao
2022-10-20 17:28 ` [PATCH 2/5] powerpc/kprobes: Have optimized_callback() use preempt_enable() Naveen N. Rao
2022-11-07 10:18   ` Nicholas Piggin
2022-10-20 17:28 ` [PATCH 3/5] powerpc/kprobes: Use preempt_enable() rather than the no_resched variant Naveen N. Rao
2022-11-07 10:29   ` Nicholas Piggin
2022-10-20 17:29 ` Naveen N. Rao [this message]
2022-11-07 11:15   ` [PATCH 4/5] powerpc/kprobes: Setup consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE Nicholas Piggin
2022-11-08 10:52     ` Naveen N. Rao
2022-10-20 17:29 ` [PATCH 5/5] powerpc/kprobes: Remove unnecessary headers from kprobes Naveen N. Rao
2022-11-02  8:36   ` Christophe Leroy
2022-11-08 10:06     ` Naveen N. Rao
2022-11-07 11:24 ` [PATCH 0/5] powerpc/kprobes: preempt related changes and cleanups Nicholas Piggin
2022-11-30  9:24 ` (subset) " Michael Ellerman

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=1d0cb183f48c4179646c0c5e183fd296da58f4ca.1666262278.git.naveen.n.rao@linux.vnet.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhiramat@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.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 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).