From owner-freebsd-threads@FreeBSD.ORG Sun Aug 31 15:39:54 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EA021065681; Sun, 31 Aug 2008 15:39:54 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 4ED3E8FC56; Sun, 31 Aug 2008 15:39:54 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id m7VFdqiW011751; Sun, 31 Aug 2008 11:39:52 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Sun, 31 Aug 2008 11:39:53 -0400 (EDT) Date: Sun, 31 Aug 2008 11:39:52 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Kostik Belousov In-Reply-To: <20080830184512.GH2038@deviant.kiev.zoral.com.ua> Message-ID: References: <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua> <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: davidxu@freebsd.org, Andriy Gapon , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 15:39:54 -0000 On Sat, 30 Aug 2008, Kostik Belousov wrote: > On Sat, Aug 30, 2008 at 12:15:31PM -0400, Daniel Eischen wrote: >> On Sat, 30 Aug 2008, Kostik Belousov wrote: >> >>> On Sat, Aug 30, 2008 at 11:32:35AM -0400, Daniel Eischen wrote: >>>> On Fri, 29 Aug 2008, Kostik Belousov wrote: >>>>> >>>>> As demonstrated by Andriy' example, we need _thr_rtld_init() be called >>>>> before any rtld locks are given chance to be acquired. _thr_rtld_init() >>>>> shall be protected from repeated invocation, and _thr_setthreaded() >>>>> implements exactly this. >>>>> >>>>> If calling _thr_setthreaded(1) has not quite right intent, could you, >>>>> please, suggest satisfying solution ? >>>> >>>> I'm not sure I _quite_ understand the problem, but why >>>> wouldn't you have the same potential problem with some >>>> other library (without libthread)? I'll have to go back >>>> and read the beginning of the thread - I just kinda came >>>> in at the end. >>> >>> Sure, for appropriate value of any. If you mean whether the same problem >>> would arise for any threading library that supplies locking implementation >>> for rtld, then certainly yes. I looked over and patched only libthr >>> since this is the only survived library for now. >> >> What I mean is, is fixing libthr a solution that will work >> for cases? Or, is libthr doing something wrong? I can't >> really see that it is. >> >> libthr assumes that everything is single-threaded (or >> serialized, I guess) before a thread is created. I >> am looking at this thread: >> >> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=5235+0+current/freebsd-threads >> >> Where is the corresponding unlock for the wlock_acquire()? >> I guess this is the problem. When would this normally >> be released (without libthr being linked in)? >> >> Also, the __isthreaded flag is used in libc to avoid taking >> locks unless necessary. So if you have a single threaded >> application that is also linked with libthr, you don't >> pay the penalty of locking overhead. Lots of 3rd-party >> libraries link with a threads library, so an application >> may not even know it is "threaded". >> >>> >>> Anyway, I do not insist on the proposed solution, and definitely >>> prefer the change that is well aligned with libthr architecture. >> >> I'm not arguing anything, I just don't know that the problem >> lies within lib. Of course, the >> rtld init stuff could be pulled out and done in thread >> initialization instead of thr_setthreaded(). That doesn't >> leave much in thr_setthreaded, and it also adds locking >> overhead into rtld for single-threaded programs that are >> linked with libthr... > > Ok, let me to tell the whole story. I am sure that in fact you know > it better then me. > > Assuming libthr is the only threading library, there are two locking > implementations for the rtld: 'default' and the one supplied by libthr. > On the first call to pthread_create(), libthr calls _rtld_thread_init() > to substitute the default by the implementation from libthr. > > In fact, default implementation is broken from my point of view. For > instance, thread_flag update is not atomic. Moreover, it does not > correctly handles sequential acquision of several locks, due > to thread_flag. > > The dl_iterate_phdr() function, called by gcc exception handling support > code, does exactly this. It acquires rtld_phdr_lock, then rtld_bind_lock. > [I shall admit it does this after my change]. In particular, this would > leave the bit for the bind lock set in the thread_flag. > > Andriy' example throw the exception and calls dl_iterate_phdr() before > first thread is created. On thread creation, _rtld_thread_init() is > called, that tries to move the locks according to thread_flag. This is > the cause for the reported wlock acquisition. > > I do not want to change anything in the default rtld locking. It is > disfunctional from the time libc_r is gone, and I think it would be > better to make it nop. My change makes the image that is linked with > libthr, to consistently use libthr locks. What happens if you remove the thread_flag() stuff (support for libc_r?) from rtld? It seems that libc_r should be providing its own rtld locking hooks - just like libthr does. -- DE From owner-freebsd-threads@FreeBSD.ORG Sun Aug 31 18:27:14 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BFD106567D; Sun, 31 Aug 2008 18:27:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 86E0D8FC0C; Sun, 31 Aug 2008 18:27:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KZrdn-0009de-Mb; Sun, 31 Aug 2008 21:27:11 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7VIR8dk034978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Aug 2008 21:27:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7VIR8h3096669; Sun, 31 Aug 2008 21:27:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m7VIR8uW096667; Sun, 31 Aug 2008 21:27:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 31 Aug 2008 21:27:08 +0300 From: Kostik Belousov To: Daniel Eischen Message-ID: <20080831182708.GN2038@deviant.kiev.zoral.com.ua> References: <20080829141043.GX2038@deviant.kiev.zoral.com.ua> <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yY9LxKOJMX9E+noF" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KZrdn-0009de-Mb fa61bc0ad60d36ea49b1bc329fe8d6ab X-Terabit: YES Cc: davidxu@freebsd.org, Andriy Gapon , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 18:27:14 -0000 --yY9LxKOJMX9E+noF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 31, 2008 at 11:39:52AM -0400, Daniel Eischen wrote: > On Sat, 30 Aug 2008, Kostik Belousov wrote: >=20 > >On Sat, Aug 30, 2008 at 12:15:31PM -0400, Daniel Eischen wrote: > >>On Sat, 30 Aug 2008, Kostik Belousov wrote: > >> > >>>On Sat, Aug 30, 2008 at 11:32:35AM -0400, Daniel Eischen wrote: > >>>>On Fri, 29 Aug 2008, Kostik Belousov wrote: > >>>>> > >>>>>As demonstrated by Andriy' example, we need _thr_rtld_init() be call= ed > >>>>>before any rtld locks are given chance to be acquired. _thr_rtld_ini= t() > >>>>>shall be protected from repeated invocation, and _thr_setthreaded() > >>>>>implements exactly this. > >>>>> > >>>>>If calling _thr_setthreaded(1) has not quite right intent, could you, > >>>>>please, suggest satisfying solution ? > >>>> > >>>>I'm not sure I _quite_ understand the problem, but why > >>>>wouldn't you have the same potential problem with some > >>>>other library (without libthread)? I'll have to go back > >>>>and read the beginning of the thread - I just kinda came > >>>>in at the end. > >>> > >>>Sure, for appropriate value of any. If you mean whether the same probl= em > >>>would arise for any threading library that supplies locking=20 > >>>implementation > >>>for rtld, then certainly yes. I looked over and patched only libthr > >>>since this is the only survived library for now. > >> > >>What I mean is, is fixing libthr a solution that will work > >>for cases? Or, is libthr doing something wrong? I can't > >>really see that it is. > >> > >>libthr assumes that everything is single-threaded (or > >>serialized, I guess) before a thread is created. I > >>am looking at this thread: > >> > >> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=3D5235+0+current/freebsd= -threads > >> > >>Where is the corresponding unlock for the wlock_acquire()? > >>I guess this is the problem. When would this normally > >>be released (without libthr being linked in)? > >> > >>Also, the __isthreaded flag is used in libc to avoid taking > >>locks unless necessary. So if you have a single threaded > >>application that is also linked with libthr, you don't > >>pay the penalty of locking overhead. Lots of 3rd-party > >>libraries link with a threads library, so an application > >>may not even know it is "threaded". > >> > >>> > >>>Anyway, I do not insist on the proposed solution, and definitely > >>>prefer the change that is well aligned with libthr architecture. > >> > >>I'm not arguing anything, I just don't know that the problem > >>lies within lib. Of course, the > >>rtld init stuff could be pulled out and done in thread > >>initialization instead of thr_setthreaded(). That doesn't > >>leave much in thr_setthreaded, and it also adds locking > >>overhead into rtld for single-threaded programs that are > >>linked with libthr... > > > >Ok, let me to tell the whole story. I am sure that in fact you know > >it better then me. > > > >Assuming libthr is the only threading library, there are two locking > >implementations for the rtld: 'default' and the one supplied by libthr. > >On the first call to pthread_create(), libthr calls _rtld_thread_init() > >to substitute the default by the implementation from libthr. > > > >In fact, default implementation is broken from my point of view. For > >instance, thread_flag update is not atomic. Moreover, it does not > >correctly handles sequential acquision of several locks, due > >to thread_flag. > > > >The dl_iterate_phdr() function, called by gcc exception handling support > >code, does exactly this. It acquires rtld_phdr_lock, then rtld_bind_lock. > >[I shall admit it does this after my change]. In particular, this would > >leave the bit for the bind lock set in the thread_flag. > > > >Andriy' example throw the exception and calls dl_iterate_phdr() before > >first thread is created. On thread creation, _rtld_thread_init() is > >called, that tries to move the locks according to thread_flag. This is > >the cause for the reported wlock acquisition. > > > >I do not want to change anything in the default rtld locking. It is > >disfunctional from the time libc_r is gone, and I think it would be > >better to make it nop. My change makes the image that is linked with > >libthr, to consistently use libthr locks. >=20 > What happens if you remove the thread_flag() stuff (support > for libc_r?) from rtld? It seems that libc_r should be providing > its own rtld locking hooks - just like libthr does. No, libc_r uses default rtld locking, as absence of the references to _rtld_thread_init in libc_r code indicates. This is one of the reasons why I decline to change the code. We still support compat-4.x on all supported systems, but I have no way to properly test it, If changing the default implementation, I think we should just record lock attempts to be able to transfer them when _rtld_thread_init is called. But this would break libc_r. I saw the use of the libthr locking from the start as the cleanest and least intrusive. As I said, I would gladly accept any better idea. --yY9LxKOJMX9E+noF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki64nsACgkQC3+MBN1Mb4gLwACgufpcBFyw9Brld30rcXBeHalX qIIAoJxtTMjT39lGFKj4dVXf3Bz+yMbm =BvKg -----END PGP SIGNATURE----- --yY9LxKOJMX9E+noF-- From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 08:08:34 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE5621065673; Mon, 1 Sep 2008 08:08:34 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C77FD8FC16; Mon, 1 Sep 2008 08:08:34 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m8188WSL049370; Mon, 1 Sep 2008 08:08:33 GMT (envelope-from davidxu@freebsd.org) Message-ID: <48BBA369.9010108@freebsd.org> Date: Mon, 01 Sep 2008 16:10:17 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Kostik Belousov References: <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua> <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20080830184512.GH2038@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Daniel Eischen , Andriy Gapon , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 08:08:35 -0000 Kostik Belousov wrote: > Ok, let me to tell the whole story. I am sure that in fact you know > it better then me. > > Assuming libthr is the only threading library, there are two locking > implementations for the rtld: 'default' and the one supplied by libthr. > On the first call to pthread_create(), libthr calls _rtld_thread_init() > to substitute the default by the implementation from libthr. > > In fact, default implementation is broken from my point of view. For > instance, thread_flag update is not atomic. Moreover, it does not > correctly handles sequential acquision of several locks, due > to thread_flag. > > The dl_iterate_phdr() function, called by gcc exception handling support > code, does exactly this. It acquires rtld_phdr_lock, then rtld_bind_lock. > [I shall admit it does this after my change]. In particular, this would > leave the bit for the bind lock set in the thread_flag. > > Andriy' example throw the exception and calls dl_iterate_phdr() before > first thread is created. On thread creation, _rtld_thread_init() is > called, that tries to move the locks according to thread_flag. This is > the cause for the reported wlock acquisition. > > I do not want to change anything in the default rtld locking. It is > disfunctional from the time libc_r is gone, and I think it would be > better to make it nop. My change makes the image that is linked with > libthr, to consistently use libthr locks. The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test thread_flag as a boolean value, because pt_iterate_phdr() tries to lock two locks at same time, this test will always fail once it acquired first lock. The following silly patch fixes the problem Andriy encountered: Index: rtld_lock.c =================================================================== --- rtld_lock.c (版本 182594) +++ rtld_lock.c (工作副本) @@ -184,7 +184,7 @@ int rlock_acquire(rtld_lock_t lock) { - if (thread_mask_set(lock->mask)) { + if (thread_mask_set(lock->mask) & lock->mask) { dbg("rlock_acquire: recursed"); return (0); } @@ -195,7 +195,7 @@ int wlock_acquire(rtld_lock_t lock) { - if (thread_mask_set(lock->mask)) { + if (thread_mask_set(lock->mask) & lock->mask) { dbg("wlock_acquire: recursed"); return (0); } Regards, David Xu From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 08:34:53 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED4C5106566B for ; Mon, 1 Sep 2008 08:34:53 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from hosted.kievnet.com (hosted.kievnet.com [193.138.144.10]) by mx1.freebsd.org (Postfix) with ESMTP id A34458FC18 for ; Mon, 1 Sep 2008 08:34:53 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost ([127.0.0.1] helo=edge.pp.kiev.ua) by hosted.kievnet.com with esmtpa (Exim 4.62) (envelope-from ) id 1Ka4s7-000L6q-Gi; Mon, 01 Sep 2008 11:34:51 +0300 Message-ID: <48BBA925.1000303@icyb.net.ua> Date: Mon, 01 Sep 2008 11:34:45 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.16 (X11/20080821) MIME-Version: 1.0 To: David Xu References: <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua> <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> In-Reply-To: <48BBA369.9010108@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Daniel Eischen , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 08:34:54 -0000 on 01/09/2008 11:10 David Xu said the following: > The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test > thread_flag as a boolean value, because pt_iterate_phdr() tries to > lock two locks at same time, this test will always fail once it > acquired first lock. > > The following silly patch fixes the problem Andriy encountered: I can confirm - this fixed the issue for me. David, thanks! > Index: rtld_lock.c > =================================================================== > --- rtld_lock.c (版本 182594) > +++ rtld_lock.c (工作副本) > @@ -184,7 +184,7 @@ > int > rlock_acquire(rtld_lock_t lock) > { > - if (thread_mask_set(lock->mask)) { > + if (thread_mask_set(lock->mask) & lock->mask) { > dbg("rlock_acquire: recursed"); > return (0); > } > @@ -195,7 +195,7 @@ > int > wlock_acquire(rtld_lock_t lock) > { > - if (thread_mask_set(lock->mask)) { > + if (thread_mask_set(lock->mask) & lock->mask) { > dbg("wlock_acquire: recursed"); > return (0); > } > > > Regards, > David Xu > -- Andriy Gapon From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 08:45:54 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A0AC1065671; Mon, 1 Sep 2008 08:45:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id BE3508FC13; Mon, 1 Sep 2008 08:45:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Ka52l-0004yq-Tf; Mon, 01 Sep 2008 11:45:52 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m818jm3u076282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Sep 2008 11:45:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m818jml6041577; Mon, 1 Sep 2008 11:45:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m818jmfB041576; Mon, 1 Sep 2008 11:45:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 1 Sep 2008 11:45:48 +0300 From: Kostik Belousov To: Andriy Gapon Message-ID: <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> References: <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6JKsAUbrJhuSllgx" Content-Disposition: inline In-Reply-To: <48BBA925.1000303@icyb.net.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1Ka52l-0004yq-Tf f99fec52d19577f7c55dccd23bb7c397 X-Terabit: YES Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 08:45:54 -0000 --6JKsAUbrJhuSllgx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 01, 2008 at 11:34:45AM +0300, Andriy Gapon wrote: > on 01/09/2008 11:10 David Xu said the following: > >The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test > >thread_flag as a boolean value, because pt_iterate_phdr() tries to > >lock two locks at same time, this test will always fail once it > >acquired first lock. > > > >The following silly patch fixes the problem Andriy encountered: >=20 > I can confirm - this fixed the issue for me. > David, thanks! Does libc_r still work with patch applied ? --6JKsAUbrJhuSllgx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki7q7wACgkQC3+MBN1Mb4jhFwCdGzyV29sMIpopIOnKA5LvwGm6 FQgAn15mucMAsvCvJpUFaBODgLD+i7st =7CUE -----END PGP SIGNATURE----- --6JKsAUbrJhuSllgx-- From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 09:00:29 2008 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AD891065683 for ; Mon, 1 Sep 2008 09:00:29 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 250188FC21 for ; Mon, 1 Sep 2008 09:00:21 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m8190IfK054302 for ; Mon, 1 Sep 2008 09:00:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m8190IX1054301; Mon, 1 Sep 2008 09:00:18 GMT (envelope-from gnats) Date: Mon, 1 Sep 2008 09:00:18 GMT Message-Id: <200809010900.m8190IX1054301@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: agile@sunbay.com Cc: Subject: Re: threads/126950: rtld malloc is thread-unsafe X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: agile@sunbay.com List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 09:00:29 -0000 The following reply was made to PR threads/126950; it has been noted by GNATS. From: agile@sunbay.com To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/126950: rtld malloc is thread-unsafe Date: Mon, 1 Sep 2008 11:58:30 +0300 (EEST) ------=_20080901115830_71529 Content-Type: text/plain; charset="utf8" Content-Transfer-Encoding: 8bit patch for 7.0-RELEASE ------=_20080901115830_71529 Content-Type: text/plain; name="126950.patch.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="126950.patch.txt" diff -ur /usr/src/libexec/rtld-elf/rtld.c /usr/src/libexec/rtld-elf/rtld.c --- /usr/src/libexec/rtld-elf/rtld.c 2008-09-01 11:29:15.000000000 +0300 +++ /usr/src/libexec/rtld-elf/rtld.c 2008-09-01 11:29:15.000000000 +0300 @@ -107,7 +107,7 @@ static Obj_Entry *load_object(const char *, const Obj_Entry *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, int *lockstate, unsigned long *gen); -static void objlist_call_init(Objlist *); +static void objlist_call_init(Objlist *, int *lockstate); static void objlist_clear(Objlist *); static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *); static void objlist_init(Objlist *); @@ -513,8 +513,8 @@ r_debug_state(NULL, &obj_main->linkmap); /* say hello to gdb! */ - objlist_call_init(&initlist); lockstate = wlock_acquire(rtld_bind_lock); + objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); wlock_release(rtld_bind_lock, lockstate); @@ -1473,7 +1473,7 @@ * functions. */ static void -objlist_call_init(Objlist *list) +objlist_call_init(Objlist *list, int *lockstate) { Objlist_Entry *elm, *elm_tmp; char *saved_msg; @@ -1483,6 +1483,7 @@ * call into the dynamic linker and overwrite it. */ saved_msg = errmsg_save(); + wlock_release(rtld_bind_lock, *lockstate); STAILQ_FOREACH_SAFE(elm, list, link, elm_tmp) { dbg("calling init function for %s at %p", elm->obj->path, (void *)elm->obj->init); @@ -1490,6 +1491,7 @@ elm->obj->path); call_initfini_pointer(elm->obj, elm->obj->init); } + *lockstate = wlock_acquire(rtld_bind_lock); errmsg_restore(saved_msg); } @@ -1775,7 +1777,7 @@ if (root->refcount == 0) { /* * The object is no longer referenced, so we must unload it. - * First, call the fini functions with no locks held. + * First, call the fini functions. */ objlist_call_fini(&list_fini, &lockstate, &list_fini_gen); @@ -1890,10 +1892,8 @@ name); GDB_STATE(RT_CONSISTENT,obj ? &obj->linkmap : NULL); - /* Call the init functions with no locks held. */ - wlock_release(rtld_bind_lock, lockstate); - objlist_call_init(&initlist); - lockstate = wlock_acquire(rtld_bind_lock); + /* Call the init functions. */ + objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); wlock_release(rtld_bind_lock, lockstate); return obj; ------=_20080901115830_71529-- From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 10:53:31 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C198106567C; Mon, 1 Sep 2008 10:53:31 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from hosted.kievnet.com (hosted.kievnet.com [193.138.144.10]) by mx1.freebsd.org (Postfix) with ESMTP id 1F61E8FC08; Mon, 1 Sep 2008 10:53:31 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost ([127.0.0.1] helo=edge.pp.kiev.ua) by hosted.kievnet.com with esmtpa (Exim 4.62) (envelope-from ) id 1Ka72H-000PGP-T2; Mon, 01 Sep 2008 13:53:29 +0300 Message-ID: <48BBC9A3.1050905@icyb.net.ua> Date: Mon, 01 Sep 2008 13:53:23 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.16 (X11/20080821) MIME-Version: 1.0 To: Kostik Belousov References: <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=KOI8-U; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 10:53:31 -0000 on 01/09/2008 11:45 Kostik Belousov said the following: > On Mon, Sep 01, 2008 at 11:34:45AM +0300, Andriy Gapon wrote: >> on 01/09/2008 11:10 David Xu said the following: >>> The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test >>> thread_flag as a boolean value, because pt_iterate_phdr() tries to >>> lock two locks at same time, this test will always fail once it >>> acquired first lock. >>> >>> The following silly patch fixes the problem Andriy encountered: >> I can confirm - this fixed the issue for me. >> David, thanks! > > Does libc_r still work with patch applied ? In what sense? The test program that I posted seems to hang in both cases (patched and unpatched rtld). -- Andriy Gapon From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 11:07:04 2008 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 165AE1065731 for ; Mon, 1 Sep 2008 11:07:04 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0656C8FC23 for ; Mon, 1 Sep 2008 11:07:04 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m81B73Pn068598 for ; Mon, 1 Sep 2008 11:07:03 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m81B73Ik068594 for freebsd-threads@FreeBSD.org; Mon, 1 Sep 2008 11:07:03 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 1 Sep 2008 11:07:03 GMT Message-Id: <200809011107.m81B73Ik068594@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 11:07:04 -0000 Current FreeBSD problem reports Critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/76690 threads fork hang in child for -lc_r 1 problem total. Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s bin/32295 threads pthread(3) dont dequeue signals s threa/34536 threads accept() blocks other threads s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/49087 threads Signals lost in programs linked with libc_r o threa/70975 threads [sysvipc] unexpected and unreliable behaviour when usi o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag s threa/76694 threads fork cause hang in dup()/close() function in child (-l o threa/79683 threads svctcp_create() fails if multiple threads call at the o threa/80435 threads panic on high loads o threa/83914 threads [libc] popen() doesn't work in static threaded program s threa/84483 threads problems with devel/nspr and -lc_r on 4.x s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r o threa/101323 threads fork(2) in threaded programs broken. o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/118715 threads kse problem o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/126950 threads [patch] rtld(1): rtld malloc is thread-unsafe 24 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/30464 threads pthread mutex attributes -- pshared s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/69020 threads pthreads library leaks _gc_mutex o threa/79887 threads [patch] freopen() isn't thread-safe o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/122923 threads 'nice' does not prevent background process from steali o kern/126128 threads [patch] pthread_condattr_getpshared is broken 12 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 11:12:21 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C7AE1065676; Mon, 1 Sep 2008 11:12:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id E11768FC25; Mon, 1 Sep 2008 11:12:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Ka7KV-000KcM-1g; Mon, 01 Sep 2008 14:12:19 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m81BCGMC088396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Sep 2008 14:12:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m81BCGZx027939; Mon, 1 Sep 2008 14:12:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m81BCFI7027938; Mon, 1 Sep 2008 14:12:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 1 Sep 2008 14:12:15 +0300 From: Kostik Belousov To: Andriy Gapon Message-ID: <20080901111215.GS2038@deviant.kiev.zoral.com.ua> References: <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> <48BBC9A3.1050905@icyb.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="I30T0A8abtL/6dyk" Content-Disposition: inline In-Reply-To: <48BBC9A3.1050905@icyb.net.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1Ka7KV-000KcM-1g b997649d9f733daac7082bb6a9bebbbf X-Terabit: YES Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 11:12:21 -0000 --I30T0A8abtL/6dyk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 01, 2008 at 01:53:23PM +0300, Andriy Gapon wrote: > on 01/09/2008 11:45 Kostik Belousov said the following: > >On Mon, Sep 01, 2008 at 11:34:45AM +0300, Andriy Gapon wrote: > >>on 01/09/2008 11:10 David Xu said the following: > >>>The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test > >>>thread_flag as a boolean value, because pt_iterate_phdr() tries to > >>>lock two locks at same time, this test will always fail once it > >>>acquired first lock. > >>> > >>>The following silly patch fixes the problem Andriy encountered: > >>I can confirm - this fixed the issue for me. > >>David, thanks! > > > >Does libc_r still work with patch applied ? >=20 > In what sense? > The test program that I posted seems to hang in both cases (patched and= =20 > unpatched rtld). The David' patch changes the code used to support libc_r operations. Even on CURRENT, if you run 4.x-compiled binary with the support of compat-4x libraries, this code from /libexec/ld-elf.so.1 (installed by CURRENT buildworld) provides locking for rtld. --I30T0A8abtL/6dyk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki7zg8ACgkQC3+MBN1Mb4gT7ACcDy0jhMtJwBDPwvaJM+fRm8fW 4dUAn08j/3qJf8x59JTuJr01uJ4AXJPl =fZwf -----END PGP SIGNATURE----- --I30T0A8abtL/6dyk-- From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 12:17:51 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75434106567C; Mon, 1 Sep 2008 12:17:51 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id DE63B8FC13; Mon, 1 Sep 2008 12:17:50 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 6144E43F5D5; Mon, 1 Sep 2008 15:17:48 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pvh1Y6pQ1uog; Mon, 1 Sep 2008 15:17:48 +0300 (EEST) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [91.198.50.114]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id BBA9643F3B0; Mon, 1 Sep 2008 15:17:47 +0300 (EEST) Message-ID: <48BBDD6A.60002@icyb.net.ua> Date: Mon, 01 Sep 2008 15:17:46 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.16 (X11/20080805) MIME-Version: 1.0 To: Kostik Belousov References: <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> <48BBC9A3.1050905@icyb.net.ua> <20080901111215.GS2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20080901111215.GS2038@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 12:17:51 -0000 on 01/09/2008 14:12 Kostik Belousov said the following: > On Mon, Sep 01, 2008 at 01:53:23PM +0300, Andriy Gapon wrote: >> on 01/09/2008 11:45 Kostik Belousov said the following: >>> On Mon, Sep 01, 2008 at 11:34:45AM +0300, Andriy Gapon wrote: >>>> on 01/09/2008 11:10 David Xu said the following: >>>>> The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test >>>>> thread_flag as a boolean value, because pt_iterate_phdr() tries to >>>>> lock two locks at same time, this test will always fail once it >>>>> acquired first lock. >>>>> >>>>> The following silly patch fixes the problem Andriy encountered: >>>> I can confirm - this fixed the issue for me. >>>> David, thanks! >>> Does libc_r still work with patch applied ? >> In what sense? >> The test program that I posted seems to hang in both cases (patched and >> unpatched rtld). > > The David' patch changes the code used to support libc_r operations. > Even on CURRENT, if you run 4.x-compiled binary with the support of > compat-4x libraries, this code from /libexec/ld-elf.so.1 (installed > by CURRENT buildworld) provides locking for rtld. I understand, but I am not sure what exactly needs to be tested. "Still works" is too broad in this context. -- Andriy Gapon From owner-freebsd-threads@FreeBSD.ORG Mon Sep 1 13:17:32 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F1751065687; Mon, 1 Sep 2008 13:17:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 104A88FC0C; Mon, 1 Sep 2008 13:17:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Ka9He-0006H8-5m; Mon, 01 Sep 2008 16:17:30 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m81DHOlX094809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Sep 2008 16:17:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m81DHOum059710; Mon, 1 Sep 2008 16:17:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m81DHOTP059708; Mon, 1 Sep 2008 16:17:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 1 Sep 2008 16:17:24 +0300 From: Kostik Belousov To: Andriy Gapon Message-ID: <20080901131724.GT2038@deviant.kiev.zoral.com.ua> References: <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> <48BBC9A3.1050905@icyb.net.ua> <20080901111215.GS2038@deviant.kiev.zoral.com.ua> <48BBDD6A.60002@icyb.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RNYIsZSUNfbU4BwD" Content-Disposition: inline In-Reply-To: <48BBDD6A.60002@icyb.net.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1Ka9He-0006H8-5m 137736f5624a20ffa2016f9b13e37d67 X-Terabit: YES Cc: Daniel Eischen , David Xu , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 13:17:32 -0000 --RNYIsZSUNfbU4BwD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 01, 2008 at 03:17:46PM +0300, Andriy Gapon wrote: > on 01/09/2008 14:12 Kostik Belousov said the following: > > On Mon, Sep 01, 2008 at 01:53:23PM +0300, Andriy Gapon wrote: =2E.. > >>>>> The following silly patch fixes the problem Andriy encountered: > >>>> I can confirm - this fixed the issue for me. > >>>> David, thanks! > >>> Does libc_r still work with patch applied ? > >> In what sense? > >> The test program that I posted seems to hang in both cases (patched an= d=20 > >> unpatched rtld). > >=20 > > The David' patch changes the code used to support libc_r operations. > > Even on CURRENT, if you run 4.x-compiled binary with the support of > > compat-4x libraries, this code from /libexec/ld-elf.so.1 (installed > > by CURRENT buildworld) provides locking for rtld. >=20 > I understand, but I am not sure what exactly needs to be tested. > "Still works" is too broad in this context. I am not sure too. As I said, this one of the reason I prefered to not touch that code. --RNYIsZSUNfbU4BwD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki762MACgkQC3+MBN1Mb4jjMgCgvWiorSf327afcIY4RM3VcqxC 6HkAni0iXfBlQ7pnrrOnwCE7HJjcjgp8 =ss2O -----END PGP SIGNATURE----- --RNYIsZSUNfbU4BwD-- From owner-freebsd-threads@FreeBSD.ORG Tue Sep 2 01:36:37 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E66211065676; Tue, 2 Sep 2008 01:36:37 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CC2868FC19; Tue, 2 Sep 2008 01:36:37 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m821aZtZ052213; Tue, 2 Sep 2008 01:36:36 GMT (envelope-from davidxu@freebsd.org) Message-ID: <48BC990C.9020208@freebsd.org> Date: Tue, 02 Sep 2008 09:38:20 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Kostik Belousov References: <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> <48BBC9A3.1050905@icyb.net.ua> <20080901111215.GS2038@deviant.kiev.zoral.com.ua> <48BBDD6A.60002@icyb.net.ua> <20080901131724.GT2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20080901131724.GT2038@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , Andriy Gapon , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2008 01:36:38 -0000 Kostik Belousov wrote: > On Mon, Sep 01, 2008 at 03:17:46PM +0300, Andriy Gapon wrote: >> on 01/09/2008 14:12 Kostik Belousov said the following: >>> On Mon, Sep 01, 2008 at 01:53:23PM +0300, Andriy Gapon wrote: > ... >>>>>>> The following silly patch fixes the problem Andriy encountered: >>>>>> I can confirm - this fixed the issue for me. >>>>>> David, thanks! >>>>> Does libc_r still work with patch applied ? >>>> In what sense? >>>> The test program that I posted seems to hang in both cases (patched and >>>> unpatched rtld). >>> The David' patch changes the code used to support libc_r operations. >>> Even on CURRENT, if you run 4.x-compiled binary with the support of >>> compat-4x libraries, this code from /libexec/ld-elf.so.1 (installed >>> by CURRENT buildworld) provides locking for rtld. >> I understand, but I am not sure what exactly needs to be tested. >> "Still works" is too broad in this context. > > I am not sure too. As I said, this one of the reason I prefered to not > touch that code. It should not affect other code outside the rtld. In fact, this patch fixes the maintenance of synchronization between locks and thread_flag. In current code, if you acquire a rwlock, and then acquire second rwlock, the first one will work, but acquiring second lock will fail and thread_flag is out of sync, this results bit flag leaking in thread_flag, and later a _rtld_thread_init() call will transfer the unlocked rwlock state to libthr as locked state, also the existing code does not distinguish reader lock and writer lock, it blindly transfer lock state as write-lock, fortunately, in correct case, it should not be called with any lock held, so the transferring does not occur. Another question is why should dl_iterate_phdr() use exclusive lock ? doesn't this cause all C++ exception to be executed in serialization manner ? Regards, David Xu From owner-freebsd-threads@FreeBSD.ORG Tue Sep 2 13:59:14 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9972B1065694; Tue, 2 Sep 2008 13:59:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 370108FC1B; Tue, 2 Sep 2008 13:59:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KaWPY-0005jk-5N; Tue, 02 Sep 2008 16:59:12 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m82Dx8TU097967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Sep 2008 16:59:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m82Dx8kW056417; Tue, 2 Sep 2008 16:59:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m82Dx722056414; Tue, 2 Sep 2008 16:59:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 Sep 2008 16:59:07 +0300 From: Kostik Belousov To: David Xu Message-ID: <20080902135907.GX2038@deviant.kiev.zoral.com.ua> References: <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org> <48BBA925.1000303@icyb.net.ua> <20080901084548.GQ2038@deviant.kiev.zoral.com.ua> <48BBC9A3.1050905@icyb.net.ua> <20080901111215.GS2038@deviant.kiev.zoral.com.ua> <48BBDD6A.60002@icyb.net.ua> <20080901131724.GT2038@deviant.kiev.zoral.com.ua> <48BC990C.9020208@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Wk+D4bxjv0bBail9" Content-Disposition: inline In-Reply-To: <48BC990C.9020208@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KaWPY-0005jk-5N a083fdc56fbcc8f6eb225f13e688c036 X-Terabit: YES Cc: Daniel Eischen , Andriy Gapon , freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2008 13:59:14 -0000 --Wk+D4bxjv0bBail9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 02, 2008 at 09:38:20AM +0800, David Xu wrote: > Kostik Belousov wrote: > >On Mon, Sep 01, 2008 at 03:17:46PM +0300, Andriy Gapon wrote: > >>on 01/09/2008 14:12 Kostik Belousov said the following: > >>>On Mon, Sep 01, 2008 at 01:53:23PM +0300, Andriy Gapon wrote: > >... > >>>>>>>The following silly patch fixes the problem Andriy encountered: > >>>>>>I can confirm - this fixed the issue for me. > >>>>>>David, thanks! > >>>>>Does libc_r still work with patch applied ? > >>>>In what sense? > >>>>The test program that I posted seems to hang in both cases (patched a= nd=20 > >>>>unpatched rtld). > >>>The David' patch changes the code used to support libc_r operations. > >>>Even on CURRENT, if you run 4.x-compiled binary with the support of > >>>compat-4x libraries, this code from /libexec/ld-elf.so.1 (installed > >>>by CURRENT buildworld) provides locking for rtld. > >>I understand, but I am not sure what exactly needs to be tested. > >>"Still works" is too broad in this context. > > > >I am not sure too. As I said, this one of the reason I prefered to not > >touch that code. >=20 > It should not affect other code outside the rtld. In fact, this patch > fixes the maintenance of synchronization between locks and thread_flag. > In current code, if you acquire a rwlock, and then acquire second > rwlock, the first one will work, but acquiring second lock will fail > and thread_flag is out of sync, this results bit flag leaking in > thread_flag, and later a _rtld_thread_init() call will transfer the > unlocked rwlock state to libthr as locked state, also the existing > code does not distinguish reader lock and writer lock, it blindly=20 > transfer lock state as write-lock, fortunately, in correct case, > it should not be called with any lock held, so the transferring > does not occur. Yes, I understand this. And, this code is used when threading implementation is provided by libc_r, see above. I have no objection against that patch, but I think that it shall be verified whether compat-4x threaded programs work correctly with the change. > Another question is why should dl_iterate_phdr() use exclusive lock ? > doesn't this cause all C++ exception to be executed in serialization > manner ? It is required by C++ runtime. See the commit log for r178807. --Wk+D4bxjv0bBail9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki9RqsACgkQC3+MBN1Mb4iTcQCgnkiWRz0LubydR3GBUgg+aKnV sFwAoOsJyPFdUXasAwocFjj1MUaI7vCA =OJp8 -----END PGP SIGNATURE----- --Wk+D4bxjv0bBail9-- From owner-freebsd-threads@FreeBSD.ORG Wed Sep 3 01:10:05 2008 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C04E41066A13 for ; Wed, 3 Sep 2008 01:10:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B1C998FC0A for ; Wed, 3 Sep 2008 01:10:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m831A5BQ054051 for ; Wed, 3 Sep 2008 01:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m831A5pO054050; Wed, 3 Sep 2008 01:10:05 GMT (envelope-from gnats) Date: Wed, 3 Sep 2008 01:10:05 GMT Message-Id: <200809030110.m831A5pO054050@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: threads/126950: commit references a PR X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2008 01:10:05 -0000 The following reply was made to PR threads/126950; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/126950: commit references a PR Date: Wed, 3 Sep 2008 01:05:59 +0000 (UTC) kan 2008-09-03 01:05:32 UTC FreeBSD src repository Modified files: libexec/rtld-elf rtld.c Log: SVN rev 182698 on 2008-09-03 01:05:32Z by kan Make sure internal rtld malloc routines are not called from unlocked contexts as rtld's malloc is not thread safe and is only supposed to be called with exclusive bind lock already held. The originating PR submitted a patch on top of different pre-requisite workaroud for unsafe dlopen calls, and the patch was midief slighlty to apply to stock sources for the purpose of this commit. Running rtld malloc from unlocked contexts is a bug on its own. PR: 126950 Submited by: Oleg Dolgov Revision Changes Path 1.127 +17 -14 src/libexec/rtld-elf/rtld.c _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" From owner-freebsd-threads@FreeBSD.ORG Thu Sep 4 23:43:13 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 186BD1065676 for ; Thu, 4 Sep 2008 23:43:13 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outR.internet-mail-service.net (outr.internet-mail-service.net [216.240.47.241]) by mx1.freebsd.org (Postfix) with ESMTP id 03A568FC08 for ; Thu, 4 Sep 2008 23:43:12 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id AC0DA24D7 for ; Thu, 4 Sep 2008 16:29:52 -0700 (PDT) Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 7C8112D605C for ; Thu, 4 Sep 2008 16:29:52 -0700 (PDT) Message-ID: <48C06F77.6000006@elischer.org> Date: Thu, 04 Sep 2008 16:29:59 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: freebsd-threads@freebsd.org References: 488A213F.70105@netapp.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: libpthread and gdbserver X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2008 23:43:13 -0000 just saw youe email to freebsd-threads... ----- But pt_ta_map_lwp2thr() internally calls pt_ta_map_id2thr() in libthr_db.c so 'pid to tid' conversion is missing. If FreeBsd intends to keep it this way, I will have to modify gdbserver to not use 'pid' to find threads as Linux does. Can someone shed some light on this? Am I mailing the correct mailing-list with these queries? ----- you might try directly mailing davidxu or marcel or jhb (all @freebsd.org). they SHOULD have seen that posting but may not have.. jhb is I think away for a few days. but was doing stuff with the debugger quite recently. From owner-freebsd-threads@FreeBSD.ORG Fri Sep 5 01:56:40 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4398106568E for ; Fri, 5 Sep 2008 01:56:40 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D4C128FC0A; Fri, 5 Sep 2008 01:56:40 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m851udqh079261; Fri, 5 Sep 2008 01:56:40 GMT (envelope-from davidxu@freebsd.org) Message-ID: <48C0923F.6080608@freebsd.org> Date: Fri, 05 Sep 2008 09:58:23 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Julian Elischer References: 488A213F.70105@netapp.com <48C06F77.6000006@elischer.org> In-Reply-To: <48C06F77.6000006@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: libpthread and gdbserver X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 01:56:41 -0000 Julian Elischer wrote: > just saw youe email to freebsd-threads... > > > ----- > > But pt_ta_map_lwp2thr() internally calls pt_ta_map_id2thr() in > libthr_db.c so 'pid to tid' conversion is missing. > If FreeBsd intends to keep it this way, I will have to modify gdbserver > to not use 'pid' to find threads as Linux does. > Can someone shed some light on this? Am I mailing the correct > mailing-list with these queries? > > ----- > > you might try directly mailing davidxu or marcel or jhb (all > @freebsd.org). they SHOULD have seen that posting but may not have.. > > jhb is I think away for a few days. > but was doing stuff with the debugger quite recently. > Our thread has its kernel thread id, it is called lwpid, this is not linux like pid, I know linux thread is a special process. From owner-freebsd-threads@FreeBSD.ORG Fri Sep 5 02:08:39 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49196106564A for ; Fri, 5 Sep 2008 02:08:39 +0000 (UTC) (envelope-from fernando@schapachnik.com.ar) Received: from servidor1.cursosvirtuales.com.ar (www.cursosvirtuales.com.ar [200.59.46.198]) by mx1.freebsd.org (Postfix) with ESMTP id BC25E8FC1D for ; Fri, 5 Sep 2008 02:08:37 +0000 (UTC) (envelope-from fernando@schapachnik.com.ar) Received: from servidor1.cursosvirtuales.com.ar (localhost.cursosvirtuales.com.ar [127.0.0.1]) by servidor1.cursosvirtuales.com.ar (8.14.2/8.14.2) with ESMTP id m851kIoX014050 for ; Thu, 4 Sep 2008 22:46:18 -0300 (ART) (envelope-from fernando@schapachnik.com.ar) Received: from schapachnik.com.ar (uucp@localhost) by servidor1.cursosvirtuales.com.ar (8.14.2/8.14.2/Submit) with UUCP id m851kIpt014049 for freebsd-threads@freebsd.org; Thu, 4 Sep 2008 22:46:18 -0300 (ART) (envelope-from fernando@schapachnik.com.ar) Received: from funes.schapachnik.com.ar (localhost [127.0.0.1]) by funes.schapachnik.com.ar (8.14.2/8.14.2) with ESMTP id m851kFjv001292 for ; Thu, 4 Sep 2008 22:46:15 -0300 (ART) (envelope-from fernando@schapachnik.com.ar) Received: (from fpscha@localhost) by funes.schapachnik.com.ar (8.14.2/8.14.2/Submit) id m851kAhp001284 for freebsd-threads@freebsd.org; Thu, 4 Sep 2008 22:46:10 -0300 (ART) (envelope-from fernando@schapachnik.com.ar) X-Authentication-Warning: funes.schapachnik.com.ar: fpscha set sender to fernando@schapachnik.com.ar using -f Date: Thu, 4 Sep 2008 22:46:10 -0300 From: Fernando Schapachnik To: freebsd-threads@freebsd.org Message-ID: <20080905014610.GC1070@funes.schapachnik.com.ar> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-OS: FreeBSD 6.3 - http://www.freebsd.org Subject: Profiling X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 02:08:39 -0000 Hi, I'm developing a highly concurrent, speed oriented, pthread application and would like to obtain some insight in time spent on mutexes, contention, etc. Any good tool for FreeBSD 7? Thanks! Fernando P. Schapachnik fernando@schapachnik.com.ar From owner-freebsd-threads@FreeBSD.ORG Fri Sep 5 02:08:50 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C87B11065672 for ; Fri, 5 Sep 2008 02:08:50 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outQ.internet-mail-service.net (outq.internet-mail-service.net [216.240.47.240]) by mx1.freebsd.org (Postfix) with ESMTP id AFCDB8FC22 for ; Fri, 5 Sep 2008 02:08:50 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 9B18F24C2; Thu, 4 Sep 2008 19:08:50 -0700 (PDT) Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id D8D462D6015; Thu, 4 Sep 2008 19:08:49 -0700 (PDT) Message-ID: <48C094B8.3050302@elischer.org> Date: Thu, 04 Sep 2008 19:08:56 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: David Xu References: 488A213F.70105@netapp.com <48C06F77.6000006@elischer.org> <48C0923F.6080608@freebsd.org> In-Reply-To: <48C0923F.6080608@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: dixit@netapp.com, freebsd-threads@freebsd.org Subject: Re: libpthread and gdbserver X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 02:08:50 -0000 the actual question was from dixit @ netapp.com but for some reason it didn't appear on this email.. David Xu wrote: > Julian Elischer wrote: >> just saw youe email to freebsd-threads... >> >> >> ----- >> >> But pt_ta_map_lwp2thr() internally calls pt_ta_map_id2thr() in >> libthr_db.c so 'pid to tid' conversion is missing. >> If FreeBsd intends to keep it this way, I will have to modify gdbserver >> to not use 'pid' to find threads as Linux does. >> Can someone shed some light on this? Am I mailing the correct >> mailing-list with these queries? >> >> ----- >> >> you might try directly mailing davidxu or marcel or jhb (all >> @freebsd.org). they SHOULD have seen that posting but may not have.. >> >> jhb is I think away for a few days. >> but was doing stuff with the debugger quite recently. >> > > Our thread has its kernel thread id, it is called lwpid, this is not > linux like pid, I know linux thread is a special process. > > > > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" From owner-freebsd-threads@FreeBSD.ORG Fri Sep 5 02:14:48 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 849E41065676 for ; Fri, 5 Sep 2008 02:14:48 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outC.internet-mail-service.net (outc.internet-mail-service.net [216.240.47.226]) by mx1.freebsd.org (Postfix) with ESMTP id 6F52B8FC1D for ; Fri, 5 Sep 2008 02:14:48 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 4DA582433; Thu, 4 Sep 2008 19:14:48 -0700 (PDT) Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id B6F092D60B2; Thu, 4 Sep 2008 19:14:47 -0700 (PDT) Message-ID: <48C0961E.5000300@elischer.org> Date: Thu, 04 Sep 2008 19:14:54 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: David Xu References: 488A213F.70105@netapp.com <48C06F77.6000006@elischer.org> <48C0923F.6080608@freebsd.org> <48C094B8.3050302@elischer.org> In-Reply-To: <48C094B8.3050302@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org, dixit@netapp.com Subject: Re: libpthread and gdbserver X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 02:14:48 -0000 Julian Elischer wrote: > the actual question was from dixit @ netapp.com > but for some reason it didn't appear on this email.. the origianl question can be seen at: http://lists.freebsd.org/pipermail/freebsd-threads/2008-August/004330.html > > > David Xu wrote: >> Julian Elischer wrote: >>> just saw youe email to freebsd-threads... >>> >>> >>> ----- >>> >>> But pt_ta_map_lwp2thr() internally calls pt_ta_map_id2thr() in >>> libthr_db.c so 'pid to tid' conversion is missing. >>> If FreeBsd intends to keep it this way, I will have to modify gdbserver >>> to not use 'pid' to find threads as Linux does. >>> Can someone shed some light on this? Am I mailing the correct >>> mailing-list with these queries? >>> >>> ----- >>> >>> you might try directly mailing davidxu or marcel or jhb (all >>> @freebsd.org). they SHOULD have seen that posting but may not have.. >>> >>> jhb is I think away for a few days. >>> but was doing stuff with the debugger quite recently. >>> >> >> Our thread has its kernel thread id, it is called lwpid, this is not >> linux like pid, I know linux thread is a special process. >> >> >> >> _______________________________________________ >> freebsd-threads@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-threads >> To unsubscribe, send any mail to >> "freebsd-threads-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org"