Hello,

It appears that I have forgotten to post a patch for this bug. This was a problem I had seen when booting the latest 2.6.28-rc6 kernel, where kernel function tracing was causing r4 to be corrupted because the perfmon code was called in the wrong order (pretty obscure bug!).

To elabortate just a little, this is assembler code where do_signal is called with two register parameters - r3 and r4. r4 is set up several lines before the call to do_signal and is easy to miss. The call to the perfmon function, pfm_handle_work, doesn't have a second parameter, but if in the process of calling pfm_handle_work, r4 changes (perhaps because it calls a function with 2 or more register parameters), when the subseqent call to do_signal is made, r4 will be corrupted. With kernel tracing turned on, r4 was getting touched in the process of calling pfm_handle_work, causing do_signal to cause the system to hang.

In order to fix this, the simplest thing to do was to reverse the order of the two calls so that no saving of r4 was needed. pfm_handle_work is now called after do_signal, eliminating any possibility for corruption of parameter registers.


Please let me know if there are any issues with this patch.

Regards,

- Corey

Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
Beaverton, OR
503-578-3507
cjash...@us.ibm.com
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index a6478a9..a50668e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -654,12 +654,12 @@ user_work:
        b       .ret_from_except_lite
 
 1:     bl      .save_nvgprs
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       bl      .do_signal
 #ifdef CONFIG_PERFMON
        addi    r3,r1,STACK_FRAME_OVERHEAD
        bl      .pfm_handle_work
 #endif /* CONFIG_PERFMON */
-       addi    r3,r1,STACK_FRAME_OVERHEAD
-       bl      .do_signal
        b       .ret_from_except
 
 unrecov_restore:
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to