From owner-freebsd-current@FreeBSD.ORG Fri Jul 29 02:36:16 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDDB716A41F; Fri, 29 Jul 2005 02:36:15 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D47343D45; Fri, 29 Jul 2005 02:36:15 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from c-66-30-114-143.hsd1.ma.comcast.net ([66.30.114.143]) by comcast.net (rwcrmhc11) with ESMTP id <20050729023609013004bnmre>; Fri, 29 Jul 2005 02:36:09 +0000 Received: from c-66-30-114-143.hsd1.ma.comcast.net (localhost.127.in-addr.arpa [127.0.0.1]) by c-66-30-114-143.hsd1.ma.comcast.net (8.13.4/8.13.1) with ESMTP id j6T2a93i014323; Thu, 28 Jul 2005 22:36:09 -0400 (EDT) (envelope-from rodrigc@c-66-30-114-143.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-30-114-143.hsd1.ma.comcast.net (8.13.4/8.13.1/Submit) id j6T2a9RW014322; Thu, 28 Jul 2005 22:36:09 -0400 (EDT) (envelope-from rodrigc) Date: Thu, 28 Jul 2005 22:36:08 -0400 From: Craig Rodrigues To: Giorgos Keramidas Message-ID: <20050729023608.GA14084@crodrigues.org> References: <20050728213839.GA46119@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050728213839.GA46119@gothmog.gr> User-Agent: Mutt/1.5.9i Cc: deischen@freebsd.org, freebsd-current@freebsd.org, davidxu@freebsd.org Subject: Re: libthr & atomic_xxx ops X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2005 02:36:16 -0000 On Fri, Jul 29, 2005 at 12:38:39AM +0300, Giorgos Keramidas wrote: > Recently, libpthread and libthr grew the following warnings in > CURRENT: > > # 2005-07-28 04:37:43.704726 - /usr/src/lib/libpthread/sys/lock.c:183: warning: passing arg 1 of `atomic_store_rel_int' from incompatible pointer type This is similar to what I posted for sched_ule.c due to changes to the macros in : http://lists.freebsd.org/pipermail/freebsd-current/2005-July/052894.html Can you try this patch, and see if the warnings go away? --- lib/libthr/thread/thr_umtx.h.orig Thu Jul 28 21:10:15 2005 +++ lib/libthr/thread/thr_umtx.h Thu Jul 28 21:13:52 2005 @@ -53,7 +53,7 @@ static inline int _thr_umtx_lock(volatile umtx_t *mtx, long id) { - if (atomic_cmpset_acq_ptr(mtx, (void *)UMTX_UNOWNED, (void *)id)) + if (atomic_cmpset_acq_ptr((volatile uintptr_t *)mtx, (uintptr_t)UMTX_UNOWNED, (uintptr_t)id)) return (0); return __thr_umtx_lock(mtx, id); } @@ -62,7 +62,7 @@ _thr_umtx_timedlock(volatile umtx_t *mtx, long id, const struct timespec *timeout) { - if (atomic_cmpset_acq_ptr(mtx, (void *)UMTX_UNOWNED, (void *)id)) + if (atomic_cmpset_acq_ptr((volatile uintptr_t *)mtx, (uintptr_t)UMTX_UNOWNED, (uintptr_t)id)) return (0); return __thr_umtx_timedlock(mtx, id, timeout); } @@ -70,7 +70,7 @@ static inline int _thr_umtx_unlock(volatile umtx_t *mtx, long id) { - if (atomic_cmpset_rel_ptr(mtx, (void *)id, (void *)UMTX_UNOWNED)) + if (atomic_cmpset_rel_ptr((volatile uintptr_t *)mtx, (uintptr_t)id, (uintptr_t)UMTX_UNOWNED)) return (0); return __thr_umtx_unlock(mtx, id); } --- lib/libpthread/sys/lock.c.orig Thu Jul 28 21:18:48 2005 +++ lib/libpthread/sys/lock.c Thu Jul 28 21:24:47 2005 @@ -180,7 +180,7 @@ atomic_swap_ptr(&lck->l_head, lu->lu_myreq, &lu->lu_watchreq); if (lu->lu_watchreq->lr_locked != 0) { - atomic_store_rel_ptr(&lu->lu_watchreq->lr_watcher, lu); + atomic_store_rel_ptr((volatile uintptr_t *)&lu->lu_watchreq->lr_watcher, (uintptr_t)lu); if ((lck->l_wait == NULL) || ((lck->l_type & LCK_ADAPTIVE) == 0)) { while (lu->lu_watchreq->lr_locked != 0) @@ -250,14 +250,14 @@ /* Update tail if our request is last. */ if (lu->lu_watchreq->lr_owner == NULL) { - atomic_store_rel_ptr(&lck->l_tail, lu->lu_myreq); - atomic_store_rel_ptr(&lu->lu_myreq->lr_owner, NULL); + atomic_store_rel_ptr((volatile uintptr_t *)&lck->l_tail, (uintptr_t)lu->lu_myreq); + atomic_store_rel_ptr((volatile uintptr_t *)&lu->lu_myreq->lr_owner, (uintptr_t)NULL); } else { /* Remove ourselves from the list. */ - atomic_store_rel_ptr(&lu->lu_myreq->lr_owner, - lu->lu_watchreq->lr_owner); + atomic_store_rel_ptr((volatile uintptr_t *)&lu->lu_myreq->lr_owner, + (uintptr_t)lu->lu_watchreq->lr_owner); atomic_store_rel_ptr( - &lu->lu_watchreq->lr_owner->lu_myreq, lu->lu_myreq); + (volatile uintptr_t *)&lu->lu_watchreq->lr_owner->lu_myreq, (uintptr_t)lu->lu_myreq); } /* * The watch request now becomes our own because we've -- Craig Rodrigues rodrigc@crodrigues.org