From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 05:40:58 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C793C16A4CE for ; Sun, 18 Jul 2004 05:40:58 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82CC243D2F for ; Sun, 18 Jul 2004 05:40:58 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.11/8.12.11) with ESMTP id i6I5eVJk018402 for ; Sun, 18 Jul 2004 01:40:31 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i6I5eV6D018399 for ; Sun, 18 Jul 2004 01:40:31 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Sun, 18 Jul 2004 01:40:31 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: threads@FreeBSD.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 05:40:58 -0000 I'm doing some stability and performance testing as part of the network stack locking work. I'd like a way to easily plug and play the configuration of libpthread at run-time (although restarting apps is fine, rebooting is less preferable, as is actually rebuilding!). It looks like right now if I want to switch the operating mode of libpthread to 1:1, I have to recompile it with different compile options and have a separate library floating around that I plug. Could we arrange for it to be a runtime switch of some sort (perhaps read once when the app starts), or build the library both ways by default and intall with different names? Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Principal Research Scientist, McAfee Research From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 16:30:30 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C8AA16A4CE; Sun, 18 Jul 2004 16:30:30 +0000 (GMT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4FC143D48; Sun, 18 Jul 2004 16:30:29 +0000 (GMT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i6IGUSjh000017; Sun, 18 Jul 2004 12:30:28 -0400 (EDT) Date: Sun, 18 Jul 2004 12:30:28 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Robert Watson In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 16:30:30 -0000 On Sun, 18 Jul 2004, Robert Watson wrote: > > I'm doing some stability and performance testing as part of the network > stack locking work. I'd like a way to easily plug and play the > configuration of libpthread at run-time (although restarting apps is fine, > rebooting is less preferable, as is actually rebuilding!). It looks like > right now if I want to switch the operating mode of libpthread to 1:1, I > have to recompile it with different compile options and have a separate > library floating around that I plug. Could we arrange for it to be a > runtime switch of some sort (perhaps read once when the app starts), or > build the library both ways by default and intall with different names? The way to do this so it is switchable without relinking the application (and without using libmap.conf) is to use LD_LIBRARY_PATH. You can install libpthread built as 1:1 anywhere you like and just set LD_LIBRARY_PATH to wherever it is installed. If you want both 1:1 and M:N versions of libpthread installed by default, we have to decide where to install the 1:1 version. I would recommend 1:1 go in lib/lwp/libpthread.so.1 and M:N in lib/libpthread.so.1. You could change "lwp" to "kse" or something else. -- Dan Eischen From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 16:32:47 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1593C16A4CE for ; Sun, 18 Jul 2004 16:32:47 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id B89C343D46 for ; Sun, 18 Jul 2004 16:32:46 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.11/8.12.11) with ESMTP id i6IGWIdO024832; Sun, 18 Jul 2004 12:32:18 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i6IGWIUs024829; Sun, 18 Jul 2004 12:32:18 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Sun, 18 Jul 2004 12:32:18 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Daniel Eischen In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 16:32:47 -0000 On Sun, 18 Jul 2004, Daniel Eischen wrote: > The way to do this so it is switchable without relinking the application > (and without using libmap.conf) is to use LD_LIBRARY_PATH. You can > install libpthread built as 1:1 anywhere you like and just set > LD_LIBRARY_PATH to wherever it is installed. > > If you want both 1:1 and M:N versions of libpthread installed by > default, we have to decide where to install the 1:1 version. I would > recommend 1:1 go in lib/lwp/libpthread.so.1 and M:N in > lib/libpthread.so.1. You could change "lwp" to "kse" or something > else. The issue here is my keeping everything in sync and making sure testing is reproduceable. If I'm manually building and installing threading libraries, I'm likely to screw it up. I was hoping for a mechanism in buildworld/installworld so that it all happens automatically, reducing the chances of user error, stale library versions, etc. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Principal Research Scientist, McAfee Research From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 16:44:24 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA1A116A4D0; Sun, 18 Jul 2004 16:44:24 +0000 (GMT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6559C43D49; Sun, 18 Jul 2004 16:44:24 +0000 (GMT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i6IGiNjh002233; Sun, 18 Jul 2004 12:44:23 -0400 (EDT) Date: Sun, 18 Jul 2004 12:44:23 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Robert Watson In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 16:44:24 -0000 On Sun, 18 Jul 2004, Robert Watson wrote: > > On Sun, 18 Jul 2004, Daniel Eischen wrote: > > > The way to do this so it is switchable without relinking the application > > (and without using libmap.conf) is to use LD_LIBRARY_PATH. You can > > install libpthread built as 1:1 anywhere you like and just set > > LD_LIBRARY_PATH to wherever it is installed. > > > > If you want both 1:1 and M:N versions of libpthread installed by > > default, we have to decide where to install the 1:1 version. I would > > recommend 1:1 go in lib/lwp/libpthread.so.1 and M:N in > > lib/libpthread.so.1. You could change "lwp" to "kse" or something > > else. > > The issue here is my keeping everything in sync and making sure testing is > reproduceable. If I'm manually building and installing threading > libraries, I'm likely to screw it up. I was hoping for a mechanism in > buildworld/installworld so that it all happens automatically, reducing the > chances of user error, stale library versions, etc. Well, like I said, if we can agree on a place to put the 1:1 version and what to call it, we can make it happen. My suggestion is to keep the libraries named the same, install them in different places, and use LD_LIBRARY_PATH to switch between them. Should I just do it, or is more discussion needed? -- Dan Eischen From owner-freebsd-threads@FreeBSD.ORG Sun Jul 18 21:58:03 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9EF3916A4CE for ; Sun, 18 Jul 2004 21:58:03 +0000 (GMT) Received: from vn1173.fireboxhosting.com (vn1173.fireboxhosting.com [205.237.202.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 46F1B43D2F for ; Sun, 18 Jul 2004 21:58:03 +0000 (GMT) (envelope-from alex@hightemplar.com) Received: from 212-150-124-244.barak.net.il ([212.150.124.244] helo=hydralisk) by vn1173.fireboxhosting.com with esmtp (Exim 4.34) id 1BmJfV-0005kH-JJ for threads@freebsd.org; Sun, 18 Jul 2004 17:58:02 -0400 From: Alex Keahan To: threads@freebsd.org Date: Mon, 19 Jul 2004 00:57:14 +0300 User-Agent: KMail/1.5.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200407190057.14164.alex@hightemplar.com> Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2004 21:58:03 -0000 On Sunday 18 Jul 2004 7:30 pm, Daniel Eischen wrote: > On Sun, 18 Jul 2004, Robert Watson wrote: > > I'm doing some stability and performance testing as part of the network > > stack locking work. I'd like a way to easily plug and play the > > configuration of libpthread at run-time (although restarting apps is > > fine, rebooting is less preferable, as is actually rebuilding!). It > > looks like right now if I want to switch the operating mode of libpthread > > to 1:1, I have to recompile it with different compile options and have a > > separate library floating around that I plug. Could we arrange for it to > > be a runtime switch of some sort (perhaps read once when the app starts), > > or build the library both ways by default and intall with different > > names? > > The way to do this so it is switchable without relinking > the application (and without using libmap.conf) is to use > LD_LIBRARY_PATH. You can install libpthread built as 1:1 > anywhere you like and just set LD_LIBRARY_PATH to wherever > it is installed. > > If you want both 1:1 and M:N versions of libpthread installed > by default, we have to decide where to install the 1:1 version. > I would recommend 1:1 go in lib/lwp/libpthread.so.1 and M:N > in lib/libpthread.so.1. You could change "lwp" to "kse" > or something else. How about: M:N libpthread: /usr/lib/libpthread.so 1:1 libpthread: /usr/lib/lwp/libpthread.so 1:1 libthr: /usr/lib/thr/libpthread.so? or M:N libpthread: /usr/lib/libpthread.so 1:1 libpthread: /usr/lib/kse/libpthread.so 1:1 libthr: /usr/lib/lwp/libpthread.so? I think all the POSIX thread libraries should be called "libpthread.so" instead of libpthread, libthread, libc_r. Then you can compile things once and select the library you want at runtime by setting the dynamic linker search path (or at link time using the -R linker switch.) In essense, this would be similar to Solaris. Solaris 8 has two POSIX threads libraries (libpthread.so): M:N, located in /usr/lib (32-bit) and /usr/lib/sparcv9 (64-bit), and 1:1, located in /usr/lib/lwp (32-bit) and /usr/lib/lwp/sparcv9 (64-bit) Solaris 9 has only one libpthread (1:1) in: /usr/lib (32-bit) and /usr/lib/sparcv9 (64-bit) (Their 1:1 libpthread is probably more like our "libthr" than "libkse/libpthread in 1:1 mode".) As a side note, Solaris also has a "libthread" which is *not* a POSIX thread library - it implements "Solaris threads" - it's *not* like our libthr which implements *POSIX threads*. Alex Keahan From owner-freebsd-threads@FreeBSD.ORG Mon Jul 19 11:01:54 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F347816A4D7 for ; Mon, 19 Jul 2004 11:01:53 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D753B43D1D for ; Mon, 19 Jul 2004 11:01:53 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i6JB1rZF015538 for ; Mon, 19 Jul 2004 11:01:53 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i6JB1rXs015532 for freebsd-threads@freebsd.org; Mon, 19 Jul 2004 11:01:53 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 19 Jul 2004 11:01:53 GMT Message-Id: <200407191101.i6JB1rXs015532@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 11:01:54 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/04/22] threads/65883threads libkse's sigwait does not work after fork 3 problems total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/07/18] kern/20016 threads pthreads: Cannot set scheduling timer/Can o [2000/08/26] misc/20861 threads libc_r does not honor socket timeouts o [2001/01/20] bin/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] bin/24632 threads libc_r delicate deviation from libc in ha o [2001/01/25] misc/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] i386/34536 threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] bin/39922 threads [PATCH?] Threaded applications executed w o [2002/08/04] misc/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] bin/48856 threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] bin/49087 threads Signals lost in programs linked with libc o [2003/05/08] bin/51949 threads thread in accept cannot be cancelled 13 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/26] misc/18824 threads gethostbyname is not thread safe o [2000/10/21] misc/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] bin/30464 threads pthread mutex attributes -- pshared o [2002/05/02] bin/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex 6 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Jul 19 15:17:24 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C82816A4CE; Mon, 19 Jul 2004 15:17:24 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 575D143D58; Mon, 19 Jul 2004 15:17:24 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.11/8.12.11) with ESMTP id i6JFGq4M051605; Mon, 19 Jul 2004 11:16:52 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i6JFGqdD051602; Mon, 19 Jul 2004 11:16:52 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Mon, 19 Jul 2004 11:16:52 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: deischen@freebsd.org In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: A way to build and install libpthread as 1:1 as well as M:N? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 15:17:24 -0000 On Sun, 18 Jul 2004, Daniel Eischen wrote: > > The issue here is my keeping everything in sync and making sure testing is > > reproduceable. If I'm manually building and installing threading > > libraries, I'm likely to screw it up. I was hoping for a mechanism in > > buildworld/installworld so that it all happens automatically, reducing the > > chances of user error, stale library versions, etc. > > Well, like I said, if we can agree on a place to put the 1:1 version and > what to call it, we can make it happen. My suggestion is to keep the > libraries named the same, install them in different places, and use > LD_LIBRARY_PATH to switch between them. > > Should I just do it, or is more discussion needed? Other than the need for something like it, I don't have much opinion on the mechanism by which it's accomplished. I think that what you suggest sounds pretty reasonable to me. I'd be fine with a libpthread11, a lib/foo/libpthread, or whatever makes the most sense to you. I guess maybe I have a slight preference for libpthread11, but agree that the benefits of being able to use LD_LIBRARY_PATH are substantial and probably more important than the slight asthetic preference. Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Principal Research Scientist, McAfee Research From owner-freebsd-threads@FreeBSD.ORG Mon Jul 19 17:53:10 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C61516A4CE for ; Mon, 19 Jul 2004 17:53:10 +0000 (GMT) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4E1D43D60 for ; Mon, 19 Jul 2004 17:53:07 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 16466 invoked from network); 19 Jul 2004 17:53:07 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 19 Jul 2004 17:53:06 -0000 Received: from 10.50.41.229 (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i6JHr0dI013757 for ; Mon, 19 Jul 2004 13:53:01 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: threads@FreeBSD.org Date: Mon, 19 Jul 2004 13:52:50 -0400 User-Agent: KMail/1.6 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200407191352.50465.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx Subject: Patch to fix cv_wait return values X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 17:53:10 -0000 I have a patch to try to sync up the semantics of the return values of the cv_wait() functions with msleep(). The patch is at http://people.FreeBSD.org/~jhb/patches/cv_retval.patch and is inline below. If people could test it ok and verify that the patch is correct I'd appreciate it. Thanks. --- //depot/projects/smpng/sys/kern/kern_condvar.c 2004/06/29 02:54:29 +++ //depot/user/jhb/lock/kern/kern_condvar.c 2004/07/09 18:16:47 @@ -170,12 +170,28 @@ * procs or panic below, in case this is the idle process and * already asleep. */ - return 0; + return (0); } sq = sleepq_lookup(cvp); - /* XXX: Missing the threading checks from msleep! */ + /* + * Don't bother sleeping if we are exiting and not the exiting + * thread or if our thread is marked as interrupted. + */ + mtx_lock_spin(&sched_lock); + if (p->p_flag & P_SA || p->p_numthreads > 1) { + if ((p->p_flag & P_WEXIT) && p->p_singlethread != td) + rval = EINTR; + else if (td->td_flags & TDF_INTERRUPT) + rval = td->td_intrval; + if (rval != 0) { + mtx_unlock_spin(&sched_lock); + sleepq_release(cvp); + return (rval); + } + } + mtx_unlock_spin(&sched_lock); cvp->cv_waiters++; DROP_GIANT(); @@ -183,20 +199,16 @@ sleepq_add(sq, cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR); sig = sleepq_catch_signals(cvp); - /* - * XXX: Missing magic return value handling for no signal - * caught but thread woken up during check. - */ - rval = sleepq_wait_sig(cvp); + if (sig == 0 && !TD_ON_SLEEPQ(td)) { + mtx_lock_spin(&sched_lock); + td->td_flags &= ~TDF_SINTR; + mtx_unlock_spin(&sched_lock); + sleepq_wait(cvp); + } else + rval = sleepq_wait_sig(cvp); if (rval == 0) rval = sleepq_calc_signal_retval(sig); - /* XXX: Part of missing threading checks? */ - PROC_LOCK(p); - if (p->p_flag & P_WEXIT) - rval = EINTR; - PROC_UNLOCK(p); - #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) ktrcsw(0, 0); @@ -303,6 +315,24 @@ sq = sleepq_lookup(cvp); + /* + * Don't bother sleeping if we are exiting and not the exiting + * thread or if our thread is marked as interrupted. + */ + mtx_lock_spin(&sched_lock); + if (p->p_flag & P_SA || p->p_numthreads > 1) { + if ((p->p_flag & P_WEXIT) && p->p_singlethread != td) + rval = EINTR; + else if (td->td_flags & TDF_INTERRUPT) + rval = td->td_intrval; + if (rval != 0) { + mtx_unlock_spin(&sched_lock); + sleepq_release(cvp); + return (rval); + } + } + mtx_unlock_spin(&sched_lock); + cvp->cv_waiters++; DROP_GIANT(); mtx_unlock(mp); @@ -310,20 +340,16 @@ sleepq_add(sq, cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR); sleepq_set_timeout(cvp, timo); sig = sleepq_catch_signals(cvp); - /* - * XXX: Missing magic return value handling for no signal - * caught but thread woken up during check. - */ - rval = sleepq_timedwait_sig(cvp, sig != 0); + if (sig == 0 && !TD_ON_SLEEPQ(td)) { + mtx_lock_spin(&sched_lock); + td->td_flags &= ~TDF_SINTR; + mtx_unlock_spin(&sched_lock); + rval = sleepq_timedwait(cvp); + } else + rval = sleepq_timedwait_sig(cvp, sig != 0); if (rval == 0) rval = sleepq_calc_signal_retval(sig); - /* XXX: Part of missing threading checks? */ - PROC_LOCK(p); - if (p->p_flag & P_WEXIT) - rval = EINTR; - PROC_UNLOCK(p); - #ifdef KTRACE if (KTRPOINT(td, KTR_CSW)) ktrcsw(0, 0); -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org From owner-freebsd-threads@FreeBSD.ORG Tue Jul 20 01:23:17 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8B5F16A4CE; Tue, 20 Jul 2004 01:23:17 +0000 (GMT) Received: from exchhz01.viatech.com.cn (ip-40-162-97-218.anlai.com [218.97.162.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 24C4643D1D; Tue, 20 Jul 2004 01:23:15 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (DAVIDWNT [10.4.1.99]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NVXA0BZ0; Tue, 20 Jul 2004 09:22:36 +0800 Message-ID: <40FC74CD.1080402@freebsd.org> Date: Tue, 20 Jul 2004 09:26:37 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Baldwin References: <200407191352.50465.jhb@FreeBSD.org> In-Reply-To: <200407191352.50465.jhb@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: threads@FreeBSD.org Subject: Re: Patch to fix cv_wait return values X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2004 01:23:18 -0000 John Baldwin wrote: > I have a patch to try to sync up the semantics of the return values of > the (p->p_flag & P_WEXIT) really should be P_SINGLE_EXIT, P_WEXIT is turned on after process has only one thread. Others are OK for me. David Xu From owner-freebsd-threads@FreeBSD.ORG Tue Jul 20 22:47:15 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D391816A4CF for ; Tue, 20 Jul 2004 22:47:15 +0000 (GMT) Received: from jagor.srce.hr (jagor.srce.hr [161.53.2.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0371443D3F for ; Tue, 20 Jul 2004 22:47:15 +0000 (GMT) (envelope-from ivoras@fer.hr) Received: from [193.198.133.210] (cmung1480.cmu.carnet.hr [193.198.133.210]) by jagor.srce.hr (8.12.10/8.12.10) with ESMTP id i6KMlBl8027804 for ; Wed, 21 Jul 2004 00:47:12 +0200 (CEST) Message-ID: <40FDA0EC.4000101@fer.hr> Date: Wed, 21 Jul 2004 00:47:08 +0200 From: Ivan Voras User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: threads@freebsd.org X-Enigmail-Version: 0.84.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.42 X-Virus-Scanned: by amavisd-new at jagor.srce.hr Subject: Mono compiler error X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2004 22:47:16 -0000 I tried the recently-released Mono (ports/lang/mono), and as far as I can see, things work, EXCEPT when I try to compile monodoc (get http://mono2.ximian.com/archive/1.0/monodoc-1.0.tar.gz, unarchive, ./configure, make), where I get this error: mcs -debug -out:browser.exe ./browser.cs ./list.cs ./elabel.cs ./history.cs ./Contributions.cs ./XmlNodeWriter.cs -resource:./../monodoc.png,monodoc.png -resource:./browser.glade,browser.glade -pkg:gtkhtml-sharp -pkg:glade-sharp -r:System.Web.Services -r:./monodoc.dll Assertion failed: (lu->lu_myreq->lr_owner == lu), function _lock_acquire, file /usr/src/lib/libpthread/sys/lock.c, line 171. Abort trap (core dumped) This is on a system from 2004-07-14. -- What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't you understand? From owner-freebsd-threads@FreeBSD.ORG Sat Jul 24 17:31:35 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5BC6F16A4CF for ; Sat, 24 Jul 2004 17:31:35 +0000 (GMT) Received: from 1002-17.Lowesthosting.com (1002-17.lowesthosting.com [207.44.234.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 1455043D4C for ; Sat, 24 Jul 2004 17:31:35 +0000 (GMT) (envelope-from jhamby@anobject.com) Received: (qmail 29957 invoked from network); 24 Jul 2004 17:06:16 -0000 Received: from ar39.lsanca2-4.16.240.21.lsanca2.elnk.dsl.genuity.net (HELO ?192.168.0.13?) (4.16.240.21) by 1002-17.lowesthosting.com with SMTP; 24 Jul 2004 17:06:16 -0000 Message-ID: <41029703.8030008@anobject.com> Date: Sat, 24 Jul 2004 10:06:11 -0700 From: Jake Hamby User-Agent: Mozilla Thunderbird 0.7.2 (X11/20040719) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: pthread assertion failure in function _lock_acquire X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jul 2004 17:31:35 -0000 Hi all, I tried to build MonoDoc-1.0 using the port of mono-1.0 and -current (__FreeBSD_version 502123) and got this error right at the beginning of the build: Assertion failed: (lu->lu_myreq->lr_owner == lu), function _lock_acquire, file /usr/src/lib/libpthread/sys/lock.c, line 171. The complete make output is attached below. My CFLAGS settings are: CPUTYPE?=p4 CFLAGS= -O2 -pipe Any ideas? I filed this as bug "ports/69404". -Jake Script started on Fri Jul 23 19:54:52 2004 Making all in browser gmake[1]: Entering directory `/usr/home/jhamby/Code/monodoc-1.0/browser' mcs -debug -out:monodoc.dll -target:library /resource:./mono-ecma.xsl,mono-ecma.xsl /resource:./ecmaspec-html.xsl,ecmaspec-html.xsl ./colorizer.cs ./man-provider.cs ./monohb-provider.cs ./xhtml-provider.cs ./ecma-provider.cs ./simple-provider.cs ./html-helper.cs ./provider.cs ./index.cs ./error-provider.cs ./ecmaspec-provider.cs ./editing.cs ./settings.cs ./commentservice.cs ./XmlNodeWriter.cs AssemblyInfo.cs -r:ICSharpCode.SharpZipLib.dll -r:System.Web -r:System.Web.Services ./ecma-provider.cs(962) warning CS0618: 'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.IO.TextWriter)' is obsolete: 'You should pass XmlResolver to Transform() method' ./ecma-provider.cs(974) warning CS0618: 'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.Xml.XmlWriter)' is obsolete: 'You should pass XmlResolver to Transform() method' ./ecma-provider.cs(985) warning CS0618: 'System.Xml.Xsl.XslTransform.Load(System.Xml.XmlReader)' is obsolete: 'You should pass evidence.' ./ecmaspec-provider.cs(115) warning CS0618: 'System.Xml.Xsl.XslTransform.Load(System.Xml.XmlReader)' is obsolete: 'You should pass evidence.' ./ecmaspec-provider.cs(121) warning CS0618: 'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.IO.TextWriter)' is obsolete: 'You should pass XmlResolver to Transform() method' ./editing.cs(39) warning CS0162: Unreachable code detected Compilation succeeded - 6 warning(s) mcs -debug -out:browser.exe ./browser.cs ./list.cs ./elabel.cs ./history.cs ./Contributions.cs ./XmlNodeWriter.cs -resource:./../monodoc.png,monodoc.png -resource:./browser.glade,browser.glade -pkg:gtkhtml-sharp -pkg:glade-sharp -r:System.Web.Services -r:./monodoc.dll Assertion failed: (lu->lu_myreq->lr_owner == lu), function _lock_acquire, file /usr/src/lib/libpthread/sys/lock.c, line 171. gmake[1]: *** [browser.exe] Abort trap (core dumped) gmake[1]: Leaving directory `/usr/home/jhamby/Code/monodoc-1.0/browser' gmake: *** [all-recursive] Error 1 Script done on Fri Jul 23 19:54:58 2004