From owner-freebsd-sparc64@FreeBSD.ORG Wed Jul 30 09:36:41 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA6D437B401 for ; Wed, 30 Jul 2003 09:36:41 -0700 (PDT) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 78EFA43FA3 for ; Wed, 30 Jul 2003 09:36:40 -0700 (PDT) (envelope-from tmoestl@gmx.net) Received: (qmail 10478 invoked by uid 65534); 30 Jul 2003 16:36:39 -0000 Received: from p508E7363.dip.t-dialin.net (EHLO galatea.local) (80.142.115.99) by mail.gmx.net (mp002) with SMTP; 30 Jul 2003 18:36:39 +0200 Received: from tmm by galatea.local with local (Exim 4.20 #1) id 19htwi-000IPQ-JX; Wed, 30 Jul 2003 18:37:00 +0200 Date: Wed, 30 Jul 2003 18:37:00 +0200 From: Thomas Moestl To: Andrew Belashov Message-ID: <20030730163659.GA662@crow.dom2ip.de> Mail-Followup-To: Andrew Belashov , freebsd-sparc64@freebsd.org References: <3F210BF6.6070001@orel.ru> <20030725153258.GE10708@funkthat.com> <3F27A5DB.2050601@orel.ru> <3F27C756.6070201@orel.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <3F27C756.6070201@orel.ru> User-Agent: Mutt/1.4.1i Sender: Thomas Moestl cc: freebsd-sparc64@freebsd.org Subject: Re: fork&Perl BUG X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2003 16:36:42 -0000 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, 2003/07/30 at 17:25:42 +0400, Andrew Belashov wrote: > I modified Perl by adding sleep(10) in parent after fork(): > --------------------------------------------------------------------- > --- pp_sys.c.orig Fri Apr 6 08:38:46 2001 > +++ pp_sys.c Wed Jul 30 17:17:50 2003 > @@ -3703,6 +3703,9 @@ > if ((tmpgv = gv_fetchpv("$", TRUE, SVt_PV))) > sv_setiv(GvSV(tmpgv), (IV)PerlProc_getpid()); > hv_clear(PL_pidstatus); /* no kids, so don't wait for 'em */ > + } else { > + /* PARENT */ > + sleep(10); > } > PUSHi(childpid); > RETURN; > --------------------------------------------------------------------- > > and my test script working OK!!! > --------------------------------------------------------------------- > (gdb) run perlbug.pl 80000 > Starting program: /usr/ports/lang/perl5.debug/work/perl-5.6.1/perl > perlbug.pl 80000 > ................................................................................ > Main: sum = 39977.1619376211, cnt = 80000 > Child working... > Child: sum = 39977.1619376211, cnt = 80000 > Child exiting... > Child pid = 92042 > Parent working... > Parent: sum = 39977.1619376211, cnt = 80000 > Parent waiting a child... > Parent exiting... > --------------------------------------------------------------------- > > IMHO, it is bug in fork(2). This was indeed caused by a kernel bug in the sparc64 pmap, which affected fork() among other things. I've just committed a fix (attached); can you please test it to make sure that it really resolves this problem? Thanks for the report and analysis! - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="protect.diff" Index: sys/sparc64/sparc64/pmap.c =================================================================== RCS file: /vol/ncvs/src/sys/sparc64/sparc64/pmap.c,v retrieving revision 1.118 diff -u -r1.118 pmap.c --- sys/sparc64/sparc64/pmap.c 6 Jul 2003 20:32:42 -0000 1.118 +++ sys/sparc64/sparc64/pmap.c 30 Jul 2003 16:08:09 -0000 @@ -1161,7 +1161,7 @@ if ((data & TD_W) != 0 && pmap_track_modified(pm, va)) vm_page_dirty(m); } - return (0); + return (1); } /* --3MwIy2ne0vdjdPXF--