powerpc: Fix unpaired __trace_hcall_entry and __trace_hcall_exit
authorLi Zhong <zhong@linux.vnet.ibm.com>
Sat, 7 Jan 2012 17:54:52 +0000 (17:54 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Jan 2012 01:50:26 +0000 (12:50 +1100)
 Unpaired calling of __trace_hcall_entry and __trace_hcall_exit could
 cause incorrect preempt count. And it might happen as the global
 variable hcall_tracepoint_refcount is checked separately before calling
 them.

 Instead, store the value that was used on entry in the stack frame
 and retreive it from there after the call

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/hvCall.S

index fd05fdee576a8d13af9c1ce748754747478d56ec..3ce73d0052b17a2b2e934af3daf33499d0afd4ac 100644 (file)
@@ -36,6 +36,7 @@ BEGIN_FTR_SECTION;                                            \
        b       1f;                                             \
 END_FTR_SECTION(0, 1);                                         \
        ld      r12,hcall_tracepoint_refcount@toc(r2);          \
+       std     r12,32(r1);                                     \
        cmpdi   r12,0;                                          \
        beq+    1f;                                             \
        mflr    r0;                                             \
@@ -74,7 +75,7 @@ END_FTR_SECTION(0, 1);                                                \
 BEGIN_FTR_SECTION;                                             \
        b       1f;                                             \
 END_FTR_SECTION(0, 1);                                         \
-       ld      r12,hcall_tracepoint_refcount@toc(r2);          \
+       ld      r12,32(r1);                                     \
        cmpdi   r12,0;                                          \
        beq+    1f;                                             \
        mflr    r0;                                             \