[FTRACE] Enabling function_graph causes OOPS

Sachin Sant sachinp at in.ibm.com
Wed Oct 7 19:56:36 EST 2009

Steven Rostedt wrote:
> On Tue, 2009-10-06 at 07:20 +1100, Benjamin Herrenschmidt wrote:
>> On Mon, 2009-10-05 at 09:25 -0400, Steven Rostedt wrote:
>>>>> Sachin, can you give me more details on how you built that kernel ? (or
>>>>> give them again in case I missed them the first time around :-), ie,
>>>>> what toolchain, options, etc... or even better, give me remote access to
>>>>> the build host ?
>>>> Ok, got access and had a quick look... seems to be a toolchain problem
>>>> to me. I'll investigate more tomorrow.
>>> Hi Ben,
>>> Any more word on this issue? 
>> Didn't you fix it using a TOC access ?
>> Unless I'm confusing things, I think the problem is the usage
>> of LOAD_REG_IMMEDIATE which generates relocs that we don't support
>> when CONFIG_RELOCATABLE is set.
>> I've merged a patch that post-processes the kernel now, to check
>> for such relocs so at least you should be warned at build time.
> I thought we had two issues. One was the use of the relocs that did
> cause issues. But then there was still crashes reported after that.
> IIRC. I'm still suffering jetlag, so my memory is not that fresh about
As Ben suggested, i changed LOAD_REG_IMMEDIATE() to LOAD_REG_ADDR()
as follows.

-       LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
+       LOAD_REG_ADDR(r4,ftrace_return_to_handler)

With this change compile time warnings about bad relocations
related to ftrace are gone.

Before the change :
WARNING: 6 bad relocations
c000000000008f1a R_PPC64_ADDR16_HIGHEST  __ksymtab+0x0000000000742110
c000000000008f1e R_PPC64_ADDR16_HIGHER  __ksymtab+0x0000000000742110
c000000000008f26 R_PPC64_ADDR16_HI  __ksymtab+0x0000000000742110
c000000000008f2a R_PPC64_ADDR16_LO  __ksymtab+0x0000000000742110
c00000000085e118 R_PPC64_ADDR64    __crc_per_cpu__softirq_work_list
c0000000008662d0 R_PPC64_ADDR64    __crc_simple_prepare_write

After the change :
WARNING: 2 bad relocations
c00000000085e118 R_PPC64_ADDR64    __crc_per_cpu__softirq_work_list
c0000000008662d0 R_PPC64_ADDR64    __crc_simple_prepare_write

But i still run into oops while using ftrace function_graph.



Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-ftrace-bad-relocs.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20091007/c2f0991f/attachment.bin>

More information about the Linuxppc-dev mailing list