From owner-svn-src-all@FreeBSD.ORG Mon Dec 1 17:40:57 2008 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 CBA121065670; Mon, 1 Dec 2008 17:40:57 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BC288FC29; Mon, 1 Dec 2008 17:40:57 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1Hevlj032335; Mon, 1 Dec 2008 17:40:57 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1Hev1f032334; Mon, 1 Dec 2008 17:40:57 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200812011740.mB1Hev1f032334@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 1 Dec 2008 17:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185526 - in stable/7/sys: . ia64/include 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: Mon, 01 Dec 2008 17:40:58 -0000 Author: marcel Date: Mon Dec 1 17:40:57 2008 New Revision: 185526 URL: http://svn.freebsd.org/changeset/base/185526 Log: MFC rev 179382: Work-around a compiler optimization bug, that broke libthr. Massive inlining resulted in constant propagation to the extend that cmpval was known to the compiler to be URWLOCK_WRITE_OWNER (= 0x80000000U). Unfortunately, instead of zero-extending the unsigned constant, it was sign-extended. As such, the cmpxchg instruction was comparing 0x0000000080000000LU to 0xffffffff80000000LU and obviously didn't perform the exchange. But, since the value returned by cmpxhg equalled cmpval (when zero- extended), the _thr_rtld_lock_release() function thought the exchange did happen and as such returned as if having released the lock. This was not the case. Subsequent locking requests found rw_state non-zero and the thread in question entered the kernel and block indefinitely. The work-around is to zero-extend by casting to uint64_t. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/ia64/include/atomic.h Modified: stable/7/sys/ia64/include/atomic.h ============================================================================== --- stable/7/sys/ia64/include/atomic.h Mon Dec 1 17:39:34 2008 (r185525) +++ stable/7/sys/ia64/include/atomic.h Mon Dec 1 17:40:57 2008 (r185526) @@ -42,7 +42,7 @@ "mov ar.ccv=%2;;\n\t" \ "cmpxchg" #sz "." #sem " %0=%4,%3,ar.ccv\n\t" \ : "=r" (ret), "=m" (*p) \ - : "r" (cmpval), "r" (newval), "m" (*p) \ + : "r" ((uint64_t)cmpval), "r" (newval), "m" (*p) \ : "memory") /*