* FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree
@ 2017-06-26 6:20 gregkh
2017-06-29 15:28 ` Naveen N. Rao
0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2017-06-26 6:20 UTC (permalink / raw)
To: naveen.n.rao, mpe; +Cc: stable
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From a4979a7e71eb8da976cbe4a0a1fa50636e76b04f Mon Sep 17 00:00:00 2001
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Thu, 1 Jun 2017 16:18:16 +0530
Subject: [PATCH] powerpc/ftrace: Pass the correct stack pointer for
DYNAMIC_FTRACE_WITH_REGS
For DYNAMIC_FTRACE_WITH_REGS, we should be passing-in the original set
of registers in pt_regs, to capture the state _before_ ftrace_caller.
However, we are instead passing the stack pointer *after* allocating a
stack frame in ftrace_caller. Fix this by saving the proper value of r1
in pt_regs. Also, use SAVE_10GPRS() to simplify the code.
Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
Cc: stable@vger.kernel.org # v4.6+
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
index 7c933a99f5d5..fa0921410fa4 100644
--- a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
+++ b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
@@ -45,10 +45,14 @@ _GLOBAL(ftrace_caller)
stdu r1,-SWITCH_FRAME_SIZE(r1)
/* Save all gprs to pt_regs */
- SAVE_8GPRS(0,r1)
- SAVE_8GPRS(8,r1)
- SAVE_8GPRS(16,r1)
- SAVE_8GPRS(24,r1)
+ SAVE_GPR(0, r1)
+ SAVE_10GPRS(2, r1)
+ SAVE_10GPRS(12, r1)
+ SAVE_10GPRS(22, r1)
+
+ /* Save previous stack pointer (r1) */
+ addi r8, r1, SWITCH_FRAME_SIZE
+ std r8, GPR1(r1)
/* Load special regs for save below */
mfmsr r8
@@ -103,10 +107,10 @@ ftrace_call:
#endif
/* Restore gprs */
- REST_8GPRS(0,r1)
- REST_8GPRS(8,r1)
- REST_8GPRS(16,r1)
- REST_8GPRS(24,r1)
+ REST_GPR(0,r1)
+ REST_10GPRS(2,r1)
+ REST_10GPRS(12,r1)
+ REST_10GPRS(22,r1)
/* Restore possibly modified LR */
ld r0, _LINK(r1)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree
2017-06-26 6:20 FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree gregkh
@ 2017-06-29 15:28 ` Naveen N. Rao
2017-08-20 18:51 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Naveen N. Rao @ 2017-06-29 15:28 UTC (permalink / raw)
To: gregkh, Michael Ellerman; +Cc: stable
On 2017/06/26 08:20AM, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 4.9-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
Michael, Greg,
Here is a version that applies on v4.9 and v4.11. These bits have been
moved under arch/powerpc/kernel/trace and as such needed adjustment to
apply to entry_64.S.
I couldn't test this as I get the below error trying to compile v4.9:
ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N
ld: final link failed: Bad value
Michael,
Can you please help test this?
Thanks,
Naveen
-
[PATCH] powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS
For DYNAMIC_FTRACE_WITH_REGS, we should be passing-in the original set
of registers in pt_regs, to capture the state _before_ ftrace_caller.
However, we are instead passing the stack pointer *after* allocating a
stack frame in ftrace_caller. Fix this by saving the proper value of r1
in pt_regs. Also, use SAVE_10GPRS() to simplify the code.
Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
Cc: stable@vger.kernel.org # v4.6+
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/entry_64.S | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 767ef6d68c9e..caa659671599 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -1235,10 +1235,14 @@ _GLOBAL(ftrace_caller)
stdu r1,-SWITCH_FRAME_SIZE(r1)
/* Save all gprs to pt_regs */
- SAVE_8GPRS(0,r1)
- SAVE_8GPRS(8,r1)
- SAVE_8GPRS(16,r1)
- SAVE_8GPRS(24,r1)
+ SAVE_GPR(0, r1)
+ SAVE_10GPRS(2, r1)
+ SAVE_10GPRS(12, r1)
+ SAVE_10GPRS(22, r1)
+
+ /* Save previous stack pointer (r1) */
+ addi r8, r1, SWITCH_FRAME_SIZE
+ std r8, GPR1(r1)
/* Load special regs for save below */
mfmsr r8
@@ -1292,10 +1296,10 @@ ftrace_call:
#endif
/* Restore gprs */
- REST_8GPRS(0,r1)
- REST_8GPRS(8,r1)
- REST_8GPRS(16,r1)
- REST_8GPRS(24,r1)
+ REST_GPR(0,r1)
+ REST_10GPRS(2,r1)
+ REST_10GPRS(12,r1)
+ REST_10GPRS(22,r1)
/* Restore callee's TOC */
ld r2, 24(r1)
--
2.13.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree
2017-06-29 15:28 ` Naveen N. Rao
@ 2017-08-20 18:51 ` Greg KH
2017-08-21 8:18 ` Michael Ellerman
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-08-20 18:51 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: Michael Ellerman, stable
On Thu, Jun 29, 2017 at 08:58:31PM +0530, Naveen N. Rao wrote:
> On 2017/06/26 08:20AM, gregkh@linuxfoundation.org wrote:
> >
> > The patch below does not apply to the 4.9-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
>
> Michael, Greg,
> Here is a version that applies on v4.9 and v4.11. These bits have been
> moved under arch/powerpc/kernel/trace and as such needed adjustment to
> apply to entry_64.S.
>
> I couldn't test this as I get the below error trying to compile v4.9:
> ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N
> ld: final link failed: Bad value
>
> Michael,
> Can you please help test this?
Given a lack of response, this is now deleted from my "to-apply" queue.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree
2017-08-20 18:51 ` Greg KH
@ 2017-08-21 8:18 ` Michael Ellerman
0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-08-21 8:18 UTC (permalink / raw)
To: Greg KH, Naveen N. Rao; +Cc: stable
Greg KH <gregkh@linuxfoundation.org> writes:
> On Thu, Jun 29, 2017 at 08:58:31PM +0530, Naveen N. Rao wrote:
>> On 2017/06/26 08:20AM, gregkh@linuxfoundation.org wrote:
>> >
>> > The patch below does not apply to the 4.9-stable tree.
>> > If someone wants it applied there, or to any other stable or longterm
>> > tree, then please email the backport, including the original git commit
>> > id to <stable@vger.kernel.org>.
>>
>> Michael, Greg,
>> Here is a version that applies on v4.9 and v4.11. These bits have been
>> moved under arch/powerpc/kernel/trace and as such needed adjustment to
>> apply to entry_64.S.
>>
>> I couldn't test this as I get the below error trying to compile v4.9:
>> ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N
>> ld: final link failed: Bad value
>>
>> Michael,
>> Can you please help test this?
>
>
> Given a lack of response, this is now deleted from my "to-apply" queue.
Yeah fair enough, lost in my inbox unfortunately.
The patch seems correct and boots for me.
Should we resend?
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-21 8:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 6:20 FAILED: patch "[PATCH] powerpc/ftrace: Pass the correct stack pointer for" failed to apply to 4.9-stable tree gregkh
2017-06-29 15:28 ` Naveen N. Rao
2017-08-20 18:51 ` Greg KH
2017-08-21 8:18 ` Michael Ellerman
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.