Re: [RFC PATCH 1/1] powerpc/ftrace: Exclude real mode code from
From: Naveen N. Rao <hidden>
Date: 2018-03-07 18:37:18
Hi Steve, Steven Rostedt wrote:
On Wed, 7 Mar 2018 22:16:19 +0530 "Naveen N. Rao" [off-list ref] wrote: =20quoted
We can't take a trap in most parts of real mode code. Instead of adding the 'notrace' annotation to all C functions that can be invoked from real mode, detect that we are in real mode on ftrace entry and return back. =20 Signed-off-by: Naveen N. Rao <redacted> --- This RFC only handles -mprofile-kernel to demonstrate the approach being=
=20
quoted
considered. We will need to handle other ftrace entry if we decide to=20 continue down this path.=20 I do prefer this trade off.
Great, thanks!
=20 =20quoted
diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/power=
pc/kernel/trace/ftrace_64_mprofile.S
quoted
index 3f3e81852422..ecc0e8e38ead 100644--- a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S +++ b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S@@ -56,6 +56,21 @@ _GLOBAL(ftrace_caller)=20 /* Load special regs for save below */ mfmsr r8 + + /* Only proceed if we are not in real mode and can take interrupts */ + andi. r9, r8, MSR_IR|MSR_DR|MSR_RI + cmpdi r9, MSR_IR|MSR_DR|MSR_RI + beq 1f=20 OK, I assume this check and branch is negligible compared to the mfmsr call?
Yes, that's negligible. Though, to be honest, I will have to introduce a 'mfmsr' for the older=20 -pg variant. I still think that the improved reliability far outweighs=20 the minor slowdown there. - Naveen =