From owner-freebsd-threads@FreeBSD.ORG Sun Nov 23 08:11:39 2003 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 631AA16A4CE for ; Sun, 23 Nov 2003 08:11:39 -0800 (PST) Received: from ray.idi.ntnu.no (ray.idi.ntnu.no [129.241.107.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id A2B7843F93 for ; Sun, 23 Nov 2003 08:11:37 -0800 (PST) (envelope-from morten@rodal.no) Received: from hauk10.idi.ntnu.no (hauk10.idi.ntnu.no [129.241.102.222]) by ray.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hANGBXDG023072; Sun, 23 Nov 2003 17:11:33 +0100 (MET) Received: from rodal.no (localhost [127.0.0.1]) by hauk10.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hANGBWkX000286; Sun, 23 Nov 2003 17:11:32 +0100 (CET) (envelope-from morten@rodal.no) Message-ID: <3FC0DC2B.7020602@rodal.no> Date: Sun, 23 Nov 2003 17:11:23 +0100 From: Morten Rodal User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031026 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: X-Enigmail-Version: 0.81.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig254EA64EF15C9AA828B2EDA1" X-Spam-Status: No, hits=-8.9 required=4 X-Virus-Scanned: by amavisd-new-IDI cc: threads@freebsd.org Subject: Re: libkse and bus 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: Sun, 23 Nov 2003 16:11:39 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig254EA64EF15C9AA828B2EDA1 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Daniel Eischen wrote: > On Sun, 19 Oct 2003, Morten Rodal wrote: >>On Sun, Oct 19, 2003 at 02:16:27PM -0400, Daniel Eischen wrote: >>>On Sun, 19 Oct 2003, Morten Rodal wrote: >>>>I seem to be able to crash almost every pthread program that uses >>>>pthread_mutex'es. First I thought it was a problem with >>>>pthread_testcancel(), until I compiled libkse with DEBUG_FLAGS=-g on >>>>one of machines. >>>> >>>>Backtrace from a machine with DEBUG_FLAGS=-g and libkse: >>>> >>>>#0 0x28e6ed1b in kse_thr_interrupt () at {standard input}:15 >>>>#1 0x28e5f990 in _thr_sig_add (pthread=0x81fab00, sig=136293172, >>>>info=0x0) >>>> at /usr/src/lib/libpthread/thread/thr_sig.c:885 >>>>#2 0x28e687cb in kse_check_completed (kse=0x81fab00) >>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1558 >>>>#3 0x28e6721c in kse_sched_multi (kmbx=0x17e) >>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1021 >>> >>>This is a problem. The mailbox pointer is invalid. >>> >> >>I thought it looked a bit strange. Any clues to what might have >>caused this? > > > When I've seen it before, it's when %gs becomes corrupted. Nvidia > uses static ldt allocation and this can screw things up. If you > are getting any static ldt allocations out of the kernel, that is > the problem. > I hate to rip up in old mails, but I am now able to crash Mozilla Firebird at command. It dies with the same strange traceback as I got with dc++ (which this thread originally addressed). When ordering a airplane ticket from www.scandinavian.net Mozilla Firebird will crash when confirming the payment with a signal 10. This happens on three completly different computers; * Dual Pentium II 300MHz, libkse, kernel from Nov 19 * Pentium III 933MHz, libkse, kernel from Nov 3 * Pentium 4 1.7GHz, libkse, kernel from Nov 21 Only the Dual Pentium is running nvidia drivers. The others are running X11 drivers. All of them produce a MozillaFirebird-bin.core which has this backtrace (cut down to an absolute minimum since it is rather huge): #0 0x288c2ebb in pthread_testcancel () from /usr/lib/libkse.so.1 #1 0x288bc91b in pthread_mutexattr_init () from /usr/lib/libkse.so.1 #2 0x288bb36c in pthread_mutexattr_init () from /usr/lib/libkse.so.1 #3 0x09b8d000 in ?? () #4 0x283c5cac in gtk_widget_hide () from /usr/X11R6/lib/libgtk-x11-2.0.so.200 I will recompile libkse with DEBUG_FLAGS=-g and see if I cant get any more accurate info than this. -- Morten Rodal --------------enig254EA64EF15C9AA828B2EDA1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/wNwzbWe1Cy11WVsRAvoCAJoCePBDjtyqicD6m1sMb7yyiPRNNACfZBCd AkNVH9abMbXyKsUfZ6a4E3Q= =lLfq -----END PGP SIGNATURE----- --------------enig254EA64EF15C9AA828B2EDA1-- From owner-freebsd-threads@FreeBSD.ORG Sun Nov 23 08:23:30 2003 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 3C18016A4CE for ; Sun, 23 Nov 2003 08:23:30 -0800 (PST) Received: from ray.idi.ntnu.no (ray.idi.ntnu.no [129.241.107.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA27643FDF for ; Sun, 23 Nov 2003 08:23:28 -0800 (PST) (envelope-from morten@rodal.no) Received: from hauk10.idi.ntnu.no (hauk10.idi.ntnu.no [129.241.102.222]) by ray.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hANGNODG024532; Sun, 23 Nov 2003 17:23:25 +0100 (MET) Received: from rodal.no (localhost [127.0.0.1]) by hauk10.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hANGNOkX001836; Sun, 23 Nov 2003 17:23:24 +0100 (CET) (envelope-from morten@rodal.no) Message-ID: <3FC0DEF5.7040908@rodal.no> Date: Sun, 23 Nov 2003 17:23:17 +0100 From: Morten Rodal User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031026 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: <3FC0DC2B.7020602@rodal.no> In-Reply-To: <3FC0DC2B.7020602@rodal.no> X-Enigmail-Version: 0.81.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3E5B554BF2E0927E94A7DAE5" X-Spam-Status: No, hits=-8.9 required=4 X-Virus-Scanned: by amavisd-new-IDI cc: threads@freebsd.org Subject: Re: libkse and bus 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: Sun, 23 Nov 2003 16:23:30 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3E5B554BF2E0927E94A7DAE5 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Morten Rodal wrote: > Daniel Eischen wrote: > >> On Sun, 19 Oct 2003, Morten Rodal wrote: >> >>> On Sun, Oct 19, 2003 at 02:16:27PM -0400, Daniel Eischen wrote: >>> >>>> On Sun, 19 Oct 2003, Morten Rodal wrote: >>>> >>>>> I seem to be able to crash almost every pthread program that uses >>>>> pthread_mutex'es. First I thought it was a problem with >>>>> pthread_testcancel(), until I compiled libkse with DEBUG_FLAGS=-g on >>>>> one of machines. >>>>> >>>>> Backtrace from a machine with DEBUG_FLAGS=-g and libkse: >>>>> >>>>> #0 0x28e6ed1b in kse_thr_interrupt () at {standard input}:15 >>>>> #1 0x28e5f990 in _thr_sig_add (pthread=0x81fab00, sig=136293172, >>>>> info=0x0) >>>>> at /usr/src/lib/libpthread/thread/thr_sig.c:885 >>>>> #2 0x28e687cb in kse_check_completed (kse=0x81fab00) >>>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1558 >>>>> #3 0x28e6721c in kse_sched_multi (kmbx=0x17e) >>>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1021 >>>> >>>> >>>> This is a problem. The mailbox pointer is invalid. >>>> >>> >>> I thought it looked a bit strange. Any clues to what might have >>> caused this? >> >> >> >> When I've seen it before, it's when %gs becomes corrupted. Nvidia >> uses static ldt allocation and this can screw things up. If you >> are getting any static ldt allocations out of the kernel, that is >> the problem. >> > > I hate to rip up in old mails, but I am now able to crash Mozilla > Firebird at command. It dies with the same strange traceback as I got > with dc++ (which this thread originally addressed). > > When ordering a airplane ticket from www.scandinavian.net Mozilla > Firebird will crash when confirming the payment with a signal 10. This > happens on three completly different computers; > > * Dual Pentium II 300MHz, libkse, kernel from Nov 19 > * Pentium III 933MHz, libkse, kernel from Nov 3 > * Pentium 4 1.7GHz, libkse, kernel from Nov 21 > > Only the Dual Pentium is running nvidia drivers. The others are running > X11 drivers. > > All of them produce a MozillaFirebird-bin.core which has this backtrace > (cut down to an absolute minimum since it is rather huge): > > #0 0x288c2ebb in pthread_testcancel () from /usr/lib/libkse.so.1 > #1 0x288bc91b in pthread_mutexattr_init () from /usr/lib/libkse.so.1 > #2 0x288bb36c in pthread_mutexattr_init () from /usr/lib/libkse.so.1 > #3 0x09b8d000 in ?? () > #4 0x283c5cac in gtk_widget_hide () from > /usr/X11R6/lib/libgtk-x11-2.0.so.200 > > I will recompile libkse with DEBUG_FLAGS=-g and see if I cant get any > more accurate info than this. > Backtrace with debugging symbols in libkse: #0 0x288c2f4b in kse_thr_interrupt () at /var/tmp//cc4HnJI9.s:15 #1 0x288b3b3d in _thr_sig_add (pthread=0x805e000, sig=134574132, info=0x0) at /usr/src/lib/libpthread/thread/thr_sig.c:885 #2 0x288bc9ab in kse_check_completed (kse=0x8057000) at /usr/src/lib/libpthread/thread/thr_kern.c:1558 #3 0x288bb3fc in kse_sched_multi (kmbx=0x17e) at /usr/src/lib/libpthread/thread/thr_kern.c:1021 #4 0x08287000 in ?? () #5 0x283c5cac in gtk_widget_hide () from /usr/X11R6/lib/libgtk-x11-2.0.so.200 This is taken from the Pentium III machine, which has a ATI card with X11 drivers. I have never seen any mention of usage of static ldt entries in the dmesg. -- Morten Rodal --------------enig3E5B554BF2E0927E94A7DAE5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/wN78bWe1Cy11WVsRAgrRAKCVVHQwpa1lcXywHtGULmkTRtBVRwCgp6t4 X2s8cspQz2cp6ay2AQtsvMU= =E51E -----END PGP SIGNATURE----- --------------enig3E5B554BF2E0927E94A7DAE5-- From owner-freebsd-threads@FreeBSD.ORG Sun Nov 23 10:48:41 2003 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 83FEC16A4CF for ; Sun, 23 Nov 2003 10:48:41 -0800 (PST) Received: from maxwell.syr.edu (maxwell.syr.edu [128.230.129.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 81C7943FBD for ; Sun, 23 Nov 2003 10:48:40 -0800 (PST) (envelope-from cmsedore@maxwell.syr.edu) Received: from exchange.maxwell.syr.edu (excluster2.maxwell.syr.edu [128.230.129.231]) by maxwell.syr.edu (8.12.10/8.9.1) with ESMTP id hANImco2037975; Sun, 23 Nov 2003 13:48:38 -0500 (EST) X-MIMEOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Sun, 23 Nov 2003 13:45:58 -0500 Message-ID: <32A8B2CB12BFC84D8D11D872C787AA9A515D9A@EXCHANGE.forest.maxwell.syr.edu> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: libkse and bus error Thread-Index: AcOx3lNyaj7BVP9PRceX72hJcgaSVAAE7WmY From: "Christopher M. Sedore" To: "Morten Rodal" , "Daniel Eischen" cc: threads@freebsd.org Subject: RE: libkse and bus 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: Sun, 23 Nov 2003 18:48:41 -0000 As a separate data point, I'm seeing occasional bus errors on some of my = own code, also in pthread_testcancel. If I could find a way to = reproduce it, I'd post, but there I haven't found any consistent way to = make it happen. =20 -Chris ________________________________ From: owner-freebsd-threads@freebsd.org on behalf of Morten Rodal Sent: Sun 11/23/2003 11:23 AM To: Daniel Eischen Cc: threads@freebsd.org Subject: Re: libkse and bus error Morten Rodal wrote:=20 > Daniel Eischen wrote:=20 >=20 >> On Sun, 19 Oct 2003, Morten Rodal wrote:=20 >>=20 >>> On Sun, Oct 19, 2003 at 02:16:27PM -0400, Daniel Eischen wrote:=20 >>>=20 >>>> On Sun, 19 Oct 2003, Morten Rodal wrote:=20 >>>>=20 >>>>> I seem to be able to crash almost every pthread program that uses=20 >>>>> pthread_mutex'es. First I thought it was a problem with=20 >>>>> pthread_testcancel(), until I compiled libkse with = DEBUG_FLAGS=3D-g on=20 >>>>> one of machines.=20 >>>>>=20 >>>>> Backtrace from a machine with DEBUG_FLAGS=3D-g and libkse:=20 >>>>>=20 >>>>> #0 0x28e6ed1b in kse_thr_interrupt () at {standard input}:15=20 >>>>> #1 0x28e5f990 in _thr_sig_add (pthread=3D0x81fab00, = sig=3D136293172,=20 >>>>> info=3D0x0)=20 >>>>> at /usr/src/lib/libpthread/thread/thr_sig.c:885=20 >>>>> #2 0x28e687cb in kse_check_completed (kse=3D0x81fab00)=20 >>>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1558=20 >>>>> #3 0x28e6721c in kse_sched_multi (kmbx=3D0x17e)=20 >>>>> at /usr/src/lib/libpthread/thread/thr_kern.c:1021=20 >>>>=20 >>>>=20 >>>> This is a problem. The mailbox pointer is invalid.=20 >>>>=20 >>>=20 >>> I thought it looked a bit strange. Any clues to what might have=20 >>> caused this?=20 >>=20 >>=20 >>=20 >> When I've seen it before, it's when %gs becomes corrupted. Nvidia=20 >> uses static ldt allocation and this can screw things up. If you=20 >> are getting any static ldt allocations out of the kernel, that is=20 >> the problem.=20 >>=20 >=20 > I hate to rip up in old mails, but I am now able to crash Mozilla=20 > Firebird at command. It dies with the same strange traceback as I got = > with dc++ (which this thread originally addressed).=20 >=20 > When ordering a airplane ticket from www.scandinavian.net Mozilla=20 > Firebird will crash when confirming the payment with a signal 10. This = > happens on three completly different computers;=20 >=20 > * Dual Pentium II 300MHz, libkse, kernel from Nov 19=20 > * Pentium III 933MHz, libkse, kernel from Nov 3=20 > * Pentium 4 1.7GHz, libkse, kernel from Nov 21=20 >=20 > Only the Dual Pentium is running nvidia drivers. The others are = running=20 > X11 drivers.=20 >=20 > All of them produce a MozillaFirebird-bin.core which has this = backtrace=20 > (cut down to an absolute minimum since it is rather huge):=20 >=20 > #0 0x288c2ebb in pthread_testcancel () from /usr/lib/libkse.so.1=20 > #1 0x288bc91b in pthread_mutexattr_init () from /usr/lib/libkse.so.1=20 > #2 0x288bb36c in pthread_mutexattr_init () from /usr/lib/libkse.so.1=20 > #3 0x09b8d000 in ?? ()=20 > #4 0x283c5cac in gtk_widget_hide () from=20 > /usr/X11R6/lib/libgtk-x11-2.0.so.200=20 >=20 > I will recompile libkse with DEBUG_FLAGS=3D-g and see if I cant get = any=20 > more accurate info than this.=20 >=20 Backtrace with debugging symbols in libkse:=20 #0 0x288c2f4b in kse_thr_interrupt () at /var/tmp//cc4HnJI9.s:15=20 #1 0x288b3b3d in _thr_sig_add (pthread=3D0x805e000, sig=3D134574132, = info=3D0x0)=20 at /usr/src/lib/libpthread/thread/thr_sig.c:885=20 #2 0x288bc9ab in kse_check_completed (kse=3D0x8057000)=20 at /usr/src/lib/libpthread/thread/thr_kern.c:1558=20 #3 0x288bb3fc in kse_sched_multi (kmbx=3D0x17e)=20 at /usr/src/lib/libpthread/thread/thr_kern.c:1021=20 #4 0x08287000 in ?? ()=20 #5 0x283c5cac in gtk_widget_hide () from=20 /usr/X11R6/lib/libgtk-x11-2.0.so.200=20 This is taken from the Pentium III machine, which has a ATI card with=20 X11 drivers. I have never seen any mention of usage of static ldt=20 entries in the dmesg.=20 --=20 Morten Rodal=20 From owner-freebsd-threads@FreeBSD.ORG Sun Nov 23 15:41:54 2003 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 D782E16A4F2; Sun, 23 Nov 2003 15:41:54 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6560E440D7; Sun, 23 Nov 2003 15:41:20 -0800 (PST) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hANNfIFY009574; Sun, 23 Nov 2003 15:41:19 -0800 (PST) (envelope-from davidxu@freebsd.org) Message-ID: <3FC14842.7040605@freebsd.org> Date: Mon, 24 Nov 2003 07:52:34 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031025 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Morten Rodal References: <3FC0DC2B.7020602@rodal.no> In-Reply-To: <3FC0DC2B.7020602@rodal.no> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: libkse and bus 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: Sun, 23 Nov 2003 23:41:55 -0000 Morten Rodal wrote: >I hate to rip up in old mails, but I am now able to crash Mozilla >Firebird at command. It dies with the same strange traceback as I got >with dc++ (which this thread originally addressed). > >When ordering a airplane ticket from www.scandinavian.net Mozilla >Firebird will crash when confirming the payment with a signal 10. This >happens on three completly different computers; > > * Dual Pentium II 300MHz, libkse, kernel from Nov 19 > * Pentium III 933MHz, libkse, kernel from Nov 3 > * Pentium 4 1.7GHz, libkse, kernel from Nov 21 > >Only the Dual Pentium is running nvidia drivers. The others are running > >X11 drivers. > >All of them produce a MozillaFirebird-bin.core which has this backtrace >(cut down to an absolute minimum since it is rather huge): > >#0 0x288c2ebb in pthread_testcancel () from /usr/lib/libkse.so.1 >#1 0x288bc91b in pthread_mutexattr_init () from /usr/lib/libkse.so.1 >#2 0x288bb36c in pthread_mutexattr_init () from /usr/lib/libkse.so.1 >#3 0x09b8d000 in ?? () >#4 0x283c5cac in gtk_widget_hide () from >/usr/X11R6/lib/libgtk-x11-2.0.so.200 > >I will recompile libkse with DEBUG_FLAGS=-g and see if I cant get any >more accurate info than this. > > > Make sure you have up-to-date libpthread source code, there was a FPU bug fixed for sometimes. David Xu From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 00:24:11 2003 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 4765516A4CE; Mon, 24 Nov 2003 00:24:11 -0800 (PST) Received: from ray.idi.ntnu.no (ray.idi.ntnu.no [129.241.107.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6080143FBF; Mon, 24 Nov 2003 00:24:09 -0800 (PST) (envelope-from morten@rodal.no) Received: from hauk10.idi.ntnu.no (hauk10.idi.ntnu.no [129.241.102.222]) by ray.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hAO8O5DG012463; Mon, 24 Nov 2003 09:24:05 +0100 (MET) Received: from rodal.no (localhost [127.0.0.1]) by hauk10.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hAO8O4kX006413; Mon, 24 Nov 2003 09:24:04 +0100 (CET) (envelope-from morten@rodal.no) Message-ID: <3FC1C01A.4020407@rodal.no> Date: Mon, 24 Nov 2003 09:23:54 +0100 From: Morten Rodal User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031026 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <3FC0DC2B.7020602@rodal.no> <3FC14842.7040605@freebsd.org> In-Reply-To: <3FC14842.7040605@freebsd.org> X-Enigmail-Version: 0.81.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3DEBAF99D56FF30DE080A04B" X-Spam-Status: No, hits=-8.5 required=4 X-Virus-Scanned: by amavisd-new-IDI cc: threads@freebsd.org Subject: Re: libkse and bus 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: Mon, 24 Nov 2003 08:24:11 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3DEBAF99D56FF30DE080A04B Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit David Xu wrote: > Morten Rodal wrote: >> >> * Dual Pentium II 300MHz, libkse, kernel from Nov 19 >> * Pentium III 933MHz, libkse, kernel from Nov 3 >> * Pentium 4 1.7GHz, libkse, kernel from Nov 21 >> > > Make sure you have up-to-date libpthread source code, there was a FPU bug > fixed for sometimes. > I apologise for not being clear on when the sources were from. What I meant was that these machines was updated (both world and kernel) on the dates specified above. -- Morten Rodal --------------enig3DEBAF99D56FF30DE080A04B Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/wcAkbWe1Cy11WVsRAhpgAKDnvJcOa9mSDPCYjEnOo1LpyspHqACfTYpO oknkMFTNkWMwX1NmCnto2g4= =CCZE -----END PGP SIGNATURE----- --------------enig3DEBAF99D56FF30DE080A04B-- From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 01:09:33 2003 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 12AF316A4CE for ; Mon, 24 Nov 2003 01:09:33 -0800 (PST) Received: from exchhz01.viatech.com.cn (ip-167-164-97-218.anlai.com [218.97.164.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B83343FBD for ; Mon, 24 Nov 2003 01:09:28 -0800 (PST) (envelope-from davidxu@viatech.com.cn) Received: from viatech.com.cn (ip-240-1-168-192.rev.dyxnet.com [192.168.1.240]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id WZMFXMX3; Mon, 24 Nov 2003 16:48:53 +0800 Message-ID: <3FC1CC21.20908@viatech.com.cn> Date: Mon, 24 Nov 2003 17:15:13 +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: Morten Rodal References: <3FC1C01A.4020407@rodal.no> In-Reply-To: <3FC1C01A.4020407@rodal.no> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: libkse and bus 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: Mon, 24 Nov 2003 09:09:33 -0000 Morten Rodal wrote: >David Xu wrote: > > >>Morten Rodal wrote: >> >> >>>* Dual Pentium II 300MHz, libkse, kernel from Nov 19 >>>* Pentium III 933MHz, libkse, kernel from Nov 3 >>>* Pentium 4 1.7GHz, libkse, kernel from Nov 21 >>> >>> >>> >>Make sure you have up-to-date libpthread source code, there was a FPU >> >> >bug > > >>fixed for sometimes. >> >> >> > >I apologise for not being clear on when the sources were from. What I >meant was that these machines was updated (both world and kernel) on the > >dates specified above. > > > How do you use libkse ? I use universal map in /etc/libmap.conf. David Xu From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 01:21:42 2003 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 CF46016A4CE for ; Mon, 24 Nov 2003 01:21:42 -0800 (PST) Received: from ray.idi.ntnu.no (ray.idi.ntnu.no [129.241.107.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 67F1243FE5 for ; Mon, 24 Nov 2003 01:21:41 -0800 (PST) (envelope-from morten@rodal.no) Received: from hauk10.idi.ntnu.no (hauk10.idi.ntnu.no [129.241.102.222]) by ray.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hAO9LbDG021348; Mon, 24 Nov 2003 10:21:37 +0100 (MET) Received: from rodal.no (localhost [127.0.0.1]) by hauk10.idi.ntnu.no (8.12.10/8.12.10) with ESMTP id hAO9LbkX006587; Mon, 24 Nov 2003 10:21:37 +0100 (CET) (envelope-from morten@rodal.no) Message-ID: <3FC1CD9A.8090409@rodal.no> Date: Mon, 24 Nov 2003 10:21:30 +0100 From: Morten Rodal User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031026 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <3FC1C01A.4020407@rodal.no> <3FC1CC21.20908@viatech.com.cn> In-Reply-To: <3FC1CC21.20908@viatech.com.cn> X-Enigmail-Version: 0.81.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig282B968408BD5F8E307E77FC" X-Spam-Status: No, hits=-8.9 required=4 X-Virus-Scanned: by amavisd-new-IDI cc: threads@freebsd.org Subject: Re: libkse and bus 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: Mon, 24 Nov 2003 09:21:42 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig282B968408BD5F8E307E77FC Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit David Xu wrote: > > How do you use libkse ? I use universal map in /etc/libmap.conf. > I use a universal map in /etc/libmap.conf too, but I have reverted back to libc_r at work, since I was stupid enough to upgrade libpthread from Nov 2 without upgrading the kernel.. I'll try to see if libc_r or libthr is able to crash Mozilla Firebird later today. -- Morten Rodal --------------enig282B968408BD5F8E307E77FC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/wc2hbWe1Cy11WVsRAgQuAJ4uOV7I3WHUhkzZDeoYEh+6fWnWjACfVtMU A+rP3J5ORDcj+DMbmlRAN00= =3V9J -----END PGP SIGNATURE----- --------------enig282B968408BD5F8E307E77FC-- From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 01:51:46 2003 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 878EF16A4CE for ; Mon, 24 Nov 2003 01:51:46 -0800 (PST) Received: from sv02.webonaut.com (kirk.webonaut.com [212.41.243.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 29E5343F85 for ; Mon, 24 Nov 2003 01:51:45 -0800 (PST) (envelope-from klammer@webonaut.com) Received: from localhost (localhost [127.0.0.1]) by sv02.webonaut.com (Postfix) with ESMTP id 268F176421 for ; Mon, 24 Nov 2003 10:51:43 +0100 (CET) Received: from sv02.webonaut.com ([127.0.0.1]) by localhost (sv02.webonaut.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18812-07 for ; Mon, 24 Nov 2003 10:51:40 +0100 (CET) Received: from webonaut.com (sisko.webonaut.com [212.41.243.28]) by sv02.webonaut.com (Postfix) with ESMTP id C8F5C7641F for ; Mon, 24 Nov 2003 10:51:40 +0100 (CET) Message-ID: <3FC1D4AD.50700@webonaut.com> Date: Mon, 24 Nov 2003 10:51:41 +0100 From: Franz Klammer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031021 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Threads Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at webonaut.com Subject: Fw: [another gdesklets kse/libc_r problem] 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, 24 Nov 2003 09:51:46 -0000 Hello! I sent the message below to gnome@ and someone tells me that this might here the right list. the python-code who starts the threads is: # Adds and runs a new thread. # def _add_thread(self, threadfunction, *args): # the thread should not start before setup is complete, therefore # we are using the GTK idle handler def run_thread(threadfunction, args): thread.start_new_thread(threadfunction, args) gtk.idle_add(run_thread, threadfunction, args) i'm not subscribed to the list. please add me to the replies. thanks franz. ------- Forwarded Message: ------- at least under -current i've following threads-problem: when a sensor doing commands.getstatusoutput(cmd) out of a thread the first call works like expected, but the second call will result in a deadlock (i think). what i've found in the last days was that it happens while commands.getstatusoutput -> pipe.read() if added a print "1.... "+cmd bevore getstatusoutput and a print "2 ... "+cmd after. heres the output if i start gdesklets from a terminal-window: 1 ... /bin/date '+%a %d %b %y'|iconv -t UTF-8 2 ... /bin/date '+%a %d %b %y'|iconv -t UTF-8 1 ... /bin/date '+%a %d %b %y'|iconv -t UTF-8 ====> hanging here that problem only occours with libc_r but not with libkse. also with libc_r a ps fax | grep gdesklets looks like this: 80390 p4 S+ 0:05,58 python /usr/X11R6/bin/gdesklets 80431 p4 S+ 0:00,00 python /usr/X11R6/bin/gdesklets 80446 p4 S+ 0:00,00 python /usr/X11R6/bin/gdesklets with libkse there is only one line. i'm out of ideas now. franz. From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 06:01:25 2003 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 196B116A4CE; Mon, 24 Nov 2003 06:01:25 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 891C343FCB; Mon, 24 Nov 2003 06:01:23 -0800 (PST) (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 hAOE1M1G012599; Mon, 24 Nov 2003 09:01:22 -0500 (EST) Date: Mon, 24 Nov 2003 09:01:22 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Morten Rodal In-Reply-To: <3FC1C01A.4020407@rodal.no> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org cc: David Xu Subject: Re: libkse and bus 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: Mon, 24 Nov 2003 14:01:25 -0000 On Mon, 24 Nov 2003, Morten Rodal wrote: > David Xu wrote: > > Morten Rodal wrote: > >> > >> * Dual Pentium II 300MHz, libkse, kernel from Nov 19 > >> * Pentium III 933MHz, libkse, kernel from Nov 3 > >> * Pentium 4 1.7GHz, libkse, kernel from Nov 21 > >> > > > > Make sure you have up-to-date libpthread source code, there was a FPU bug > > fixed for sometimes. > > > > I apologise for not being clear on when the sources were from. What I > meant was that these machines was updated (both world and kernel) on the > dates specified above. Also make sure you are not getting static LDT warnings out of the kernel. -- Dan Eischen From owner-freebsd-threads@FreeBSD.ORG Mon Nov 24 11:03:00 2003 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 7D12116A4CE for ; Mon, 24 Nov 2003 11:03:00 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92F5543FBD for ; Mon, 24 Nov 2003 11:01:37 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hAOJ1bFY056265 for ; Mon, 24 Nov 2003 11:01:37 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id hAOJ1aPs056259 for freebsd-threads@freebsd.org; Mon, 24 Nov 2003 11:01:36 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 24 Nov 2003 11:01:36 -0800 (PST) Message-Id: <200311241901.hAOJ1aPs056259@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, 24 Nov 2003 19:03:00 -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 o [2002/01/16] kern/33951 threads pthread_cancel is ignored 2 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/19] 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/04/02] bin/26307 threads libc_r aborts when using the KDE media pl o [2001/10/31] bin/31661 threads pthread_kill signal handler doesn't get s o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] i386/34536 threads accept() blocks other threads o [2002/03/07] bin/35622 threads sigaltstack is missing in libc_r 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 [2002/10/10] kern/43887 threads abnormal CPU useage when use pthread_mute 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 a [2003/04/08] bin/50733 threads buildworld won't build, because of linkin o [2003/05/07] bin/51949 threads thread in accept cannot be cancelled o [2003/05/30] kern/52817 threads top(1) shows garbage for threaded process 19 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/25] 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 o [2002/07/16] misc/40671 threads pthread_cancel doesn't remove thread from 5 problems total. From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 16:26:44 2003 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 7B83116A4CE for ; Wed, 26 Nov 2003 16:26:44 -0800 (PST) Received: from dust.freshx.de (freshx.de [80.190.100.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83C7343FDF for ; Wed, 26 Nov 2003 16:26:41 -0800 (PST) (envelope-from kai@freshx.de) Received: from localhost (localhost.freshx.de [127.0.0.1]) by dust.freshx.de (Postfix) with ESMTP id 5AA2E15E2AE for ; Thu, 27 Nov 2003 01:26:30 +0100 (CET) Received: from localhost (localhost.freshx.de [127.0.0.1]) by dust.freshx.de (Postfix) with ESMTP id 9F6C015E200 for ; Thu, 27 Nov 2003 01:26:29 +0100 (CET) Received: from 127.0.0.1 ( [127.0.0.1]) as user dust0005@localhost by localhost with HTTP; Thu, 27 Nov 2003 01:26:29 +0100 Message-ID: <1069892789.3fc544b58a2d7@localhost> Date: Thu, 27 Nov 2003 01:26:29 +0100 From: "sapdb@komadev.de" To: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.0 X-Virus-Scanned: by AMaViS 0.3.12 Subject: Continous thread ids 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: Thu, 27 Nov 2003 00:26:44 -0000 Hi, i wrote a little thread test programm. when i run it i get an output like ... 10 of 10 threads running, i am 0x8069000 10 of 10 threads running, i am 0x806c000 10 of 10 threads running, i am 0x806f000 ... is there a generic way (not kse dependant), to get a still unique countinous thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a dirty hack, masking out the upper 20 bit, but that seems not to be the way its meant to work huh ? any ideas ? kind regards kai ------------------------------------------------------------ #include #include #include #define MAXTHREADS 10 int i; void *threadedCounter(void *x) { for(int a=0;a<10;a++){ printf("%d of %d threads running, i am 0x%x\n",i,MAXTHREADS,pthread_self ()); sleep(2); } return NULL; } int main(void) { pthread *t; for(i = 0 ; i < MAXTHREADS ; i++) pthread_create(&t,NULL,threadedCounter,NULL); sleep(MAXTHREADS*3+2); return 0; } From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 17:13:35 2003 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 9CD8D16A4CE for ; Wed, 26 Nov 2003 17:13:35 -0800 (PST) Received: from exchhz01.viatech.com.cn (ip-167-164-97-218.anlai.com [218.97.164.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D3CA43F3F for ; Wed, 26 Nov 2003 17:13:26 -0800 (PST) (envelope-from davidxu@viatech.com.cn) Received: from viatech.com.cn (ip-240-1-168-192.rev.dyxnet.com [192.168.1.240]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id WZMFXXV3; Thu, 27 Nov 2003 08:52:25 +0800 Message-ID: <3FC55112.2010800@viatech.com.cn> Date: Thu, 27 Nov 2003 09:19:14 +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: "sapdb@komadev.de" References: <1069892789.3fc544b58a2d7@localhost> In-Reply-To: <1069892789.3fc544b58a2d7@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids 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: Thu, 27 Nov 2003 01:13:35 -0000 sapdb@komadev.de wrote: >Hi, > >i wrote a little thread test programm. when i run it i get an output like >... >10 of 10 threads running, i am 0x8069000 >10 of 10 threads running, i am 0x806c000 >10 of 10 threads running, i am 0x806f000 >... > >is there a generic way (not kse dependant), to get a still unique countinous >thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a >dirty hack, masking out the upper 20 bit, but that seems not to be the way its >meant to work huh ? > >any ideas ? > > It won't work, the thread pointer is the address returned by malloc() which is out of control of thread library, the reason you get consecutive numbers is because you don't intermediately call malloc() when creating threads, in real world, you won't get this consecutive numbers. libkse has unique thread id for each thread, but it seems there isn't any API exports this unique id. >kind regards kai > >------------------------------------------------------------ >#include >#include >#include > >#define MAXTHREADS 10 > >int i; > >void *threadedCounter(void *x) >{ > for(int a=0;a<10;a++){ > printf("%d of %d threads running, i am 0x%x\n",i,MAXTHREADS,pthread_self >()); > sleep(2); > } > return NULL; >} > >int main(void) >{ > pthread *t; > for(i = 0 ; i < MAXTHREADS ; i++) > pthread_create(&t,NULL,threadedCounter,NULL); > sleep(MAXTHREADS*3+2); > return 0; >} > David Xu From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 21:55:48 2003 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 3BDC416A4CE for ; Wed, 26 Nov 2003 21:55:48 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3DC243F3F for ; Wed, 26 Nov 2003 21:55:46 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id hAR5tkEG047376 for ; Wed, 26 Nov 2003 21:55:46 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10) with ESMTP id hAR5tkWx012787 for ; Wed, 26 Nov 2003 21:55:46 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id hAR5tjM4012786 for threads@FreeBSD.org; Wed, 26 Nov 2003 21:55:45 -0800 (PST) (envelope-from marcel) Date: Wed, 26 Nov 2003 21:55:45 -0800 From: Marcel Moolenaar To: threads@FreeBSD.org Message-ID: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline User-Agent: Mutt/1.5.4i Subject: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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: Thu, 27 Nov 2003 05:55:48 -0000 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Ok, I found what the problem is. Syscalls that got interrupted were not restarted when they should be. This is the result of using the KSE internal context functions, when we should be going through the kernel. So, the end result is that we do in fact need a syscall to switch KSE contexts. Attached a patch to add such syscall. Please review (ia64 specific changes to make use of the syscall are not included). FYI, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kse.diff" Index: kern/init_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/kern/init_sysent.c,v retrieving revision 1.161 diff -u -r1.161 init_sysent.c --- kern/init_sysent.c 14 Nov 2003 03:49:41 -0000 1.161 +++ kern/init_sysent.c 27 Nov 2003 01:17:38 -0000 @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/init_sysent.c,v 1.161 2003/11/14 03:49:41 jeff Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.158 2003/11/14 03:48:37 jeff Exp */ @@ -468,4 +468,5 @@ { AS(extattr_list_fd_args), (sy_call_t *)extattr_list_fd }, /* 437 = extattr_list_fd */ { AS(extattr_list_file_args), (sy_call_t *)extattr_list_file }, /* 438 = extattr_list_file */ { AS(extattr_list_link_args), (sy_call_t *)extattr_list_link }, /* 439 = extattr_list_link */ + { SYF_MPSAFE | AS(kse_switchin_args), (sy_call_t *)kse_switchin }, /* 440 = kse_switchin */ }; Index: kern/kern_thread.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v retrieving revision 1.162 diff -u -r1.162 kern_thread.c --- kern/kern_thread.c 11 Nov 2003 22:07:29 -0000 1.162 +++ kern/kern_thread.c 27 Nov 2003 01:22:08 -0000 @@ -384,6 +384,30 @@ thread_link(td, kg); } +#ifndef _SYS_SYSPROTO_H_ +struct kse_switchin_args { + const struct __mcontext *mcp; + long val; + long *loc; +}; +#endif + +int +kse_switchin(struct thread *td, struct kse_switchin_args *uap) +{ + mcontext_t mc; + int error; + + error = (uap->mcp == NULL) ? EINVAL : 0; + if (!error) + error = copyin(uap->mcp, &mc, sizeof(mc)); + if (!error) + error = set_mcontext(td, &mc); + if (!error && uap->loc != NULL) + suword(uap->loc, uap->val); + return ((error == 0) ? EJUSTRETURN : error); +} + /* struct kse_thr_interrupt_args { struct kse_thr_mailbox * tmbx; Index: kern/syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.c,v retrieving revision 1.147 diff -u -r1.147 syscalls.c --- kern/syscalls.c 14 Nov 2003 03:49:41 -0000 1.147 +++ kern/syscalls.c 27 Nov 2003 01:17:38 -0000 @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/syscalls.c,v 1.147 2003/11/14 03:49:41 jeff Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.158 2003/11/14 03:48:37 jeff Exp */ @@ -447,4 +447,5 @@ "extattr_list_fd", /* 437 = extattr_list_fd */ "extattr_list_file", /* 438 = extattr_list_file */ "extattr_list_link", /* 439 = extattr_list_link */ + "kse_switchin", /* 440 = kse_switchin */ }; Index: kern/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.master,v retrieving revision 1.158 diff -u -r1.158 syscalls.master --- kern/syscalls.master 14 Nov 2003 03:48:37 -0000 1.158 +++ kern/syscalls.master 27 Nov 2003 01:16:01 -0000 @@ -639,6 +639,8 @@ int attrnamespace, void *data, size_t nbytes); } 439 STD BSD { ssize_t extattr_list_link(const char *path, \ int attrnamespace, void *data, size_t nbytes); } +440 MSTD BSD { int kse_switchin(const struct __mcontext *mcp, \ + long val, long *loc); } ; Please copy any additions and changes to the following compatability tables: ; sys/ia64/ia32/syscalls.master (take a best guess) Index: sys/kse.h =================================================================== RCS file: /home/ncvs/src/sys/sys/kse.h,v retrieving revision 1.19 diff -u -r1.19 kse.h --- sys/kse.h 5 Aug 2003 12:00:55 -0000 1.19 +++ sys/kse.h 27 Nov 2003 03:24:00 -0000 @@ -109,6 +109,7 @@ int kse_release(struct timespec *); int kse_thr_interrupt(struct kse_thr_mailbox *, int, long); int kse_wakeup(struct kse_mailbox *); +int kse_switchin(mcontext_t *, long, long *); #endif /* !_KERNEL */ #endif /* !_SYS_KSE_H_ */ Index: sys/syscall.h =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.h,v retrieving revision 1.145 diff -u -r1.145 syscall.h --- sys/syscall.h 14 Nov 2003 03:49:41 -0000 1.145 +++ sys/syscall.h 27 Nov 2003 01:17:38 -0000 @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.145 2003/11/14 03:49:41 jeff Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.158 2003/11/14 03:48:37 jeff Exp */ @@ -351,4 +351,5 @@ #define SYS_extattr_list_fd 437 #define SYS_extattr_list_file 438 #define SYS_extattr_list_link 439 -#define SYS_MAXSYSCALL 440 +#define SYS_kse_switchin 440 +#define SYS_MAXSYSCALL 441 Index: sys/syscall.mk =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.mk,v retrieving revision 1.100 diff -u -r1.100 syscall.mk --- sys/syscall.mk 14 Nov 2003 03:49:41 -0000 1.100 +++ sys/syscall.mk 27 Nov 2003 01:17:38 -0000 @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.100 2003/11/14 03:49:41 jeff Exp $ +# $FreeBSD$ # created from FreeBSD: src/sys/kern/syscalls.master,v 1.158 2003/11/14 03:48:37 jeff Exp MIASM = \ syscall.o \ @@ -292,4 +292,5 @@ jail_attach.o \ extattr_list_fd.o \ extattr_list_file.o \ - extattr_list_link.o + extattr_list_link.o \ + kse_switchin.o Index: sys/sysproto.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysproto.h,v retrieving revision 1.141 diff -u -r1.141 sysproto.h --- sys/sysproto.h 14 Nov 2003 03:49:41 -0000 1.141 +++ sys/sysproto.h 27 Nov 2003 01:17:38 -0000 @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.141 2003/11/14 03:49:41 jeff Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.158 2003/11/14 03:48:37 jeff Exp */ @@ -1284,6 +1284,11 @@ char data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)]; char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)]; }; +struct kse_switchin_args { + char mcp_l_[PADL_(const struct __mcontext *)]; const struct __mcontext * mcp; char mcp_r_[PADR_(const struct __mcontext *)]; + char val_l_[PADL_(long)]; long val; char val_r_[PADR_(long)]; + char loc_l_[PADL_(long *)]; long * loc; char loc_r_[PADR_(long *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1573,6 +1578,7 @@ int extattr_list_fd(struct thread *, struct extattr_list_fd_args *); int extattr_list_file(struct thread *, struct extattr_list_file_args *); int extattr_list_link(struct thread *, struct extattr_list_link_args *); +int kse_switchin(struct thread *, struct kse_switchin_args *); #ifdef COMPAT_43 --3V7upXqbjpZ4EhLz-- From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 22:10:10 2003 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 E21E616A4CF for ; Wed, 26 Nov 2003 22:10:10 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id D427943FCB for ; Wed, 26 Nov 2003 22:10:09 -0800 (PST) (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 hAR6A81G019214; Thu, 27 Nov 2003 01:10:08 -0500 (EST) Date: Thu, 27 Nov 2003 01:10:08 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: "sapdb@komadev.de" In-Reply-To: <1069892789.3fc544b58a2d7@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids 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: Thu, 27 Nov 2003 06:10:11 -0000 On Thu, 27 Nov 2003, sapdb@komadev.de wrote: > Hi, > > i wrote a little thread test programm. when i run it i get an output like > ... > 10 of 10 threads running, i am 0x8069000 > 10 of 10 threads running, i am 0x806c000 > 10 of 10 threads running, i am 0x806f000 > ... > > is there a generic way (not kse dependant), to get a still unique countinous > thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a > dirty hack, masking out the upper 20 bit, but that seems not to be the way its > meant to work huh ? Yuk. If you want a portable method of getting continuous thread ids, you shouldn't use the thread id. This is what pthread_key_create() and pthread_[gs]et_specific() are for. -- Dan Eischen ------ #include #include #include #define MAXTHREADS 10 pthread_key_t key; void * threadedCounter(void *x) { int i; pthread_setspecific(key, x); for (i = 0; i < 10; i++) { printf("%d of %d threads running, i am %p\n", (int)pthread_getspecific(key), MAXTHREADS, pthread_self()); sleep(2); } return (NULL); } int main(int argc, char *argv[]) { pthread_t t; int i; pthread_key_create(&key, NULL); for (i = 0; i < MAXTHREADS; i++) pthread_create(&t, NULL, threadedCounter, (void *)i); sleep(MAXTHREADS*3 + 2); return (0); } From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 22:22:32 2003 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 1ADDD16A4CE for ; Wed, 26 Nov 2003 22:22:32 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32E6A43F3F for ; Wed, 26 Nov 2003 22:22:31 -0800 (PST) (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 hAR6MU1G021716; Thu, 27 Nov 2003 01:22:30 -0500 (EST) Date: Thu, 27 Nov 2003 01:22:30 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Marcel Moolenaar In-Reply-To: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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: Thu, 27 Nov 2003 06:22:32 -0000 On Wed, 26 Nov 2003, Marcel Moolenaar wrote: > Ok, > > I found what the problem is. Syscalls that got interrupted were not > restarted when they should be. This is the result of using the KSE > internal context functions, when we should be going through the > kernel. So, the end result is that we do in fact need a syscall to > switch KSE contexts. Attached a patch to add such syscall. Please > review (ia64 specific changes to make use of the syscall are not > included). We don't need this for x86 or amd64, at least AFAICT, correct? How does a context get marked so one knows that you need to use kse_switchin()? BTW, why do we have to go through the kernel for ia64 in this case? -- Dan Eischen From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 22:40:21 2003 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 9669E16A4CE for ; Wed, 26 Nov 2003 22:40:21 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1815943FDD for ; Wed, 26 Nov 2003 22:40:20 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id hAR6eJEG047575; Wed, 26 Nov 2003 22:40:19 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) hAR6eJWx012892; Wed, 26 Nov 2003 22:40:19 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id hAR6eJIB012891; Wed, 26 Nov 2003 22:40:19 -0800 (PST) (envelope-from marcel) Date: Wed, 26 Nov 2003 22:40:19 -0800 From: Marcel Moolenaar To: Daniel Eischen Message-ID: <20031127064019.GA12853@dhcp01.pn.xcllnt.net> References: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: threads@freebsd.org Subject: Re: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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: Thu, 27 Nov 2003 06:40:21 -0000 On Thu, Nov 27, 2003 at 01:22:30AM -0500, Daniel Eischen wrote: > On Wed, 26 Nov 2003, Marcel Moolenaar wrote: > > > Ok, > > > > I found what the problem is. Syscalls that got interrupted were not > > restarted when they should be. This is the result of using the KSE > > internal context functions, when we should be going through the > > kernel. So, the end result is that we do in fact need a syscall to > > switch KSE contexts. Attached a patch to add such syscall. Please > > review (ia64 specific changes to make use of the syscall are not > > included). > > We don't need this for x86 or amd64, at least AFAICT, correct? Correct. There's no difference between a synchronous context and an asynchronous context. The context that the kernel creates for syscalls either point to the interrupt instruction or immediately after it. In all cases, the way you enter the kernel is the same. On ia64 we use the normal call/return mechanism to enter the kernel for syscalls. Restarting a syscall is therefore slightly more complex. Enter kse_switchin(). > How does a context get marked so one knows that you need to use > kse_switchin()? I currently mark it as synchronous with valid scratch registers. Userland contexts are synchronous, but don't have valid scratch registers. I plan rename flags after the dust has settled to make it more explicit. > BTW, why do we have to go through the kernel for ia64 in this > case? Only the kernel can restart a syscall because the arguments can get clobbered (and are). Also, since we're using a call/return machanism, there's no safe way to construct a context that calls the kernel again. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net From owner-freebsd-threads@FreeBSD.ORG Thu Nov 27 01:36:41 2003 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 7379516A4CE for ; Thu, 27 Nov 2003 01:36:41 -0800 (PST) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9646C43FDF for ; Thu, 27 Nov 2003 01:36:40 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-38lc14c.dialup.mindspring.com ([209.86.4.140] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1APIZi-0006BI-00; Thu, 27 Nov 2003 01:36:39 -0800 Message-ID: <3FC5A645.E1AAEA81@mindspring.com> Date: Wed, 26 Nov 2003 23:22:45 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "sapdb@komadev.de" References: <1069892789.3fc544b58a2d7@localhost> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a47de339922189b2d1ae9742e9932dd44ea8438e0f32a48e08350badd9bab72f9c350badd9bab72f9c cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids 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: Thu, 27 Nov 2003 09:36:41 -0000 "sapdb@komadev.de" wrote: > i wrote a little thread test programm. when i run it i get an output like > ... > 10 of 10 threads running, i am 0x8069000 > 10 of 10 threads running, i am 0x806c000 > 10 of 10 threads running, i am 0x806f000 > ... > > is there a generic way (not kse dependant), to get a still unique countinous > thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a > dirty hack, masking out the upper 20 bit, but that seems not to be the way its > meant to work huh ? > > any ideas ? I think you meant "monotonic"/"contiguous"/"corresponding"? The answer is that the thread ID is an opaque value that belongs to the implementation, and you can not rely on its range or domain, so it's not possible to do things like create an array and index it by thread ID. I think the correct data structure for what you want, and which is not implementation dependent, is probably a hash table. -- Terry From owner-freebsd-threads@FreeBSD.ORG Thu Nov 27 01:38:03 2003 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 EB03A16A4CE for ; Thu, 27 Nov 2003 01:38:03 -0800 (PST) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F96943F3F for ; Thu, 27 Nov 2003 01:38:03 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-38lc14c.dialup.mindspring.com ([209.86.4.140] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1APIb3-0006JT-00; Thu, 27 Nov 2003 01:38:02 -0800 Message-ID: <3FC5A645.E1AAEA81@mindspring.com> Date: Wed, 26 Nov 2003 23:22:45 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "sapdb@komadev.de" References: <1069892789.3fc544b58a2d7@localhost> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a47de339922189b2d1a964bccbf34797ee387f7b89c61deb1d350badd9bab72f9c350badd9bab72f9c cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids 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: Thu, 27 Nov 2003 09:38:04 -0000 "sapdb@komadev.de" wrote: > i wrote a little thread test programm. when i run it i get an output like > ... > 10 of 10 threads running, i am 0x8069000 > 10 of 10 threads running, i am 0x806c000 > 10 of 10 threads running, i am 0x806f000 > ... > > is there a generic way (not kse dependant), to get a still unique countinous > thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a > dirty hack, masking out the upper 20 bit, but that seems not to be the way its > meant to work huh ? > > any ideas ? I think you meant "monotonic"/"contiguous"/"corresponding"? The answer is that the thread ID is an opaque value that belongs to the implementation, and you can not rely on its range or domain, so it's not possible to do things like create an array and index it by thread ID. I think the correct data structure for what you want, and which is not implementation dependent, is probably a hash table. -- Terry From owner-freebsd-threads@FreeBSD.ORG Thu Nov 27 07:07:28 2003 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 0756E16A4CE for ; Thu, 27 Nov 2003 07:07:28 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 01F8243FBF for ; Thu, 27 Nov 2003 07:07:27 -0800 (PST) (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 hARF7P1G017705; Thu, 27 Nov 2003 10:07:26 -0500 (EST) Date: Thu, 27 Nov 2003 10:07:25 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Marcel Moolenaar In-Reply-To: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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: Thu, 27 Nov 2003 15:07:28 -0000 On Wed, 26 Nov 2003, Marcel Moolenaar wrote: > Ok, > > I found what the problem is. Syscalls that got interrupted were not > restarted when they should be. This is the result of using the KSE > internal context functions, when we should be going through the > kernel. So, the end result is that we do in fact need a syscall to > switch KSE contexts. Attached a patch to add such syscall. Please > review (ia64 specific changes to make use of the syscall are not > included). The patch looks OK. Is it possible to roll _ia64_break_setcontext() into kse_switchin() and have ia64's set_mcontext() know the difference between the two contexts? -- Dan Eischen From owner-freebsd-threads@FreeBSD.ORG Thu Nov 27 11:03:39 2003 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 A508816A4CE; Thu, 27 Nov 2003 11:03:39 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88AFE43FE0; Thu, 27 Nov 2003 11:03:37 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id hARJ3bEG051089; Thu, 27 Nov 2003 11:03:37 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) hARJ3bWx014957; Thu, 27 Nov 2003 11:03:37 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id hARJ3bW0014956; Thu, 27 Nov 2003 11:03:37 -0800 (PST) (envelope-from marcel) Date: Thu, 27 Nov 2003 11:03:37 -0800 From: Marcel Moolenaar To: deischen@freebsd.org Message-ID: <20031127190337.GB14849@dhcp01.pn.xcllnt.net> References: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: threads@freebsd.org Subject: Re: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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: Thu, 27 Nov 2003 19:03:39 -0000 On Thu, Nov 27, 2003 at 10:07:25AM -0500, Daniel Eischen wrote: > On Wed, 26 Nov 2003, Marcel Moolenaar wrote: > > > Ok, > > > > I found what the problem is. Syscalls that got interrupted were not > > restarted when they should be. This is the result of using the KSE > > internal context functions, when we should be going through the > > kernel. So, the end result is that we do in fact need a syscall to > > switch KSE contexts. Attached a patch to add such syscall. Please > > review (ia64 specific changes to make use of the syscall are not > > included). > > The patch looks OK. Is it possible to roll _ia64_break_setcontext() > into kse_switchin() and have ia64's set_mcontext() know the difference > between the two contexts? I'm working on it. I had this done right from the start after creating the syscall, but it reintroduced old failures related to asynchronous contexts. So, my working version now has 3 ways to restore a context (_ia64_break_setcontext(), _ia64_restore_context() and kse_switchin()) and it demonstrates that the problem was indeed that we were using _ia64_restore_context() in cases where this would be invalid. So yes, the next step is to remove the ia64_break_setcontext() hack and use kse_switchin() for asynchronous contexts as well. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net From owner-freebsd-threads@FreeBSD.ORG Sat Nov 29 16:54:21 2003 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 4353616A4CE for ; Sat, 29 Nov 2003 16:54:21 -0800 (PST) Received: from maxwell.syr.edu (maxwell.syr.edu [128.230.129.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 047B743FE1 for ; Sat, 29 Nov 2003 16:54:20 -0800 (PST) (envelope-from cmsedore@maxwell.syr.edu) Received: from exchange.maxwell.syr.edu (excluster2.maxwell.syr.edu [128.230.129.231]) by maxwell.syr.edu (8.12.10/8.9.1) with ESMTP id hAU0sHo2074226 for ; Sat, 29 Nov 2003 19:54:17 -0500 (EST) X-MIMEOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Sat, 29 Nov 2003 19:54:19 -0500 Message-ID: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: KSE system scope vs non system scope threads Thread-Index: AcO23HxUZwzU2dUpSUOH+aMSi7ZkFw== From: "Christopher M. Sedore" To: Subject: KSE system scope vs non system scope threads 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, 30 Nov 2003 00:54:21 -0000 =20 I have a fairly simple question about KSE threads: In a threaded program = using KSE threads, what is the effective difference between a = system-scope thread and a non-system-scope thread? If I understand the = KSE architecture correctly, there should not be a significant functional = difference. If my reading lead me to the right conclusion, at the = nitty-gritty level, there are multiple KSE groups created with = system-scope threads, as I understand it, meaning that the kernel = scheduler actually does the scheduling work for system-scope threads, = instead of the userland KSE scheduler. =20 I ask this because I'm observing some behavior that I don't expect. = When running a threaded program with KSE and non-system-scope threads, I = see performance degradation in my network traffic when I'm attempting to = connect to remote hosts that are down. Libthr doesn't see this = degradation, and KSE with system-scope threads doesn't perform as well = as libthr, but is much closer. =20 If there is a canonical document that describes all this, a pointer = would be very welcome. =20 -Chris From owner-freebsd-threads@FreeBSD.ORG Sat Nov 29 17:12:31 2003 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 C0FD816A4CE for ; Sat, 29 Nov 2003 17:12:31 -0800 (PST) Received: from exchhz01.viatech.com.cn (ip-167-164-97-218.anlai.com [218.97.164.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id C581F43FE3 for ; Sat, 29 Nov 2003 17:12:28 -0800 (PST) (envelope-from davidxu@viatech.com.cn) Received: from viatech.com.cn (ip-240-1-168-192.rev.dyxnet.com [192.168.1.240]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id XY9LQCWY; Sun, 30 Nov 2003 08:51:29 +0800 Message-ID: <3FC9455E.6030802@viatech.com.cn> Date: Sun, 30 Nov 2003 09:18:22 +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: "Christopher M. Sedore" References: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> In-Reply-To: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: KSE system scope vs non system scope threads 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, 30 Nov 2003 01:12:31 -0000 Can you checkout src/lib/libpthread/thread/thr_spinlock.c revision 1.18 and see any differents ? David Xu Christopher M. Sedore wrote: > >I have a fairly simple question about KSE threads: In a threaded program using KSE threads, what is the effective difference between a system-scope thread and a non-system-scope thread? If I understand the KSE architecture correctly, there should not be a significant functional difference. If my reading lead me to the right conclusion, at the nitty-gritty level, there are multiple KSE groups created with system-scope threads, as I understand it, meaning that the kernel scheduler actually does the scheduling work for system-scope threads, instead of the userland KSE scheduler. > >I ask this because I'm observing some behavior that I don't expect. When running a threaded program with KSE and non-system-scope threads, I see performance degradation in my network traffic when I'm attempting to connect to remote hosts that are down. Libthr doesn't see this degradation, and KSE with system-scope threads doesn't perform as well as libthr, but is much closer. > >If there is a canonical document that describes all this, a pointer would be very welcome. > >-Chris >_______________________________________________ >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 Sat Nov 29 21:22:39 2003 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 BA7B016A4CE; Sat, 29 Nov 2003 21:22:39 -0800 (PST) Received: from monster.schulte.org (monster.schulte.org [209.134.156.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4374443FE0; Sat, 29 Nov 2003 21:22:36 -0800 (PST) (envelope-from jay.liew@ml.freebsd.jaysern.org) Received: from localhost (localhost [127.0.0.1]) by monster.schulte.org (Postfix) with ESMTP id A10661FB2F; Sat, 29 Nov 2003 23:22:32 -0600 (CST) Received: from pinnacle.schulte.org (pinnacle.schulte.org [209.134.156.220]) by monster.schulte.org (Postfix) with ESMTP id C04101FB2B; Sat, 29 Nov 2003 23:22:31 -0600 (CST) Received: from localhost (dude@localhost)hAU5MVGM091728; Sat, 29 Nov 2003 23:22:31 -0600 (CST) (envelope-from jay.liew@ml.freebsd.jaysern.org) X-Authentication-Warning: pinnacle.schulte.org: dude owned process doing -bs Date: Sat, 29 Nov 2003 23:22:31 -0600 (CST) From: Jay Sern Liew X-X-Sender: dude@pinnacle.schulte.org To: freebsd-arch@freebsd.org, freebsd-threads@freebsd.org, freebsd-hackers@freebsd.org Message-ID: <20031129183810.M90959@pinnacle.schulte.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS 0.3.12pre8 on monster.schulte.org Subject: thread/process & memory management source code 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, 30 Nov 2003 05:22:39 -0000 Can someone point to me the specific location in the FreeBSD kernel source where the code for FreeBSD's thread/process & memory management are? Specifically, where the dispatcher and scheduler is implemented, what kind of scheduling algorithms(short term, long term) are used, where the dynamic storage allocation algorithm is implemented(I'll try to figure the algorithm used from the code), etc. Any help'd be appreciated! ________________________________________________________________________ Jay Sern Liew jaysern@{acm,ieee}.org gpg --keyserver pgp.mit.edu --recv-keys 0xA115A33F From owner-freebsd-threads@FreeBSD.ORG Sat Nov 29 21:26:50 2003 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 783C016A4CE for ; Sat, 29 Nov 2003 21:26:50 -0800 (PST) Received: from mail.chesapeake.net (chesapeake.net [208.142.252.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 274FA43FCB for ; Sat, 29 Nov 2003 21:26:47 -0800 (PST) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost) by mail.chesapeake.net (8.11.6/8.11.6) with ESMTP id hAU5Qet01099; Sun, 30 Nov 2003 00:26:40 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Sun, 30 Nov 2003 00:26:40 -0500 (EST) From: Jeff Roberson To: "Christopher M. Sedore" In-Reply-To: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> Message-ID: <20031130002541.F4201-100000@mail.chesapeake.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE system scope vs non system scope threads 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, 30 Nov 2003 05:26:50 -0000 On Sat, 29 Nov 2003, Christopher M. Sedore wrote: > > I have a fairly simple question about KSE threads: In a threaded program using KSE threads, what is the effective difference between a system-scope thread and a non-system-scope thread? If I understand the KSE architecture correctly, there should not be a significant functional difference. If my reading lead me to the right conclusion, at the nitty-gritty level, there are multiple KSE groups created with system-scope threads, as I understand it, meaning that the kernel scheduler actually does the scheduling work for system-scope threads, instead of the userland KSE scheduler. > > I ask this because I'm observing some behavior that I don't expect. When running a threaded program with KSE and non-system-scope threads, I see performance degradation in my network traffic when I'm attempting to connect to remote hosts that are down. Libthr doesn't see this degradation, and KSE with system-scope threads doesn't perform as well as libthr, but is much closer. Can you describe the threaded application some? For certain types of tasks thr is likely to remain faster due to its simplicity. I'm mostly just curious to hear what your observations are. Thanks, Jeff > > If there is a canonical document that describes all this, a pointer would be very welcome. > > -Chris > _______________________________________________ > 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 Sat Nov 29 22:06:54 2003 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 91FCF16A4CE for ; Sat, 29 Nov 2003 22:06:54 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C99C43FE5 for ; Sat, 29 Nov 2003 22:06:53 -0800 (PST) (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 hAU66q1G013179; Sun, 30 Nov 2003 01:06:52 -0500 (EST) Date: Sun, 30 Nov 2003 01:06:52 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: "Christopher M. Sedore" In-Reply-To: <32A8B2CB12BFC84D8D11D872C787AA9A515DAE@EXCHANGE.forest.maxwell.syr.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: KSE system scope vs non system scope threads 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, 30 Nov 2003 06:06:54 -0000 On Sat, 29 Nov 2003, Christopher M. Sedore wrote: > I have a fairly simple question about KSE threads: In a threaded program > using KSE threads, what is the effective difference between a system-scope > thread and a non-system-scope thread? If I understand the KSE architecture > correctly, there should not be a significant functional difference. If my > reading lead me to the right conclusion, at the nitty-gritty level, there > are multiple KSE groups created with system-scope threads, as I understand > it, meaning that the kernel scheduler actually does the scheduling work for > system-scope threads, instead of the userland KSE scheduler. For the most part yes, but even system scope threads are sometimes dependent on the userland scheduler (when it comes to mutexes, CVs, signals, etc). > I ask this because I'm observing some behavior that I don't expect. When > running a threaded program with KSE and non-system-scope threads, I see > performance degradation in my network traffic when I'm attempting to connect > to remote hosts that are down. Libthr doesn't see this degradation, and KSE > with system-scope threads doesn't perform as well as libthr, but is much > closer. Define what you think is degradation. Process scope threads run in the same KSEG. They are all kept in the same priority-based run-queue. If you have other threads that have equal or higher priority than the network threads in question, they will/may run before those threads. All it takes is one thread that doesn't block (CPU-bound) to eat away at the time allotment for your other threads. If a remote host is down and a thread can't connect to it, that thread should block allowing other threads to run. Are you using blocking or non-blocking connects? > If there is a canonical document that describes all this, a pointer would > be very welcome. It pretty much is what POSIX states it should be, WRT process and system scope. Other than that, see: http://www.freebsd.org/kse/index.html and "Further Reading". -- Dan Eischen