Patchwork Ftrace : fix function_graph tracer OOPS

login
register
mail settings
Submitter Sachin P. Sant
Date Oct. 8, 2009, 2:51 p.m.
Message ID <4ACDFC83.4080205@in.ibm.com>
Download mbox | patch
Permalink /patch/35452/
State Superseded
Headers show

Comments

Sachin P. Sant - Oct. 8, 2009, 2:51 p.m.
Enabling function graph causes oops due to usage of LOAD_REG_IMMEDIATE().
As explained by Ben the usage of LOAD_REG_IMMEDIATE generates relocs that are
not supported when CONFIG_RELOCATABLE is set.

Switch to LOAD_REG_ADDR().

Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
---
Steven Rostedt - Oct. 14, 2009, 3:01 a.m.
On Thu, 2009-10-08 at 20:21 +0530, Sachin Sant wrote:
> Switch to LOAD_REG_ADDR().
> 
> Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
> ---
> diff -Naurp old/arch/powerpc/kernel/entry_64.S
> new/arch/powerpc/kernel/entry_64.S
> --- old/arch/powerpc/kernel/entry_64.S  2009-10-08 18:37:44.000000000
> +0530
> +++ new/arch/powerpc/kernel/entry_64.S  2009-10-08 18:34:33.000000000
> +0530
> @@ -1038,8 +1038,8 @@ _GLOBAL(mod_return_to_handler)
>          * We are in a module using the module's TOC.
>          * Switch to our TOC to run inside the core kernel.
>          */
> -       LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
> -       ld      r2, 8(r4)
> +       ld      r2, PACATOC(r13)
> +       LOAD_REG_ADDR(r4,ftrace_return_to_handler)

Actually, the loading of this register is not needed. The original used
the loading to get the r2.

I actually wrote a fix for this a month ago. I never sent it out because
I was distracted by other issues.

I'll send out the two patches I had now.

Could yo test them?

Thanks!

-- Steve

>  
>         bl      .ftrace_return_to_handler
>         nop
>
Sachin P. Sant - Oct. 14, 2009, 6:13 a.m.
Steven Rostedt wrote:
> On Thu, 2009-10-08 at 20:21 +0530, Sachin Sant wrote:
>   
>> Switch to LOAD_REG_ADDR().
>>
>> Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
>> ---
>> diff -Naurp old/arch/powerpc/kernel/entry_64.S
>> new/arch/powerpc/kernel/entry_64.S
>> --- old/arch/powerpc/kernel/entry_64.S  2009-10-08 18:37:44.000000000
>> +0530
>> +++ new/arch/powerpc/kernel/entry_64.S  2009-10-08 18:34:33.000000000
>> +0530
>> @@ -1038,8 +1038,8 @@ _GLOBAL(mod_return_to_handler)
>>          * We are in a module using the module's TOC.
>>          * Switch to our TOC to run inside the core kernel.
>>          */
>> -       LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
>> -       ld      r2, 8(r4)
>> +       ld      r2, PACATOC(r13)
>> +       LOAD_REG_ADDR(r4,ftrace_return_to_handler)
>>     
>
> Actually, the loading of this register is not needed. The original used
> the loading to get the r2.
>
> I actually wrote a fix for this a month ago. I never sent it out because
> I was distracted by other issues.
>
> I'll send out the two patches I had now.
>
> Could yo test them?
>   
Tested both the patches. Works fine.

Thanks
-Sachin
Benjamin Herrenschmidt - Oct. 14, 2009, 6:15 a.m.
On Wed, 2009-10-14 at 11:43 +0530, Sachin Sant wrote:

> Tested both the patches. Works fine.

Thanks !

Stephen, you merge these yourself or you need me to pick them up in
-powerpc ?

Cheers,
Ben.
Steven Rostedt - Oct. 14, 2009, 12:12 p.m.
On Wed, 2009-10-14 at 17:15 +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2009-10-14 at 11:43 +0530, Sachin Sant wrote:
> 
> > Tested both the patches. Works fine.
> 
> Thanks !
> 
> Stephen, you merge these yourself or you need me to pick them up in
> -powerpc ?
> 

Ben,

You can either pull from my repo (I synced with latest Linus), or you
can just suck in the patches. I can also resync with your repo if you
prefer.

Either way is fine with me. Just let me know which you did.

-- Steve

Patch

Enabling function graph causes oops due to usage of LOAD_REG_IMMEDIATE().
As explained by Ben the usage of LOAD_REG_IMMEDIATE generates relocs that are
not supported when CONFIG_RELOCATABLE is set. 

Switch to LOAD_REG_ADDR().

Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
---
diff -Naurp old/arch/powerpc/kernel/entry_64.S new/arch/powerpc/kernel/entry_64.S
--- old/arch/powerpc/kernel/entry_64.S	2009-10-08 18:37:44.000000000 +0530
+++ new/arch/powerpc/kernel/entry_64.S	2009-10-08 18:34:33.000000000 +0530
@@ -1038,8 +1038,8 @@  _GLOBAL(mod_return_to_handler)
 	 * We are in a module using the module's TOC.
 	 * Switch to our TOC to run inside the core kernel.
 	 */
-	LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
-	ld	r2, 8(r4)
+	ld	r2, PACATOC(r13)
+	LOAD_REG_ADDR(r4,ftrace_return_to_handler)
 
 	bl	.ftrace_return_to_handler
 	nop