From owner-freebsd-threads@FreeBSD.ORG Mon May 2 11:02:00 2005 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 100D716A4D8 for ; Mon, 2 May 2005 11:02:00 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE24A43D31 for ; Mon, 2 May 2005 11:01:59 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j42B1xYP030309 for ; Mon, 2 May 2005 11:01:59 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j42B1xKn030303 for freebsd-threads@freebsd.org; Mon, 2 May 2005 11:01:59 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 2 May 2005 11:01:59 GMT Message-Id: <200505021101.j42B1xKn030303@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, 02 May 2005 11:02:00 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2005/01/26] threads/76690threads fork hang in child for (-lc_r & -lthr) 1 problem 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] kern/20861 threads libc_r does not honor socket timeouts o [2001/01/20] threads/24472threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] threads/24632threads libc_r delicate deviation from libc in ha o [2001/01/25] kern/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] threads/34536threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] threads/39922threads [PATCH?] Threaded applications executed w o [2002/08/04] kern/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] threads/48856threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] threads/49087threads Signals lost in programs linked with libc o [2003/05/08] threads/51949threads thread in accept cannot be cancelled s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/08/26] threads/70975threads unexpected and unreliable behaviour when o [2004/09/14] threads/71725threads Mysql Crashes frequently giving Sock Erro o [2004/10/05] threads/72353threads Assertion fails in /usr/src/lib/libpthrea o [2004/10/07] threads/72429threads threads blocked in stdio (fgets, etc) are o [2004/10/21] threads/72953threads fork() unblocks blocked signals w/o PTHRE o [2004/11/25] threads/74370threads Cannot get lwp 0 registers in gdb o [2004/12/19] threads/75273threads FBSD 5.3 libpthread (KSE) bug o [2004/12/21] threads/75374threads pthread_kill() ignores SA_SIGINFO flag o [2005/01/04] threads/75795threads applications linked with -lc_r can't clos o [2005/01/26] threads/76694threads fork cause hang in dup()/close() function o [2005/03/10] threads/78660threads Java hangs unkillably in STOP state after o [2005/04/08] threads/79683threads svctcp_create() fails if multiple threads o [2005/04/28] threads/80435threads panic on high loads 27 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/26] kern/18824 threads gethostbyname is not thread safe o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything o [2000/10/21] kern/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] threads/30464threads pthread mutex attributes -- pshared o [2002/05/02] threads/37676threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex o [2004/09/21] threads/71966threads Mlnet Core Dumped : Fatal error '_pq_inse o [2004/11/21] threads/74180threads KSE problem. Applications those riched ma o [2005/01/20] threads/76513threads libpthread is not working o [2005/02/01] threads/76938threads include/unistd.h: ttyname_r prototype mis o [2005/04/13] threads/79887threads [patch] freopen() isn't thread-safe 12 problems total. From owner-freebsd-threads@FreeBSD.ORG Tue May 3 11:08:24 2005 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 C0C6816A4CF for ; Tue, 3 May 2005 11:08:24 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id B74D443D3F for ; Tue, 3 May 2005 11:08:21 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 7B28A1F390 for ; Tue, 3 May 2005 13:08:18 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 54877615A; Tue, 3 May 2005 13:08:18 +0200 (CEST) Date: Tue, 3 May 2005 13:08:18 +0200 From: Marc Olzheim To: freebsd-threads@freebsd.org Message-ID: <20050503110818.GA66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i Subject: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 11:08:24 -0000 --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. I was wondering whether it was safe to use floating point calculations / libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep getting floating point exceptions on places where they should not happen... :-( Marc --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCd1uiezjnobFOgrERAuPhAKDRpqSrCeG8siGK7VEKXmFSQvzxfwCeI62G UO+BhVk3PCZdVLCka/yDcmI= =fGoN -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 13:23:16 2005 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 224AB16A4CF for ; Tue, 3 May 2005 13:23:16 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D78A643D7C for ; Tue, 3 May 2005 13:23:14 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 7D1E91F09D for ; Tue, 3 May 2005 15:23:12 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 6302F615A; Tue, 3 May 2005 15:23:12 +0200 (CEST) Date: Tue, 3 May 2005 15:23:12 +0200 From: Marc Olzheim To: freebsd-threads@freebsd.org Message-ID: <20050503132312.GB66132@stack.nl> References: <20050503110818.GA66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DIOMP1UsTsWJauNi" Content-Disposition: inline In-Reply-To: <20050503110818.GA66132@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 13:23:16 -0000 --DIOMP1UsTsWJauNi Content-Type: multipart/mixed; boundary="LpQ9ahxlCli8rRTG" Content-Disposition: inline --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 01:08:18PM +0200, Marc Olzheim wrote: > Hi. >=20 > I was wondering whether it was safe to use floating point calculations / > libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep > getting floating point exceptions on places where they should not > happen... :-( I've narrowed it down to the following program. The th version crashes within seconds, while the non th version has no problems. amd64 doesn't have this problem either; it just goes wrong on i386/SMP+HT. i386/SMP (athlon MP) seems to have no problems either. Am I doing something wrong here ? Marc --LpQ9ahxlCli8rRTG-- --DIOMP1UsTsWJauNi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCd3tAezjnobFOgrERAuBwAJwJU4ghNyl3kJcwV/PIBc5974Zj2wCgvkJh qEZ0fjcdsRXpCVomjgz9caE= =DI+R -----END PGP SIGNATURE----- --DIOMP1UsTsWJauNi-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 13:28:29 2005 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 3ED4D16A4CE for ; Tue, 3 May 2005 13:28:29 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 946D443D92 for ; Tue, 3 May 2005 13:28:28 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 2EF8F1F09D for ; Tue, 3 May 2005 15:28:22 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 15FD4615A; Tue, 3 May 2005 15:28:22 +0200 (CEST) Date: Tue, 3 May 2005 15:28:21 +0200 From: Marc Olzheim To: freebsd-threads@freebsd.org Message-ID: <20050503132821.GC66132@stack.nl> References: <20050503110818.GA66132@stack.nl> <20050503132312.GB66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jL2BoiuKMElzg3CS" Content-Disposition: inline In-Reply-To: <20050503132312.GB66132@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 13:28:29 -0000 --jL2BoiuKMElzg3CS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 03:23:12PM +0200, Marc Olzheim wrote: > I've narrowed it down to the following program. The th version crashes > within seconds, while the non th version has no problems. > amd64 doesn't have this problem either; it just goes wrong on > i386/SMP+HT. > i386/SMP (athlon MP) seems to have no problems either. >=20 > Am I doing something wrong here ? Don't know what happened with my attachment... Let's try again. Btw.: here's a gdb trace: gdb ~/src/fpu5th fpu5th.60245=20 GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... Core was generated by `fpu5th'. Program terminated with signal 8, Arithmetic exception. Reading symbols from /lib/libm.so.3...done. Loaded symbols for /lib/libm.so.3 Reading symbols from /usr/lib/libpthread.so.1...done. Loaded symbols for /usr/lib/libpthread.so.1 Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x280ad31b in pthread_testcancel () from /usr/lib/libpthread.so.1 (gdb) info threads * 4 LWP 100362 0x280ad31b in pthread_testcancel () from /usr/lib/libpthrea= d.so.1 3 Thread 3 (sleeping) 0x280a5207 in pthread_mutexattr_init () from /usr/= lib/libpthread.so.1 2 Thread 2 (LWP 100512) 0x280ad2fb in pthread_testcancel () from /usr/li= b/libpthread.so.1 1 Thread 1 (runnable) floorf () at /usr/src/lib/msun/i387/s_floorf.S:23 Current language: auto; currently asm (gdb) thread 1 [Switching to thread 1 (Thread 1 (runnable))]#0 floorf () at /usr/src/lib/= msun/i387/s_floorf.S:23 23 flds 8(%ebp); /* round */ (gdb) up #1 0x08048794 in calc_thread (arg=3D0x1) at fpu5.c:36 36 c =3D floorf((float)(1.0 / logf((float)1.0 = + (float)i))); Current language: auto; currently c (gdb) p i $1 =3D 440 (gdb) info registers=20 eax 0x120 288 ecx 0x2e0 736 edx 0x841e 33822 ebx 0x1b8 440 esp 0xbfaedf90 0xbfaedf90 ebp 0xbfaedfb8 0xbfaedfb8 esi 0x1b8 440 edi 0x8053500 134558976 eip 0x8048794 0x8048794 eflags 0x10286 66182 cs 0x1f 31 ss 0x2f 47 ds 0x2f 47 es 0x2f 47 fs 0x2f 47 gs 0xa7 167 (gdb) The program: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # fpu # fpu/Makefile # fpu/fpu5.c # echo c - fpu mkdir -p fpu > /dev/null 2>&1 echo x - fpu/Makefile sed 's/^X//' >fpu/Makefile << 'END-of-fpu/Makefile' Xall: fpu5 fpu5th X Xfpu5th: fpu5.c X cc -O3 -Wall -W -Werror -g -Wcast-qual -I/usr/local/include -L/usr/local/= lib -DWITH_THR -fstrict-aliasing -pthread fpu5.c -o fpu5th -lm X Xfpu5: fpu5.c X cc -O3 -Wall -W -Werror -g -Wcast-qual -I/usr/local/include -L/usr/local/= lib -fstrict-aliasing fpu5.c -o fpu5 -lm END-of-fpu/Makefile echo x - fpu/fpu5.c sed 's/^X//' >fpu/fpu5.c << 'END-of-fpu/fpu5.c' X/* Blame it in Marc Olzheim (Zlo) */ X X#ifdef WITH_THR X#include X#endif /* WITH_THR */ X X#include X#include X#include X#include X#include X#include X Xvoid * Xcalc_thread(void *arg) X{ X long i; X unsigned char c; X X i =3D (long)arg + 1; X X for (;;) X { X i =3D (i + 1) % 736; X if (i > 0) X { X /* ln(2.0) =3D~ 0.69 */ X if (logf((float)1.0 + (float)i) < (float)0.65) X { X /* Never happens */ X printf("\n\n\n\ni: %ld\n\n\n\n", i); X fflush(NULL); X } X X /* Then why does _this_ go wrong ? */ X c =3D floorf((float)(1.0 / logf((float)1.0 + (float)i))); X X if (c > 1) /* Never true, just to use c. */ X printf("\r%hhu", c); X } X } X X /* NOTREACHED */ X return NULL; X} X Xint Xmain(int argc, char *argv[]) X{ X#ifdef WITH_THR X pthread_t thread; X#endif /* WITH_THR */ X X if (1 !=3D argc) X { X fprintf(stderr, "Usage: %s\n", argv[0]); X return(EX_USAGE); X } X X#ifdef WITH_THR X if (pthread_create(&thread , NULL, calc_thread, (void *)1L)) X err(1, "pthread_create()"); X#else /* ! WITH_THR */ X (void)calc_thread((void *)1L); X#endif /* ! WITH_THR */ X X for (;;) X sleep(60); X X return(EX_OK); X} END-of-fpu/fpu5.c exit --jL2BoiuKMElzg3CS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCd3x1ezjnobFOgrERAlXJAJ9YAJJbvfzrcg6kDWlFMnO0PEbF8wCeKD2Q dAH9kkghmNIFK3Sg7Vw5pXw= =uutq -----END PGP SIGNATURE----- --jL2BoiuKMElzg3CS-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 13:54:30 2005 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 EFD9816A4CE for ; Tue, 3 May 2005 13:54:30 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62A9143D2D for ; Tue, 3 May 2005 13:54:30 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j43DsN3N008410; Tue, 3 May 2005 09:54:23 -0400 (EDT) Date: Tue, 3 May 2005 09:54:23 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050503110818.GA66132@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Tue, 03 May 2005 13:54:31 -0000 On Tue, 3 May 2005, Marc Olzheim wrote: > Hi. > > I was wondering whether it was safe to use floating point calculations / > libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep > getting floating point exceptions on places where they should not > happen... :-( Yes, it should work fine. If you can verify the problem exists (or doesn't) on -current, that might help. It sounds like FPU context isn't getting saved/restored correctly in the kernel. -- DE From owner-freebsd-threads@FreeBSD.ORG Tue May 3 14:00:38 2005 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 6C72416A4D1; Tue, 3 May 2005 14:00:38 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0802843D69; Tue, 3 May 2005 14:00:38 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id C23E21F3D1; Tue, 3 May 2005 16:00:29 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id AA185615A; Tue, 3 May 2005 16:00:29 +0200 (CEST) Date: Tue, 3 May 2005 16:00:29 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050503140029.GE66132@stack.nl> References: <20050503110818.GA66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SWTRyWv/ijrBap1m" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 14:00:38 -0000 --SWTRyWv/ijrBap1m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 09:54:23AM -0400, Daniel Eischen wrote: > > Hi. > > > > I was wondering whether it was safe to use floating point calculations / > > libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep > > getting floating point exceptions on places where they should not > > happen... :-( >=20 > Yes, it should work fine. If you can verify the problem exists > (or doesn't) on -current, that might help. It sounds like FPU > context isn't getting saved/restored correctly in the kernel. I don't have a -current machine with HyperThreading... :-/ But I mailed a test program in a different thread; perhaps somebody else is willing to run it... Marc --SWTRyWv/ijrBap1m Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCd4P9ezjnobFOgrERAgnkAJ9S+DA362TIorIJyK+TAm3bOPfWoACffSxr 4Jq7lrs3e3xIllXtPgMZ4Fg= =UzGI -----END PGP SIGNATURE----- --SWTRyWv/ijrBap1m-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 14:07:45 2005 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 2727016A4CE; Tue, 3 May 2005 14:07:45 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2B1843D54; Tue, 3 May 2005 14:07:44 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 2D0C81F3D4; Tue, 3 May 2005 16:07:37 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 15260615A; Tue, 3 May 2005 16:07:37 +0200 (CEST) Date: Tue, 3 May 2005 16:07:36 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050503140736.GF66132@stack.nl> References: <20050503110818.GA66132@stack.nl> <20050503140029.GE66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VuQYccsttdhdIfIP" Content-Disposition: inline In-Reply-To: <20050503140029.GE66132@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 14:07:45 -0000 --VuQYccsttdhdIfIP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 04:00:29PM +0200, Marc Olzheim wrote: > > Yes, it should work fine. If you can verify the problem exists > > (or doesn't) on -current, that might help. It sounds like FPU > > context isn't getting saved/restored correctly in the kernel. >=20 > I don't have a -current machine with HyperThreading... :-/ >=20 > But I mailed a test program in a different thread; perhaps somebody else > is willing to run it... Ah, found an SMP, non-HT machine running: FreeBSD office-install1.ilse.net 6.0-CURRENT FreeBSD 6.0-CURRENT #25: Mon A= pr 25 18:40:45 CEST 2005 root@office-install1.ilse.net:/usr/obj/usr/src/sys= /CRASH i386 Which has exactly the same problem. Marc --VuQYccsttdhdIfIP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCd4WoezjnobFOgrERAnUWAKDH6/mVzLO9zH9Fjb9E5SqRGlD1tgCgwNmX M57ah0MUvULcW78xBe3ZGSM= =8jk0 -----END PGP SIGNATURE----- --VuQYccsttdhdIfIP-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 14:35:53 2005 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 9285516A4CE; Tue, 3 May 2005 14:35:53 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 910A543D39; Tue, 3 May 2005 14:35:52 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailhost.stack.nl (Postfix) with ESMTP id 64C2B1F3DF; Tue, 3 May 2005 16:35:46 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 333) id 58B6E22899; Tue, 3 May 2005 16:35:46 +0200 (CEST) Date: Tue, 3 May 2005 16:35:46 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050503143546.GA12678@stack.nl> References: <20050503110818.GA66132@stack.nl> <20050503140029.GE66132@stack.nl> <20050503140736.GF66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline In-Reply-To: <20050503140736.GF66132@stack.nl> X-Operating-System: FreeBSD snail.stack.nl 5.3-RELEASE-p9 FreeBSD 5.3-RELEASE-p9 X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 14:35:53 -0000 --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 04:07:36PM +0200, Marc Olzheim wrote: > On Tue, May 03, 2005 at 04:00:29PM +0200, Marc Olzheim wrote: > > > Yes, it should work fine. If you can verify the problem exists > > > (or doesn't) on -current, that might help. It sounds like FPU > > > context isn't getting saved/restored correctly in the kernel. > >=20 > > I don't have a -current machine with HyperThreading... :-/ > >=20 > > But I mailed a test program in a different thread; perhaps somebody else > > is willing to run it... >=20 > Ah, found an SMP, non-HT machine running: > FreeBSD office-install1.ilse.net 6.0-CURRENT FreeBSD 6.0-CURRENT #25: Mon= Apr 25 18:40:45 CEST 2005 root@office-install1.ilse.net:/usr/obj/usr/src/s= ys/CRASH i386 >=20 > Which has exactly the same problem. FYI: FreeBSD snail.stack.nl 5.3-RELEASE-p9 FreeBSD 5.3-RELEASE-p9 #8: Fri Apr 15= 12:46:13 CEST 2005 root@snail.stack.nl:/usr/obj/usr/src/sys/SNAIL i386 is safe. And although it's a dual athlon MP, I don't think that that really matters... Marc --VS++wcV0S1rZb1Fb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCd4xCezjnobFOgrERAlN4AJwMNaHJ/NugloR5tfbm0G8SWrblJgCfTog1 lopWhfEb4FK+7fb8PTKWv/o= =O8mZ -----END PGP SIGNATURE----- --VS++wcV0S1rZb1Fb-- From owner-freebsd-threads@FreeBSD.ORG Tue May 3 22:49:57 2005 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 4730D16A4CE; Tue, 3 May 2005 22:49:57 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id E908D43D5E; Tue, 3 May 2005 22:49:56 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 5A9F51F4B7; Wed, 4 May 2005 00:49:51 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 47B26615A; Wed, 4 May 2005 00:49:51 +0200 (CEST) Date: Wed, 4 May 2005 00:49:51 +0200 From: Marc Olzheim To: David Xu Message-ID: <20050503224951.GB17595@stack.nl> References: <200504111210.j3BCAZmU002870@freefall.freebsd.org> <425B02BB.5060904@freebsd.org> <20050412071220.GA17393@stack.nl> <425B866C.4010609@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H+4ONPRPur6+Ovig" Content-Disposition: inline In-Reply-To: <425B866C.4010609@freebsd.org> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: threads/76690: fork hang in child for (-lc_r & -lthr) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2005 22:49:57 -0000 --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 12, 2005 at 04:27:24PM +0800, David Xu wrote: > You have to fix it in uthread_fork.c, lock __malloc_lock over=20 > __sys_fork() call. > but why libc_r ? it is depreciated. Hmmm. As long as FreeBSD 5.x fails to be stable / as stable as I need it to be, my company will keep running FreeBSD 4.x and thus will be using libc_r for a while. Perhaps some OpenBSD imports might help. I think that there might be more people around who can't run their software on FreeBSD 5.4 yet, but do need some sort of stable system with thread support. Or perhaps we're the only ones actually using the 'obscure' functionalities of the thread libraries and the kernel (sendfile(),writev() over NFS,threads with floating point code, socketpair(), etc.) and the only one who have worked around missing features (preadv(),pwritev(), threaded blocking I/O, slow malloc(), broken thread backtraces, etc.) but as long as those 'new' features work on FreeBSD 4 and don't work on FreeBSD 5, I have no choice but to keep using FreeBSD 4 and thus libc_r. :-( In any case, I'll look into libc_r's bugs some more, at least those that bother my employer. :-) Marc --H+4ONPRPur6+Ovig Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeAAPezjnobFOgrERAsYxAKCP9rJszs6T0L/tkeUp51s0PaOSzwCghYoN AggacycQ0PRiIoF6hZ7lhUA= =DAsZ -----END PGP SIGNATURE----- --H+4ONPRPur6+Ovig-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 10:32:08 2005 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 9C84E16A4CE; Wed, 4 May 2005 10:32:08 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D08C543D31; Wed, 4 May 2005 10:32:07 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 267061F00B; Wed, 4 May 2005 12:31:45 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 0C8A26393; Wed, 4 May 2005 12:31:45 +0200 (CEST) Date: Wed, 4 May 2005 12:31:44 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504103144.GA74093@stack.nl> References: <20050503110818.GA66132@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 10:32:08 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2005 at 09:54:23AM -0400, Daniel Eischen wrote: > > Hi. > > > > I was wondering whether it was safe to use floating point calculations / > > libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep > > getting floating point exceptions on places where they should not > > happen... :-( >=20 > Yes, it should work fine. If you can verify the problem exists > (or doesn't) on -current, that might help. It sounds like FPU > context isn't getting saved/restored correctly in the kernel. Should I file a PR ? Marc --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeKSQezjnobFOgrERAm8KAJ9iYDqLofVcWRDmujZTuGnSy+SgUwCgsfy0 Kut0rFzqtDWjE3pRCJbmHdE= =xzCo -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 15:06:36 2005 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 B39B916A4CE for ; Wed, 4 May 2005 15:06:36 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 357CD43D80 for ; Wed, 4 May 2005 15:06:36 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j44F4At6027894; Wed, 4 May 2005 11:04:10 -0400 (EDT) Date: Wed, 4 May 2005 11:04:07 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050504103144.GA74093@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 04 May 2005 15:06:36 -0000 On Wed, 4 May 2005, Marc Olzheim wrote: > On Tue, May 03, 2005 at 09:54:23AM -0400, Daniel Eischen wrote: > > > Hi. > > > > > > I was wondering whether it was safe to use floating point calculations / > > > libm functions with 5.4-STABLE's pthread library on HT+SMP. I keep > > > getting floating point exceptions on places where they should not > > > happen... :-( > > > > Yes, it should work fine. If you can verify the problem exists > > (or doesn't) on -current, that might help. It sounds like FPU > > context isn't getting saved/restored correctly in the kernel. > > Should I file a PR ? Yes, it happens also on a UP system with a few month old -current. Is there a similar test you can use that doesn't use floor()? This one seems to work but doesn't use libm. -- DE -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----- #include #include #include #include #include #include #include void *foo(void *); typedef struct { int number; int loops; } arg_t; /* * Simple test case for the thread system. Start "n" threads, * and join them afterwards. */ int main( int argc, char** argv) { struct sched_param param; pthread_t* threads; pthread_attr_t attr; arg_t* args; void* ret; int policy; int n; int i; if (argc > 1) { n = strtoimax(argv[1], NULL, 10); printf("Using %d threads (parameter)\n", n); } else { n = 5; printf("Using %d threads (default)\n", n); } // initialize random number generator srandomdev(); threads = (pthread_t *)malloc(sizeof(pthread_t) * n); args = (arg_t *)malloc(sizeof(arg_t) * n); // start n threads pthread_attr_init(&attr); //pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); for (i = 0; i < n; i++) { args[i].number = i; if (pthread_create(&threads[i], &attr, foo, &args[i]) != 0) { err(1, NULL); } } pthread_getschedparam(pthread_self(), &policy, ¶m); param.sched_priority++; pthread_setschedparam(pthread_self(), policy, ¶m); // join threads for (i = 0; i < n; i++) { if (pthread_join(threads[i], &ret) != 0) { err(1, NULL); } printf("Joined bar %d, loops %d\n", args[i].number, args[i].loops); } free(threads); sleep(1); return (0); } void * foo(void *v) { arg_t *arg; float a, b, c; float d __unused; int i; int loops; arg = (arg_t *)v; printf("bar %d running\n", arg->number); /* Simulate some CPU-intensive calculations. */ #if 1 while (1) { #else loops = 5000000; for (i = 1; i < loops; i++) { #endif a = (float)i * ((float)random() / 11.0); b = a * ((float)random() / 13.0); c = b * ((float)random() / 17.0); d = c * ((float)random() / 23.0); } arg->loops = loops; //printf("bar %d, loops %d\n", arg->number, arg->loops); return (NULL); } From owner-freebsd-threads@FreeBSD.ORG Wed May 4 15:46:58 2005 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 4612D16A4CE; Wed, 4 May 2005 15:46:58 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7978B43D7E; Wed, 4 May 2005 15:46:57 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 61C4F1F04E; Wed, 4 May 2005 17:46:27 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 49AE06393; Wed, 4 May 2005 17:46:27 +0200 (CEST) Date: Wed, 4 May 2005 17:46:27 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504154627.GA75439@stack.nl> References: <20050504103144.GA74093@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 15:46:58 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 04, 2005 at 11:04:07AM -0400, Daniel Eischen wrote: > > Should I file a PR ? kern/80617 > Yes, it happens also on a UP system with a few month old -current. > Is there a similar test you can use that doesn't use floor()? I'll try to pinpoint it further down without library calls... >=20 > This one seems to work but doesn't use libm. [snip] Ok, I'll look into it. Marc --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeO5TezjnobFOgrERAutUAJ4hMzS3MgXGgFHaromk4HCXWp8HHgCfXVbC oHxUZFc85lExnmGh8QE6gLA= =PvNi -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 18:31:45 2005 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 1D5F116A4CE; Wed, 4 May 2005 18:31:45 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AFF443D58; Wed, 4 May 2005 18:31:44 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 019061F103; Wed, 4 May 2005 20:31:33 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id DB2AF6393; Wed, 4 May 2005 20:31:32 +0200 (CEST) Date: Wed, 4 May 2005 20:31:32 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504183132.GA76171@stack.nl> References: <20050504103144.GA74093@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 18:31:45 -0000 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 11:04:07AM -0400, Daniel Eischen wrote: > This one seems to work but doesn't use libm. Hmm, I can't get it to crash... How did you compile it ? It seems to me like something about the floorf() assembly might have something to do with it. Marc --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeRUEezjnobFOgrERAlvFAJ9+7Z+MNZHCe3PPOxzGCN/DYx2tBACgvzhg n48G4Ni5mGbCWM65DVY0TEw= =EWWf -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 19:03:07 2005 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 6BF1816A4D0; Wed, 4 May 2005 19:03:07 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D89DC43D62; Wed, 4 May 2005 19:03:06 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 6F3BE1F3C4; Wed, 4 May 2005 21:02:44 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 555C36393; Wed, 4 May 2005 21:02:44 +0200 (CEST) Date: Wed, 4 May 2005 21:02:44 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504190244.GB76171@stack.nl> References: <20050504103144.GA74093@stack.nl> <20050504183132.GA76171@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="b5gNqxB1S1yM7hjW" Content-Disposition: inline In-Reply-To: <20050504183132.GA76171@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 19:03:07 -0000 --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 08:31:32PM +0200, Marc Olzheim wrote: > It seems to me like something about the floorf() assembly might have > something to do with it. One of the reasons I think it has to do with specific functions, is that we've got one system that runs heavily threaded floating point heavy code (a search engine ranker) and that hasn't had this problem in the past seven days. The database builder is the only piece of software giving us trouble, which happens the only software we have that uses floorf(). So after some testing, I could remove all code but the floorf() and still get the exception, but without it, I'm until now unsuccesful. Marc --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeRxUezjnobFOgrERAh+rAJ9kJLbpsWkKIJntjeJHbvFGRyFsRgCglm1B KS/BbYLUjCLyKT6G6CkZi0k= =Jltc -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 19:15:45 2005 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 3BF8A16A4CE for ; Wed, 4 May 2005 19:15:45 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C833443D41 for ; Wed, 4 May 2005 19:15:44 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j44JF6go017410; Wed, 4 May 2005 15:15:06 -0400 (EDT) Date: Wed, 4 May 2005 15:15:06 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050504183132.GA76171@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 04 May 2005 19:15:45 -0000 On Wed, 4 May 2005, Marc Olzheim wrote: > On Wed, May 04, 2005 at 11:04:07AM -0400, Daniel Eischen wrote: > > This one seems to work but doesn't use libm. > > Hmm, I can't get it to crash... > How did you compile it ? gcc -Wall -o name name.c -lpthread I didn't get it to crash either. > It seems to me like something about the floorf() assembly might have > something to do with it. Yeah, I was just trying to narrow down the problem a bit more. -- DE From owner-freebsd-threads@FreeBSD.ORG Wed May 4 19:52:43 2005 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 2173916A4CE; Wed, 4 May 2005 19:52:43 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E5B843D3F; Wed, 4 May 2005 19:52:42 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id D247A1F178; Wed, 4 May 2005 21:51:53 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id B9D866393; Wed, 4 May 2005 21:51:53 +0200 (CEST) Date: Wed, 4 May 2005 21:51:53 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504195153.GC76171@stack.nl> References: <20050504183132.GA76171@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zbGR4y+acU1DwHSi" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 19:52:43 -0000 --zbGR4y+acU1DwHSi Content-Type: multipart/mixed; boundary="TYecfFk8j8mZq+dy" Content-Disposition: inline --TYecfFk8j8mZq+dy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 04, 2005 at 03:15:06PM -0400, Daniel Eischen wrote: > > It seems to me like something about the floorf() assembly might have > > something to do with it. >=20 > Yeah, I was just trying to narrow down the problem a bit more. I've attached one that's built very tight around floorf(). Marc --TYecfFk8j8mZq+dy Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=Makefile all: fpu6 fpu6th fpu6th: fpu6.c cc -O3 -Wall -W -Werror -Wno-unused -g -Wcast-qual -DWITH_THR -fstrict-aliasing -pthread fpu6.c -o fpu6th -lm fpu6: fpu6.c cc -O3 -Wall -W -Werror -Wno-unused -g -Wcast-qual -fstrict-aliasing fpu6.c -o fpu6 -lm clean: rm -f fpu6 fpu6th fpu6th.core core --TYecfFk8j8mZq+dy Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fpu6.c" /* Blame it in Marc Olzheim (Zlo) */ #ifdef WITH_THR #include #endif /* WITH_THR */ #include #include #include #include void * calc_thread(void *arg) { float f; for (;;) { f = floorf((float)1.0 / (float)((long)arg + 1L)); if (f > (float)1.0) /* Never true, but needed to use f. */ printf("\r%f", (double)f); } /* NOTREACHED */ return NULL; } int main(int argc, char *argv[]) { #ifdef WITH_THR pthread_t thread; if (pthread_create(&thread , NULL, calc_thread, (void *)1L)) err(1, "pthread_create()"); #else /* ! WITH_THR */ (void)calc_thread((void *)1L); #endif /* ! WITH_THR */ for (;;) sleep(60); /* NOTREACHED */ return 0; } --TYecfFk8j8mZq+dy-- --zbGR4y+acU1DwHSi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeSfZezjnobFOgrERAq6pAJwLIrgWFmhQJC+nBk+eGEpJNP1CzACguTUG fFj9Zit2QQLReKSybmgQWTQ= =vTI4 -----END PGP SIGNATURE----- --zbGR4y+acU1DwHSi-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 20:22:47 2005 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 5058D16A4E6; Wed, 4 May 2005 20:22:47 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0776943D7E; Wed, 4 May 2005 20:22:47 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 674971F1CF; Wed, 4 May 2005 22:22:00 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 4EDDF6393; Wed, 4 May 2005 22:22:00 +0200 (CEST) Date: Wed, 4 May 2005 22:22:00 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504202200.GD76171@stack.nl> References: <20050504183132.GA76171@stack.nl> <20050504195153.GC76171@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="imjhCm/Pyz7Rq5F2" Content-Disposition: inline In-Reply-To: <20050504195153.GC76171@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 20:22:47 -0000 --imjhCm/Pyz7Rq5F2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 04, 2005 at 09:51:53PM +0200, Marc Olzheim wrote: > On Wed, May 04, 2005 at 03:15:06PM -0400, Daniel Eischen wrote: > > > It seems to me like something about the floorf() assembly might have > > > something to do with it. > >=20 > > Yeah, I was just trying to narrow down the problem a bit more. >=20 > I've attached one that's built very tight around floorf(). Replacing floorf() in the program by: fabs() rintf() sqrt() expf() log10f() logf() cosf() powf(,) doesn't crash. The only two functions I found to crash are floorf() and ceilf(). Replacing all floats by doubles and using floor() or ceil() doesn't crash either. So it really seems to be in the floorf() and ceilf() code. Marc --imjhCm/Pyz7Rq5F2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeS7oezjnobFOgrERAjdWAKCEyodrYSGMsjqCrfmwkzrm1kwowwCfdZbn lcFQzazBkC5N9uLgj97xsVo= =GOTg -----END PGP SIGNATURE----- --imjhCm/Pyz7Rq5F2-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 20:58:20 2005 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 D613416A4CE; Wed, 4 May 2005 20:58:20 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0D3843D72; Wed, 4 May 2005 20:58:19 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 480A01F1FA; Wed, 4 May 2005 22:57:45 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 321026393; Wed, 4 May 2005 22:57:45 +0200 (CEST) Date: Wed, 4 May 2005 22:57:45 +0200 From: Marc Olzheim To: Daniel Eischen , das@freebsd.org Message-ID: <20050504205745.GH76171@stack.nl> References: <20050504183132.GA76171@stack.nl> <20050504195153.GC76171@stack.nl> <20050504202200.GD76171@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lHGcFxmlz1yfXmOs" Content-Disposition: inline In-Reply-To: <20050504202200.GD76171@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 20:58:21 -0000 --lHGcFxmlz1yfXmOs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 10:22:00PM +0200, Marc Olzheim wrote: > So it really seems to be in the floorf() and ceilf() code. Say, isn't that instruction supposed to read 'flds -8(%ebp);' ? (mark the '-') Marc --lHGcFxmlz1yfXmOs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeTdJezjnobFOgrERAqFvAJ43EFcthBXuhYxHbw2VYNXq5Wy0uACePwei 7Kp5Q8RYuSFSaaHkx2c3DZI= =osJi -----END PGP SIGNATURE----- --lHGcFxmlz1yfXmOs-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 21:44:16 2005 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 0BB2216A4CE; Wed, 4 May 2005 21:44:16 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BDBD43D6B; Wed, 4 May 2005 21:44:15 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j44LhPik014282; Wed, 4 May 2005 17:43:25 -0400 (EDT) Date: Wed, 4 May 2005 17:43:25 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050504205745.GH76171@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: das@freebsd.org cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 04 May 2005 21:44:16 -0000 On Wed, 4 May 2005, Marc Olzheim wrote: > On Wed, May 04, 2005 at 10:22:00PM +0200, Marc Olzheim wrote: > > So it really seems to be in the floorf() and ceilf() code. > > Say, isn't that instruction supposed to read 'flds -8(%ebp);' ? (mark > the '-') No, 8(%ebp) is where the function's argument is (the first instruction is a pushl, then %ebp is assigned from %esp). -- DE From owner-freebsd-threads@FreeBSD.ORG Wed May 4 21:47:09 2005 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 A306E16A4CE for ; Wed, 4 May 2005 21:47:09 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D9B743D54 for ; Wed, 4 May 2005 21:47:09 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j44LP4Bq024900; Wed, 4 May 2005 17:25:04 -0400 (EDT) Date: Wed, 4 May 2005 17:25:04 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050504202200.GD76171@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 04 May 2005 21:47:09 -0000 On Wed, 4 May 2005, Marc Olzheim wrote: > On Wed, May 04, 2005 at 09:51:53PM +0200, Marc Olzheim wrote: > > On Wed, May 04, 2005 at 03:15:06PM -0400, Daniel Eischen wrote: > > > > It seems to me like something about the floorf() assembly might have > > > > something to do with it. > > > > > > Yeah, I was just trying to narrow down the problem a bit more. > > > > I've attached one that's built very tight around floorf(). > > Replacing floorf() in the program by: > fabs() > rintf() > sqrt() > expf() > log10f() > logf() > cosf() > powf(,) > > doesn't crash. > > The only two functions I found to crash are floorf() and ceilf(). > > Replacing all floats by doubles and using floor() or ceil() doesn't > crash either. floorf() seems to fiddle with the FP control word. The kernel and libpthread use fxsave and fxrstor respectively. These save and restore the control word, but something may not be working correctly. ENTRY(floorf) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -12(%ebp) /* store fpu control word */ movw -12(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx movw %dx,-16(%ebp) fldcw -16(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ frndint fldcw -12(%ebp) /* restore original control word */ leave ret -- DE From owner-freebsd-threads@FreeBSD.ORG Wed May 4 21:58:50 2005 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 BDE4E16A4CE; Wed, 4 May 2005 21:58:50 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id E598043D60; Wed, 4 May 2005 21:58:49 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 3D62F1F201; Wed, 4 May 2005 23:57:30 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 23C126393; Wed, 4 May 2005 23:57:30 +0200 (CEST) Date: Wed, 4 May 2005 23:57:30 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504215730.GA1629@stack.nl> References: <20050504202200.GD76171@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 21:58:50 -0000 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 05:25:04PM -0400, Daniel Eischen wrote: > floorf() seems to fiddle with the FP control word. The kernel > and libpthread use fxsave and fxrstor respectively. These > save and restore the control word, but something may not be > working correctly. Hmm, as does ceilf. But trunf() the only other doing this, does not get the sigFPE: fstcw, then: floorf() ceilf() truncf() or 0x0400 or 0x0800 or 0x0c00 and 0xf7ff and 0xfbff and fldcw the modified version. Then why is truncf() different... ? All abuse the 0x0c00 bits of the control word. Marc --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeUVJezjnobFOgrERAvKvAKCJBnuJGTKQZMM8C1WiNNZn19/JkACeKp+T u9zLzNe4Jb2o20ZAnRagJdg= =JmWY -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 22:22:59 2005 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 BD0D616A4CE; Wed, 4 May 2005 22:22:59 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0603343D5C; Wed, 4 May 2005 22:22:59 +0000 (GMT) (envelope-from das@freebsd.org) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.3/8.13.1) with ESMTP id j44MIPO4022800; Wed, 4 May 2005 18:18:25 -0400 (EDT) (envelope-from das@freebsd.org) Received: (from das@localhost) by VARK.MIT.EDU (8.13.3/8.13.1/Submit) id j44MIPko022799; Wed, 4 May 2005 18:18:25 -0400 (EDT) (envelope-from das@freebsd.org) Date: Wed, 4 May 2005 18:18:25 -0400 From: David Schultz To: Daniel Eischen Message-ID: <20050504221825.GA22732@VARK.MIT.EDU> References: <20050504205745.GH76171@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 22:22:59 -0000 On Wed, May 04, 2005, Daniel Eischen wrote: > On Wed, 4 May 2005, Marc Olzheim wrote: > > > On Wed, May 04, 2005 at 10:22:00PM +0200, Marc Olzheim wrote: > > > So it really seems to be in the floorf() and ceilf() code. > > > > Say, isn't that instruction supposed to read 'flds -8(%ebp);' ? (mark > > the '-') > > No, 8(%ebp) is where the function's argument is (the first > instruction is a pushl, then %ebp is assigned from %esp). Yeah, that part is fine. The one odd thing I notice as a glance back at the code is that it uses -12(%ebp) and -16(%ebp) for temporary storage, instead of using -4(%ebp) and -8(%ebp) like the double versions. That's probably a cut-and-pasto on my part. This would explain the SIGFPEs if an asynchronous trap is causing the area just past the end of the stack to be overwritten, since only 8 bytes of stack are reserved. I'll take a closer look in a week or so... From owner-freebsd-threads@FreeBSD.ORG Wed May 4 22:33:06 2005 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 86A3916A4CE; Wed, 4 May 2005 22:33:06 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F42E43D3F; Wed, 4 May 2005 22:33:06 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 0DB741F088; Thu, 5 May 2005 00:32:14 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id E1E3E6393; Thu, 5 May 2005 00:32:13 +0200 (CEST) Date: Thu, 5 May 2005 00:32:13 +0200 From: Marc Olzheim To: David Schultz Message-ID: <20050504223213.GA1799@stack.nl> References: <20050504205745.GH76171@stack.nl> <20050504221825.GA22732@VARK.MIT.EDU> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <20050504221825.GA22732@VARK.MIT.EDU> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Daniel Eischen cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 22:33:06 -0000 --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 06:18:25PM -0400, David Schultz wrote: > Yeah, that part is fine. The one odd thing I notice as a glance > back at the code is that it uses -12(%ebp) and -16(%ebp) for > temporary storage, instead of using -4(%ebp) and -8(%ebp) like > the double versions. That's probably a cut-and-pasto on my > part. This would explain the SIGFPEs if an asynchronous trap is > causing the area just past the end of the stack to be overwritten, > since only 8 bytes of stack are reserved. I'll take a closer > look in a week or so... Argh... That fixed it for me indeed. :-P Marc --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeU1tezjnobFOgrERAmCkAJ95SXRm63HbjGHpmOXToOoUu0vQgACdEUGA evbf0OBuKh04ldCOxA3UxUM= =RWwY -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 23:02:29 2005 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 A58F916A4CE; Wed, 4 May 2005 23:02:29 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E70443D3F; Wed, 4 May 2005 23:02:28 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 08D021F0C7; Thu, 5 May 2005 01:01:58 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id E205D6393; Thu, 5 May 2005 01:01:57 +0200 (CEST) Date: Thu, 5 May 2005 01:01:57 +0200 From: Marc Olzheim To: David Schultz Message-ID: <20050504230157.GA1886@stack.nl> References: <20050504205745.GH76171@stack.nl> <20050504221825.GA22732@VARK.MIT.EDU> <20050504223213.GA1799@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lMM8JwqTlfDpEaS6" Content-Disposition: inline In-Reply-To: <20050504223213.GA1799@stack.nl> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Daniel Eischen cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 23:02:29 -0000 --lMM8JwqTlfDpEaS6 Content-Type: multipart/mixed; boundary="NMuMz9nt05w80d4+" Content-Disposition: inline --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 05, 2005 at 12:32:13AM +0200, Marc Olzheim wrote: > That fixed it for me indeed. :-P I've applied the attached patch on my systems. Question remains why the truncf() doesn't trigger it and the ceilf() and floorf() does. And why it only triggers with threads (even a single thread is enough). Marc --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fpu.patch" Content-Transfer-Encoding: quoted-printable Index: lib/msun/i387/s_ceilf.S --- lib/msun/i387/s_ceilf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_ceilf.S Thu May 5 00:54:18 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_floorf.S --- lib/msun/i387/s_floorf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_floorf.S Thu May 5 00:54:29 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_truncf.S --- lib/msun/i387/s_truncf.S.orig Sat Apr 16 23:12:55 2005 +++ lib/msun/i387/s_truncf.S Thu May 5 00:54:35 2005 @@ -11,16 +11,16 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp) /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret --NMuMz9nt05w80d4+-- --lMM8JwqTlfDpEaS6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeVRlezjnobFOgrERAttYAJ9wr4ZgSr1Ds7x8gX7aFznHWYn0VwCfTTdW 5TgxJyDbX5eRSvJGT7op4Y0= =wM0H -----END PGP SIGNATURE----- --lMM8JwqTlfDpEaS6-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 23:09:32 2005 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 E569F16A4CF; Wed, 4 May 2005 23:09:31 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8813E43D4C; Wed, 4 May 2005 23:09:31 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j44N7mjg025612; Wed, 4 May 2005 19:07:48 -0400 (EDT) Date: Wed, 4 May 2005 19:07:48 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Marc Olzheim In-Reply-To: <20050504230157.GA1886@stack.nl> Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/Mixed; BOUNDARY=NMuMz9nt05w80d4+ Content-ID: Content-Disposition: INLINE X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: David Schultz cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 04 May 2005 23:09:32 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --NMuMz9nt05w80d4+ Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: Content-Disposition: INLINE On Thu, 5 May 2005, Marc Olzheim wrote: > On Thu, May 05, 2005 at 12:32:13AM +0200, Marc Olzheim wrote: > > That fixed it for me indeed. :-P > > I've applied the attached patch on my systems. > > Question remains why the truncf() doesn't trigger it and the ceilf() and > floorf() does. > And why it only triggers with threads (even a single thread is enough). For the latter, the threads library may place a stackframe on top of the swapped-out thread's stack. Without threads, or even with libthr, the thread's stack doesn't get used by anything else. -- DE --NMuMz9nt05w80d4+ Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: Content-Description: Content-Disposition: ATTACHMENT; FILENAME="fpu.patch" Index: lib/msun/i387/s_ceilf.S --- lib/msun/i387/s_ceilf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_ceilf.S Thu May 5 00:54:18 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_floorf.S --- lib/msun/i387/s_floorf.S.orig Thu Jan 13 19:58:25 2005 +++ lib/msun/i387/s_floorf.S Thu May 5 00:54:29 2005 @@ -13,17 +13,17 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp); /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret Index: lib/msun/i387/s_truncf.S --- lib/msun/i387/s_truncf.S.orig Sat Apr 16 23:12:55 2005 +++ lib/msun/i387/s_truncf.S Thu May 5 00:54:35 2005 @@ -11,16 +11,16 @@ movl %esp,%ebp subl $8,%esp =20 - fstcw -12(%ebp) /* store fpu control word */ - movw -12(%ebp),%dx + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ - movw %dx,-16(%ebp) - fldcw -16(%ebp) /* load modfied control word */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ =20 flds 8(%ebp) /* round */ frndint =20 - fldcw -12(%ebp) /* restore original control word */ + fldcw -4(%ebp) /* restore original control word */ =20 leave ret --NMuMz9nt05w80d4+-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 23:22:38 2005 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 BC96916A4CE; Wed, 4 May 2005 23:22:38 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7645143D7C; Wed, 4 May 2005 23:22:38 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 998D01F088; Thu, 5 May 2005 01:21:36 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 7A80C6393; Thu, 5 May 2005 01:21:36 +0200 (CEST) Date: Thu, 5 May 2005 01:21:36 +0200 From: Marc Olzheim To: Daniel Eischen Message-ID: <20050504232136.GD1886@stack.nl> References: <20050504230157.GA1886@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kvUQC+jR9YzypDnK" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Marc Olzheim cc: David Schultz cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 23:22:38 -0000 --kvUQC+jR9YzypDnK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 04, 2005 at 07:07:48PM -0400, Daniel Eischen wrote: > > Question remains why the truncf() doesn't trigger it and the ceilf() and > > floorf() does. I just checked all files in /usr/src/lib/msun/i387/. The following functions are the only ones using stackspace in the i387 dir, the rest just uses the arguments directly: ceil*(), floor*(), {,l}lrint*(), trunc*(). Of those, only the ceilf(),floorf() and truncf() used more than %esp was lowered. > > And why it only triggers with threads (even a single thread is enough). >=20 > For the latter, the threads library may place a stackframe on > top of the swapped-out thread's stack. Without threads, or > even with libthr, the thread's stack doesn't get used by > anything else. Ah, that explains. Thanks a lot, Daniel and David, for your help and time today! Marc --kvUQC+jR9YzypDnK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeVkAezjnobFOgrERAmFmAKC/zsD38W54raMw3i+b/Au/TuNX3gCgzCDx oweH6vCoN1c0I0N00YZS8XY= =nkLN -----END PGP SIGNATURE----- --kvUQC+jR9YzypDnK-- From owner-freebsd-threads@FreeBSD.ORG Wed May 4 23:40:30 2005 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 8033A16A4CE; Wed, 4 May 2005 23:40:30 +0000 (GMT) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 349E043D1F; Wed, 4 May 2005 23:40:30 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id E32311F0E1; Thu, 5 May 2005 01:39:25 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id C77C06393; Thu, 5 May 2005 01:39:25 +0200 (CEST) Date: Thu, 5 May 2005 01:39:25 +0200 From: Marc Olzheim To: David Schultz Message-ID: <20050504233925.GA3436@stack.nl> References: <20050504205745.GH76171@stack.nl> <20050504221825.GA22732@VARK.MIT.EDU> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <20050504221825.GA22732@VARK.MIT.EDU> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i cc: Daniel Eischen cc: Marc Olzheim cc: freebsd-threads@freebsd.org Subject: Re: Floating point exceptions with -pthread 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: Wed, 04 May 2005 23:40:30 -0000 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 04, 2005 at 06:18:25PM -0400, David Schultz wrote: > Yeah, that part is fine. The one odd thing I notice as a glance > back at the code is that it uses -12(%ebp) and -16(%ebp) for > temporary storage, instead of using -4(%ebp) and -8(%ebp) like > the double versions. That's probably a cut-and-pasto on my > part. *doh* NetBSD cvsweb /usr/src/lib/libm/arch/i387/s_floorf.S: -----8<---------8<-----------8<----- Revision 1.3.16.1 / (download) - annotate - [select for diffs], Thu Mar 28 22:55:09 2002 UTC (3 years, 1 month ago) by he Branch: netbsd-1-5 CVS Tags: netbsd-1-5-PATCH003 Changes since 1.3: +6 -6 lines Diff to previous 1.3 (colored) next main 1.4 (colored) Pull up revision 1.5 (requested by fvdl): Fix stack usage so that a signal delivered in ceil() or floor() no longer corrupts the stack. -----8<---------8<-----------8<----- Versions before it looked an awful lot like the one we just fixed. :-/ It seems as though a look into the other NetBSD patches might be worthwile... Marc --ZPt4rx8FFjLCG7dd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFCeV0tezjnobFOgrERAnkVAKDHa3EuK4+msHxn4EznuLLsZ1K8HwCgo4jK 0la8NLb7HtzPCnqS0bI98jI= =qp+2 -----END PGP SIGNATURE----- --ZPt4rx8FFjLCG7dd-- From owner-freebsd-threads@FreeBSD.ORG Thu May 5 00:33:48 2005 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 4524916A4CE; Thu, 5 May 2005 00:33:48 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA23A43D54; Thu, 5 May 2005 00:33:47 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.3/8.13.1) with ESMTP id j450TUvV023302; Wed, 4 May 2005 20:29:30 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.MIT.EDU (8.13.3/8.13.1/Submit) id j450TUXP023301; Wed, 4 May 2005 20:29:30 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 4 May 2005 20:29:30 -0400 From: David Schultz To: Marc Olzheim Message-ID: <20050505002930.GA23253@VARK.MIT.EDU> References: <20050504205745.GH76171@stack.nl> <20050504221825.GA22732@VARK.MIT.EDU> <20050504233925.GA3436@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050504233925.GA3436@stack.nl> cc: Daniel Eischen cc: freebsd-threads@FreeBSD.ORG Subject: Re: Floating point exceptions with -pthread 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, 05 May 2005 00:33:48 -0000 On Thu, May 05, 2005, Marc Olzheim wrote: > On Wed, May 04, 2005 at 06:18:25PM -0400, David Schultz wrote: > > Yeah, that part is fine. The one odd thing I notice as a glance > > back at the code is that it uses -12(%ebp) and -16(%ebp) for > > temporary storage, instead of using -4(%ebp) and -8(%ebp) like > > the double versions. That's probably a cut-and-pasto on my > > part. > > *doh* > > NetBSD cvsweb /usr/src/lib/libm/arch/i387/s_floorf.S: > > -----8<---------8<-----------8<----- > Revision 1.3.16.1 / (download) - annotate - [select for diffs], Thu Mar 28 22:55:09 2002 UTC (3 years, 1 month ago) by he > Branch: netbsd-1-5 > CVS Tags: netbsd-1-5-PATCH003 > Changes since 1.3: +6 -6 lines > Diff to previous 1.3 (colored) next main 1.4 (colored) > > Pull up revision 1.5 (requested by fvdl): > Fix stack usage so that a signal delivered in ceil() or floor() > no longer corrupts the stack. > -----8<---------8<-----------8<----- > > Versions before it looked an awful lot like the one we just fixed. :-/ > > It seems as though a look into the other NetBSD patches might be > worthwile... Heh, guess what version I imported? /* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */ Well, I'm glad that at least *I* didn't write it. ;-) I'm really swamped right now due to the confluence of several deadlines, but I'll import the fix as soon as I get a free moment. (Anyone else is welcome to preempt me...) From owner-freebsd-threads@FreeBSD.ORG Fri May 6 08:20:04 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 838E916A4CE for ; Fri, 6 May 2005 08:20:04 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5275F43D45 for ; Fri, 6 May 2005 08:20:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j468K4KO097112 for ; Fri, 6 May 2005 08:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j468K4Uj097111; Fri, 6 May 2005 08:20:04 GMT (envelope-from gnats) Date: Fri, 6 May 2005 08:20:04 GMT Message-Id: <200505060820.j468K4Uj097111@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Subject: Re: threads/72953: fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYSTEM X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 08:20:04 -0000 The following reply was made to PR threads/72953; it has been noted by GNATS. From: David Xu To: bug-followup@freebsd.org, marka@daemon.lab.isc.org Cc: Subject: Re: threads/72953: fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYSTEM Date: Fri, 06 May 2005 16:20:05 +0800 Can you still reproduce it on RELENG-5 or -CURRENT ? David Xu From owner-freebsd-threads@FreeBSD.ORG Fri May 6 08:40:05 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6137116A4CE for ; Fri, 6 May 2005 08:40:05 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3309F43D6B for ; Fri, 6 May 2005 08:40:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j468e593006596 for ; Fri, 6 May 2005 08:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j468e4IB006589; Fri, 6 May 2005 08:40:04 GMT (envelope-from gnats) Date: Fri, 6 May 2005 08:40:04 GMT Message-Id: <200505060840.j468e4IB006589@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Subject: Re: threads/74370: Cannot get lwp 0 registers in gdb X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 08:40:05 -0000 The following reply was made to PR threads/74370; it has been noted by GNATS. From: David Xu To: bug-followup@freebsd.org, bland@freebsd.org Cc: Subject: Re: threads/74370: Cannot get lwp 0 registers in gdb Date: Fri, 06 May 2005 16:33:19 +0800 Can you still reproduce on -CURRENT ? David Xu From owner-freebsd-threads@FreeBSD.ORG Fri May 6 11:40:05 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FC2C16A4D0 for ; Fri, 6 May 2005 11:40:05 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 459AB43D69 for ; Fri, 6 May 2005 11:40:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j46Be5WC074487 for ; Fri, 6 May 2005 11:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j46Be5I3074486; Fri, 6 May 2005 11:40:05 GMT (envelope-from gnats) Date: Fri, 6 May 2005 11:40:05 GMT Message-Id: <200505061140.j46Be5I3074486@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Alexander Nedotsukov Subject: Re: threads/74370: Cannot get lwp 0 registers in gdb X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Alexander Nedotsukov List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2005 11:40:05 -0000 The following reply was made to PR threads/74370; it has been noted by GNATS. From: Alexander Nedotsukov To: David Xu Cc: bug-followup@FreeBSD.org Subject: Re: threads/74370: Cannot get lwp 0 registers in gdb Date: Fri, 06 May 2005 20:36:10 +0900 No. It seems to work now. Thanks! From owner-freebsd-threads@FreeBSD.ORG Fri May 6 13:55:06 2005 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20E3C16A4D3; Fri, 6 May 2005 13:55:06 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id F013D43D98; Fri, 6 May 2005 13:55:05 +0000 (GMT) (envelope-from davidxu@FreeBSD.org) Received: from freefall.freebsd.org (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j46Dt5lY093538; Fri, 6 May 2005 13:55:05 GMT (envelope-from davidxu@freefall.freebsd.org) Received: (from davidxu@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j46Dt5fs093534; Fri, 6 May 2005 13:55:05 GMT (envelope-from davidxu) Date: Fri, 6 May 2005 13:55:05 GMT From: David Xu Message-Id: <200505061355.j46Dt5fs093534@freefall.freebsd.org> To: bland@FreeBSD.org, davidxu@FreeBSD.org, freebsd-threads@FreeBSD.org Subject: Re: threads/74370: Cannot get lwp 0 registers in gdb 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: Fri, 06 May 2005 13:55:06 -0000 Synopsis: Cannot get lwp 0 registers in gdb State-Changed-From-To: open->closed State-Changed-By: davidxu State-Changed-When: Fri May 6 13:54:10 GMT 2005 State-Changed-Why: Fixed in -CURRENT. http://www.freebsd.org/cgi/query-pr.cgi?pr=74370 From owner-freebsd-threads@FreeBSD.ORG Fri May 6 14:49:21 2005 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 BBAF516A4D5 for ; Fri, 6 May 2005 14:49:21 +0000 (GMT) Received: from smtp1.wanadoo.fr (smtp1.wanadoo.fr [193.252.22.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E9E543D7B for ; Fri, 6 May 2005 14:49:21 +0000 (GMT) (envelope-from lists@nbux.com) Received: from me-wanadoo.net (loopback.pool.com [127.0.0.1]) by mwinf0103.wanadoo.fr (SMTP Server) with ESMTP id 9D1101F926A6 for ; Fri, 6 May 2005 16:49:20 +0200 (CEST) Received: from daneel.nbux.com (LNeuilly-152_22-15-131.w82-127.abo.wanadoo.fr [82.127.94.131]) by mwinf0103.wanadoo.fr (SMTP Server) with ESMTP id 8268A1F926A3 for ; Fri, 6 May 2005 16:49:20 +0200 (CEST) X-ME-UUID: 20050506144920534.8268A1F926A3@mwinf0103.wanadoo.fr Received: from webmail.nbux.com (daneel.nbux.com [192.168.42.2]) by daneel.nbux.com (Postfix) with ESMTP id D43EA7F494 for ; Fri, 6 May 2005 16:49:17 +0200 (CEST) Received: from 194.51.215.62 (SquirrelMail authenticated user lists) by webmail.nbux.com with HTTP; Fri, 6 May 2005 16:49:17 +0200 (CEST) Message-ID: <35172.194.51.215.62.1115390957.squirrel@webmail.nbux.com> Date: Fri, 6 May 2005 16:49:17 +0200 (CEST) From: "Christophe Yayon" To: freebsd-threads@freebsd.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: yes Subject: pthread and nagios issue 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: Fri, 06 May 2005 14:49:21 -0000 Hi all, i am upgrading our nagios 1.2 (on freebsd 5.3-release) to nagios 2.0 (currently last cvs after 2.0b3) on Freebsd-5.4RC3 and i saw a very strange thing. After few hours, nagios main process (nagios -d ...) use lot of cpu time and when i do a truss on the pid, i have a "kse_release" loop message. # top last pid: 75729; load averages: 1.81, 2.08, 2.03 63 processes: 2 running, 61 sleeping CPU states: 12.5% user, 0.0% nice, 16.0% system, 0.0% interrupt, 71.5% idle Mem: 36M Active, 1639M Inact, 219M Wired, 68M Cache, 112M Buf, 44M Free Swap: 5000M Total, 52K Used, 5000M Free PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND 40435 nagios 112 0 4688K 3544K CPU0 0 569:46 93.99% 93.99% nagios [...] # truss -p 40435 kse_release(0xbfbf9b70) ERR#22 "Invalid argument" kse_release(0xbfbf9b70) ERR#22 "Invalid argument" kse_release(0xbfbf9b70) ERR#22 "Invalid argument" [...] I know there is a pthread_acquire() issue with Nagios and FreeBSD threads, but is there any patch against this ? Thanks in advance...