From owner-svn-src-all@FreeBSD.ORG Sat Feb 20 18:17:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1645C106566B; Sat, 20 Feb 2010 18:17:34 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id AC9EB8FC12; Sat, 20 Feb 2010 18:17:33 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id BFA46C427C; Sat, 20 Feb 2010 19:19:20 +0100 (CET) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id 1iqBt1yw8rtE; Sat, 20 Feb 2010 19:19:20 +0100 (CET) Received: from [192.168.133.14] (nat3-102.ghnet.pl [91.150.222.102]) by smtp.semihalf.com (Postfix) with ESMTPSA id 1EBF2C427A; Sat, 20 Feb 2010 19:19:20 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Rafal Jaworowski In-Reply-To: <201002201613.o1KGDiiK053065@svn.freebsd.org> Date: Sat, 20 Feb 2010 19:17:20 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201002201613.o1KGDiiK053065@svn.freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1077) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r204126 - head/sys/powerpc/booke X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2010 18:17:34 -0000 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