possible asm syntax errors in spinlock.h

Olaf Hering olh at suse.de
Wed Jan 14 05:07:41 EST 2004


I got this crash several times on a p660 and p630:

Entering kdb (current=0xc000000177748c70, pid 12) on processor 5 due to KDB_ENTER()
[5]kdb> e
e = 0x000000000000000e
[5]kdb> excp
cpu 5: Vector: 300 (Data Access) at  [c000000177743ba0]
    pc: c000000000052198
    lr: c00000000005242c
    sp: c000000177743e20
   msr: a000000000001032
   dar: 280
 dsisr: 200000
  current = 0xc000000177748c70
  paca    = 0xc00000000044c000
  current = c000000177748c70, pid = 12, comm = migration/5
[5]kdb> bt
0xc000000177748c70 00000012 00000001  0  005  stop  0xc0000001777491a0*migration/5
          SP(esp)            PC(eip)      Function(args)
0xc000000177743e20  0xc000000000052198  .move_task_away +0x420
0xc000000177743ed0  0xc00000000005242c  .migration_thread +0x1d0
0xc000000177743f90  0xc000000000018938  .kernel_thread +0x4c
[5]kdb> rd
gpr0  = 0xc000000000444000 gpr1  = 0xc000000177743e20
gpr2  = 0xc00000000059edf0 gpr3  = 0xc000000008189560
gpr4  = 0x0000000000000000 gpr5  = 0x0000000000000000
gpr6  = 0x0000000024002042 gpr7  = 0x0000000000000000
gpr8  = 0x0000000000000000 gpr9  = 0x0000000000000000
gpr10 = 0xc000000007f4ef20 gpr11 = 0xc00000000059c010
gpr12 = 0x000000003ccbf700 gpr13 = 0xc00000000044c000
gpr14 = 0x0000000000000000 gpr15 = 0x0000000000000000
gpr16 = 0x0000000000000000 gpr17 = 0x0000000000000000
gpr18 = 0x0000000000000000 gpr19 = 0x0000000000000000
gpr20 = 0x0000000000230000 gpr21 = 0x00000000006b0000
gpr22 = 0x0000000000000000 gpr23 = 0x0000000000400000
gpr24 = 0xc0000000005a5ba0 gpr25 = 0xc0000000005a5ba0
gpr26 = 0xa000000000009032 gpr27 = 0xc000000007f501b8
gpr28 = 0xc000000008189560 gpr29 = 0xc000000007f26f20
gpr30 = 0xc0000000004df0a0 gpr31 = 0xc000000177743e20
nip   = 0xc000000000052198 msr   = 0xa000000000001032
esp   = 0xc000000177743e20 orig_gpr3 = 0x0000000000230000
ctr   = 0x0000000000000000 link  = 0xc00000000005242c
xer   = 0x0000000020000000 ccr   = 0x0000000084002042
mq    = 0x0000000000000000 trap  = 0x0000000000000300
dar   = 0x0000000000000280 dsisr = 0x0000000000200000
result = 0x0000000000000000 &regs = 0xc000000177743ba0
[5]kdb> id c000000000052190
0xc000000000052190 .move_task_away+0x418     cmpdi      r0,0
0xc000000000052194 .move_task_away+0x41c     beq        0xc0000000000521c4 .move_task_away+0x44c
0xc000000000052198 .move_task_away+0x420     lwz        r5,640(r0)
0xc00000000005219c .move_task_away+0x424     andi.      r11,r5,1
0xc0000000000521a0 .move_task_away+0x428     beq        0xc000000000052188 .move_task_away+0x410
0xc0000000000521a4 .move_task_away+0x42c     .long 0x7c2004ac
0xc0000000000521a8 .move_task_away+0x430     ldx        r11,r0,r10
0xc0000000000521ac .move_task_away+0x434     cmpd       r0,r11
0xc0000000000521b0 .move_task_away+0x438     bne        0xc000000000052188 .move_task_away+0x410
0xc0000000000521b4 .move_task_away+0x43c     li         r3,228
0xc0000000000521b8 .move_task_away+0x440     lhz        r4,24(r0)
0xc0000000000521bc .move_task_away+0x444     svca       8

0xc000000000052198 looks like a r5 = *0x280 according to dar.

This one might fix it, according to Segher.

Please review.


--- /dev/shm/linuxppc64-2.5/include/asm-ppc64/spinlock.h	2003-11-14 19:45:32.000000000 +0100
+++ ./include/asm-ppc64/spinlock.h	2004-01-13 19:03:32.000000000 +0100
@@ -47,7 +47,7 @@ static __inline__ int _raw_spin_trylock(
 	stdcx.		13,0,%1\n\
 	bne-		1b\n\
 	isync\n\
-2:"	: "=&r"(tmp)
+2:"	: "=&b"(tmp)
 	: "r"(&lock->lock)
 	: "cr0", "memory");

@@ -95,7 +95,7 @@ static __inline__ void _raw_spin_lock(sp
 	stdcx.		13,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&lock->lock)
 	: "r0", "r3", "r4", "r5", "ctr", "cr0", "cr1", "cr2", "cr3", "cr4",
 	  "xer", "memory");
@@ -133,7 +133,7 @@ static __inline__ void _raw_spin_lock(sp
 	stdcx.		13,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&lock->lock)
 	: "r3", "r4", "r5", "cr0", "cr1", "ctr", "xer", "memory");
 }
@@ -157,7 +157,7 @@ static __inline__ void _raw_spin_lock(sp
 	stdcx.		13,0,%1\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp)
+	: "=&b"(tmp)
 	: "r"(&lock->lock)
 	: "cr0", "memory");
 }
@@ -211,7 +211,7 @@ static __inline__ int _raw_read_trylock(
 	bne-		1b\n\
 	li		%1,1\n\
 	isync\n\
-2:"	: "=&r"(tmp), "=&r"(ret)
+2:"	: "=&b"(tmp), "=&b"(ret)
 	: "r"(&rw->lock)
 	: "cr0", "memory");

@@ -253,7 +253,7 @@ static __inline__ void _raw_read_lock(rw
 	stdcx.		%0,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&rw->lock)
 	: "r0", "r3", "r4", "r5", "ctr", "cr0", "cr1", "cr2", "cr3", "cr4",
 	  "xer", "memory");
@@ -290,7 +290,7 @@ static __inline__ void _raw_read_lock(rw
 	stdcx.		%0,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&rw->lock)
 	: "r3", "r4", "r5", "cr0", "cr1", "ctr", "xer", "memory");
 }
@@ -314,7 +314,7 @@ static __inline__ void _raw_read_lock(rw
 	stdcx.		%0,0,%1\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp)
+	: "=&b"(tmp)
 	: "r"(&rw->lock)
 	: "cr0", "memory");
 }
@@ -331,7 +331,7 @@ static __inline__ void _raw_read_unlock(
 	addic		%0,%0,-1\n\
 	stdcx.		%0,0,%1\n\
 	bne-		1b"
-	: "=&r"(tmp)
+	: "=&b"(tmp)
 	: "r"(&rw->lock)
 	: "cr0", "memory");
 }
@@ -350,7 +350,7 @@ static __inline__ int _raw_write_trylock
 	bne-		1b\n\
 	li		%1,1\n\
 	isync\n\
-2:"	: "=&r"(tmp), "=&r"(ret)
+2:"	: "=&b"(tmp), "=&b"(ret)
 	: "r"(&rw->lock), "r"(-1)
 	: "cr0", "memory");

@@ -393,7 +393,7 @@ static __inline__ void _raw_write_lock(r
 	stdcx.		13,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&rw->lock)
 	: "r0", "r3", "r4", "r5", "ctr", "cr0", "cr1", "cr2", "cr3", "cr4",
 	  "xer", "memory");
@@ -433,7 +433,7 @@ static __inline__ void _raw_write_lock(r
 	stdcx.		13,0,%2\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp), "=&r"(tmp2)
+	: "=&b"(tmp), "=&b"(tmp2)
 	: "r"(&rw->lock)
 	: "r3", "r4", "r5", "cr0", "cr1", "ctr", "xer", "memory");
 }
@@ -457,7 +457,7 @@ static __inline__ void _raw_write_lock(r
 	stdcx.		13,0,%1\n\
 	bne-		2b\n\
 	isync"
-	: "=&r"(tmp)
+	: "=&b"(tmp)
 	: "r"(&rw->lock)
 	: "cr0", "memory");
 }

--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list