Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc in cpu_switchto() and the fast-soft...



details:   https://anonhg.NetBSD.org/src/rev/d094dc8a8fa8
branches:  trunk
changeset: 351831:d094dc8a8fa8
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Feb 28 17:35:29 2017 +0000

description:
in cpu_switchto() and the fast-softint context switch code,
put back the stwcx. instruction to clear the reservation.
we used to have this in the old cpu_switch() until it was
if-0'd in 2003 and removed completely in 2007.
this fixes hangs I've seen where a softint thread is
blocked waiting for a mutex that is not held.
this should also fix PR 44387.

diffstat:

 sys/arch/powerpc/powerpc/locore_subr.S |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (33 lines):

diff -r f397809049cf -r d094dc8a8fa8 sys/arch/powerpc/powerpc/locore_subr.S
--- a/sys/arch/powerpc/powerpc/locore_subr.S    Tue Feb 28 15:00:32 2017 +0000
+++ b/sys/arch/powerpc/powerpc/locore_subr.S    Tue Feb 28 17:35:29 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore_subr.S,v 1.54 2014/07/30 23:27:55 matt Exp $    */
+/*     $NetBSD: locore_subr.S,v 1.55 2017/02/28 17:35:29 chs Exp $     */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -288,6 +288,7 @@
  */
        ldreg   %r31,CFRAME_R31(%r1)    /* restore saved registers */
        ldreg   %r30,CFRAME_R30(%r1)
+       stwcx.  %r1,0,%r1               /* clear reservation */
 #if 1
        addi    %r1,%r1,CALLFRAMELEN
 #else
@@ -328,6 +329,7 @@
        mtmsr   %r0
        isync
 #endif
+       stwcx.  %r1,0,%r1               /* clear reservation */
        addi    %r1, %r1, CALLFRAMELEN
        ldreg   %r0, CFRAME_LR(%r1)
        mtlr    %r0
@@ -478,6 +480,7 @@
        ldreg   %r29,SFRAME_R29(%r1)    /* R29 */
        ldreg   %r31,SFRAMELEN+CFRAME_R31(%r1)  /* restore saved registers */
        ldreg   %r30,SFRAMELEN+CFRAME_R30(%r1)
+       stwcx.  %r1,0,%r1               /* clear reservation */
        addi    %r1,%r1,SFRAMELEN+2*CALLFRAMELEN /* remove switch & callframes */
 #endif
        ldreg   %r0,CFRAME_LR(%r1)



Home | Main Index | Thread Index | Old Index