Date: Sat, 20 Feb 2010 19:17:20 +0100 From: Rafal Jaworowski <raj@semihalf.com> To: Nathan Whitehorn <nwhitehorn@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r204126 - head/sys/powerpc/booke Message-ID: <BA32954C-41CF-4187-8633-C4A8DCBC4561@semihalf.com> In-Reply-To: <201002201613.o1KGDiiK053065@svn.freebsd.org> References: <201002201613.o1KGDiiK053065@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2010-02-20, at 17:13, Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sat Feb 20 16:13:43 2010 > New Revision: 204126 > URL: http://svn.freebsd.org/changeset/base/204126 >=20 > Log: > Merge r198724 to Book-E. casuword() non-atomically read the current = value > of its argument before atomically replacing it, which could = occasionally > return the wrong value on an SMP system. This resulted in user mutex > operations hanging when using threaded applications. Have you got a particular test case when this was breaking, so I can = test? > Modified: > head/sys/powerpc/booke/copyinout.c >=20 > Modified: head/sys/powerpc/booke/copyinout.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:12:37 2010 = (r204125) > +++ head/sys/powerpc/booke/copyinout.c Sat Feb 20 16:13:43 2010 = (r204126) > @@ -295,8 +295,19 @@ casuword(volatile u_long *addr, u_long o > return (EFAULT); > } >=20 > - val =3D *addr; > - (void) atomic_cmpset_32((volatile uint32_t *)addr, old, new); > + __asm __volatile ( > + "1:\tlwarx %0, 0, %2\n\t" /* load old value */ > + "cmplw %3, %0\n\t" /* compare */ > + "bne 2f\n\t" /* exit if not equal */ > + "stwcx. %4, 0, %2\n\t" /* attempt to store */ > + "bne- 1b\n\t" /* spin if failed */ > + "b 3f\n\t" /* we've succeeded */ > + "2:\n\t" > + "stwcx. %0, 0, %2\n\t" /* clear reservation = (74xx) */ The 74xx comment reference is somewhat confusing as the clear = reservation operation is pretty uniform accross 32-bit PowerPC I guess, = and not 74xx specific. Rafal
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA32954C-41CF-4187-8633-C4A8DCBC4561>