NetBSD Problem Report #32420

From tsutsui@ceres.dti.ne.jp  Sat Dec 31 06:05:58 2005
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from smtp02.dti.ne.jp (smtp02.dti.ne.jp [202.216.228.138])
	by narn.netbsd.org (Postfix) with ESMTP id EEC7A63B869
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 31 Dec 2005 06:05:57 +0000 (UTC)
Message-Id: <200512310605.jBV65pE0002145@mirage.ceres.dti.ne.jp>
Date: Sat, 31 Dec 2005 15:05:51 +0900 (JST)
From: tsutsui@ceres.dti.ne.jp
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: NetBSD/sun2 3.0 INSTALL kernel hangs during boot
X-Send-Pr-Version: 3.95

>Number:         32420
>Category:       port-sun2
>Synopsis:       NetBSD/sun2 3.0 INSTALL kernel hangs during boot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sun2-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 31 06:10:00 +0000 2005
>Closed-Date:    Tue Apr 25 14:16:55 +0000 2006
>Last-Modified:  Tue Apr 25 14:16:55 +0000 2006
>Originator:     Izumi Tsutsui
>Release:        NetBSD 3.0 release
>Organization:
>Environment:
Sun2/120 emulation on tme (installed from pkgsrc/emulators/tme)
Architecture: m68k (m68000)
Machine: sun2
>Description:
While RAMDISK and FORMEG kernels in 3.0 boot and work fine on tme,
INSTALL kernel (both in miniroot.fs and NetBSD-3.0/sun2/binary/kernel dir)
hangs during boot:
---
>b st()
Boot: st(0,0,0)
>> NetBSD/sun2 tapeboot [1.12]
tapeboot: loading segment 4
996532+65928 [93632+81419]=0x12e4e4
relocating program...Starting program at 0x6000
console is keyboard/display
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All right reserved.

NetBSD 3.0 (INSTALL) #0: Mon Dec 19 04:13:00 UTC 2005
	builds@b2.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/sun2/200512182024Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/sun2/compile/INSTALL
Model: sun2 {120,170}
fpu: no math support
total memory = 4096 KB
avail memory = 2822 KB
mainbus0 (root)
obio0 at mainbus0
zs0 at obio0 addr 0x2000 ipl 6 softpri 3
zstty0 at zs0 channel 0
[ ... hangs here ]
---

Note INSTALL kernel in 1.6 also worked.

>How-To-Repeat:
Boot sun2 INSTALL kernel on tme:

% (cd [somewhere]/pkgsrc/emulators/tme && make update)
 :
% mkdir tme-sun2; cd tme-sun2
% cp /usr/pkg/share/examples/tme/SUN2-MULTIBUS ./MY-SUN2
% ftp http://theory.lcs.mit.edu/~fredette/tme/sun2-multi-rev-R.bin
 :
% tme-sun-idprom 2/120 8:0:20:00:00:01 > my-sun2-idprom.bin
% cp /usr/pkg/share/examples/tme/sun-keyboards.txt .
% cp /usr/pkg/share/examples/tme/my-sun-macros.txt .
% mkdir my-tape
% (cd my-tape; ftp http://theory.lcs.mit.edu/~fredette/tme/sun2-tapeboot.bin)
 :
% (cd my-tape; ftp ftp://ftp.dti.ad.jp/pub/NetBSD/NetBSD-3.0/sun2/binary/kernel/netbsd-INSTALL.gz)
 :
% (cd my-tape; gunzip netbsd-INSTALL)
% (cd my-tape; ln -s sun2-tapeboot.bin 01; touch 02; touch 03; touch 04)
% (cd my-tape; ln -s netbsd-INSTALL 05)
% env LTDL_LIBRARY_PATH=/usr/pkg/lib tmesh MY-SUN2
 :
tmesh> command tape0 load my-tape/01 my-tape/02 my-tape/03 my-tape/04 my-tape/05
tmesh> command mainbus0 power up
 :
- type "b st()" on PROM monitor prompt (on tmesh window)


>Fix:
Removing "options MALLOC_NOINLINE" from sun2/conf/INSTALL config
seems to resolve this, but I'm not sure why.
(RAMDISK and FOURMEG don't have the option)

>Release-Note:

>Audit-Trail:
From: Greg Oster <oster@cs.usask.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot 
Date: Tue, 04 Apr 2006 16:13:32 -0600

 tsutsui@ceres.dti.ne.jp writes:
 > >Number:         32420
 > >Category:       port-sun2
 > >Synopsis:       NetBSD/sun2 3.0 INSTALL kernel hangs during boot
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    port-sun2-maintainer
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Dec 31 06:10:00 +0000 2005
 > >Originator:     Izumi Tsutsui
 > >Release:        NetBSD 3.0 release
 > >Organization:
 > >Environment:
 > Sun2/120 emulation on tme (installed from pkgsrc/emulators/tme)
 > Architecture: m68k (m68000)
 > Machine: sun2
 > >Description:
 > While RAMDISK and FORMEG kernels in 3.0 boot and work fine on tme,
 > INSTALL kernel (both in miniroot.fs and NetBSD-3.0/sun2/binary/kernel dir)
 > hangs during boot:
 > ---
 > >b st()
 > Boot: st(0,0,0)
 > >> NetBSD/sun2 tapeboot [1.12]
 > tapeboot: loading segment 4
 > 996532+65928 [93632+81419]=0x12e4e4
 > relocating program...Starting program at 0x6000
 > console is keyboard/display
 > Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 >     The NetBSD Foundation, Inc.  All rights reserved.
 > Copyright (c) 1982, 1986, 1989, 1991, 1993
 >     The Regents of the University of California.  All right reserved.
 > 
 > NetBSD 3.0 (INSTALL) #0: Mon Dec 19 04:13:00 UTC 2005
 > 	builds@b2.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/sun2/2005121820
 > 24Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/sun2/compile/INSTALL
 > Model: sun2 {120,170}
 > fpu: no math support
 > total memory = 4096 KB
 > avail memory = 2822 KB
 > mainbus0 (root)
 > obio0 at mainbus0
 > zs0 at obio0 addr 0x2000 ipl 6 softpri 3
 > zstty0 at zs0 channel 0
 > [ ... hangs here ]
 > ---

 I see this with twe emulating a sun3/160, and attempting to boot a
 sun3 NetBSD 3.0 RAMDISK kernel.  I don't see the problem when booting 
 an INSTALL kernel though.

 > >Fix:
 > Removing "options MALLOC_NOINLINE" from sun2/conf/INSTALL config
 > seems to resolve this, but I'm not sure why.
 > (RAMDISK and FOURMEG don't have the option)

 I'm not sure what I should change w/ RAMDISK to make it work..

 Later...

 Greg Oster


From: Greg Oster <oster@cs.usask.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot 
Date: Wed, 05 Apr 2006 08:34:22 -0600

 tsutsui@ceres.dti.ne.jp writes:
 > >Number:         32420
 > >Category:       port-sun2
 > >Synopsis:       NetBSD/sun2 3.0 INSTALL kernel hangs during boot
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    port-sun2-maintainer
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Dec 31 06:10:00 +0000 2005
 > >Originator:     Izumi Tsutsui
 > >Release:        NetBSD 3.0 release
 > >Organization:
 > >Environment:
 > Sun2/120 emulation on tme (installed from pkgsrc/emulators/tme)
 > Architecture: m68k (m68000)
 > Machine: sun2
 > >Description:
 > While RAMDISK and FORMEG kernels in 3.0 boot and work fine on tme,
 > INSTALL kernel (both in miniroot.fs and NetBSD-3.0/sun2/binary/kernel dir)
 > hangs during boot:
 > ---
 > >b st()
 > Boot: st(0,0,0)
 > >> NetBSD/sun2 tapeboot [1.12]
 > tapeboot: loading segment 4
 > 996532+65928 [93632+81419]=0x12e4e4
 > relocating program...Starting program at 0x6000
 > console is keyboard/display
 > Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 >     The NetBSD Foundation, Inc.  All rights reserved.
 > Copyright (c) 1982, 1986, 1989, 1991, 1993
 >     The Regents of the University of California.  All right reserved.
 > 
 > NetBSD 3.0 (INSTALL) #0: Mon Dec 19 04:13:00 UTC 2005
 > 	builds@b2.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/sun2/2005121820
 > 24Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/sun2/compile/INSTALL
 > Model: sun2 {120,170}
 > fpu: no math support
 > total memory = 4096 KB
 > avail memory = 2822 KB
 > mainbus0 (root)
 > obio0 at mainbus0
 > zs0 at obio0 addr 0x2000 ipl 6 softpri 3
 > zstty0 at zs0 channel 0
 > [ ... hangs here ]

 Another datapoint: If I remove zstty1 from the RAMDISK kernel config 
 for sun3, then the RAMDISK kernel gets past this hang point...

 I note that in obio.sun3 we have:
 zsc0    at obio0 addr 0x000000
 zsc1    at obio0 addr 0x020000

 but the default config for tme says:
 zs0 at obio0 addr 0x020000 ipl 6: tme/machine/sun3/zs
 zs1 at obio0 addr 0x000000 ipl 6: tme/machine/sun3/zs

 which would swap around zstty0 and zstty1 ??

 Later...

 Greg Oster


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: port-sun2-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
	oster@cs.usask.ca, tsutsui@ceres.dti.ne.jp
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot

Date: Thu, 6 Apr 2006 20:45:05 +0900

 >  which would swap around zstty0 and zstty1 ??

 Both zstty0 and zstty is on zs0, so I don't think it's the matter.

 BTW, today I've tried 3.0_STABLE, and sun2 INSTALL kernel
 no longer hangs. I'll try track which change fixes the problem.
 (it looks like malloc(9) issue, but not sure)
 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: port-sun2-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
	oster@cs.usask.ca, tsutsui@ceres.dti.ne.jp
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot
Date: Thu, 6 Apr 2006 21:35:42 +0900

 > BTW, today I've tried 3.0_STABLE, and sun2 INSTALL kernel
 > no longer hangs. I'll try track which change fixes the problem.
 > (it looks like malloc(9) issue, but not sure)

 Hmm, the following change seems to fixes the problem:

 ---
 Index: dev/ic/z8530tty.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/z8530tty.c,v
 retrieving revision 1.97
 diff -u -r1.97 z8530tty.c
 --- dev/ic/z8530tty.c	27 Feb 2005 00:27:03 -0000	1.97
 +++ dev/ic/z8530tty.c	6 Apr 2006 12:19:20 -0000
 @@ -399,7 +399,12 @@
  	tty_attach(tp);

  	zst->zst_tty = tp;
 -	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK);
 +	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
 +	if (zst->zst_rbuf == NULL) {
 +		aprint_error("%s: unable to allocate ring buffer\n",
 +		    zst->zst_dev.dv_xname);
 +		return;
 +	}
  	zst->zst_ebuf = zst->zst_rbuf + (zstty_rbuf_size << 1);
  	/* Disable the high water mark. */
  	zst->zst_r_hiwat = 0;
 ---

 though it's not in netbsd-3. (just memory usage has been changed?)

 BTW netbsd-RAMDISK in 3.0-relrease on tme with sun3/150 emutation
 works fine to me.
 ---
 Izumi Tsutsui

From: Greg Oster <oster@cs.usask.ca>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot 
Date: Thu, 06 Apr 2006 09:02:31 -0600

 Izumi Tsutsui writes:
 > > BTW, today I've tried 3.0_STABLE, and sun2 INSTALL kernel
 > > no longer hangs. I'll try track which change fixes the problem.
 > > (it looks like malloc(9) issue, but not sure)
 > 
 > Hmm, the following change seems to fixes the problem:

 > -	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK);
 > +	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT);

 Is the system just running out of kernel memory then?  I'm not sure 
 how much memory a sun2 box can have, but if you bump up the amount of 
 RAM in tme, does the problem go away?  (I dont't think it did for me 
 on sun3..)

 Later...

 Greg Oster


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: port-sun2-maintainer@netbsd.org, gnats-admin@netbsd.org,
	oster@cs.usask.ca, tsutsui@ceres.dti.ne.jp
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot

Date: Fri, 7 Apr 2006 00:15:34 +0900

 In article <20060406150503.67D7F63B896@narn.netbsd.org>
 oster@cs.usask.ca wrote:

 >  > -	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK);
 >  > +	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
 >  
 >  Is the system just running out of kernel memory then?

 With M_NOWAIT, malloc(9) doesn't fail. As noted in the PR,
 it also works if options MALLOC_NOINLINE is not specified. Umm.

 >  I'm not sure 
 >  how much memory a sun2 box can have, but if you bump up the amount of 
 >  RAM in tme, does the problem go away?  (I dont't think it did for me 
 >  on sun3..)

 sun2 on tme only has 4MB and can't bump than it,
 but the FOURMEG kernel works fine even on multiuser.

 Anyway, I don't think we can use M_WAITOK during autoconfiguration.
 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/32420 CVS commit: src/sys/dev/ic
Date: Wed, 19 Apr 2006 17:44:07 +0000 (UTC)

 Module Name:	src
 Committed By:	tsutsui
 Date:		Wed Apr 19 17:44:07 UTC 2006

 Modified Files:
 	src/sys/dev/ic: z8530tty.c

 Log Message:
 - use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
   in zstty_attach()
 - check a return value of the malloc(9)

 Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.


 To generate a diff of this commit:
 cvs rdiff -r1.105 -r1.106 src/sys/dev/ic/z8530tty.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: port-sun2-maintainer@netbsd.org, gnats-admin@netbsd.org,
	tsutsui@ceres.dti.ne.jp
Subject: Re: port-sun2/32420: NetBSD/sun2 3.0 INSTALL kernel hangs during boot

Date: Sun, 23 Apr 2006 11:06:54 +0900

 In article <20060406150503.67D7F63B896@narn.netbsd.org>
 oster@cs.usask.ca wrote:

 >  > -	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK);
 >  > +	zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT);
 >  
 >  Is the system just running out of kernel memory then?

 Hmm, adding a nop before splzs() in zstty_attach() also fixes
 the hang:
 ---
 Index: dev/ic/z8530tty.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/z8530tty.c,v
 retrieving revision 1.97
 diff -u -r1.97 z8530tty.c
 --- dev/ic/z8530tty.c	27 Feb 2005 00:27:03 -0000	1.97
 +++ dev/ic/z8530tty.c	23 Apr 2006 02:02:57 -0000
 @@ -449,6 +449,7 @@
  		resetbit = (channel == 0) ? ZSWR9_A_RESET : ZSWR9_B_RESET;
  	}

 +asm("nop");
  	s = splzs();
  	simple_lock(&cs->cs_lock);
  	if (resetbit)
 ---
 so it smells some timing problem on tme around interrupt emulation.

 I'll close this PR unless someone reports the same problem
 on real hardware, since -current, netbsd-3, and netbsd-3-0
 don't have this problem anyway.
 ---
 Izumi Tsutsui

State-Changed-From-To: open->closed
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Tue, 25 Apr 2006 14:16:55 +0000
State-Changed-Why:
- -current, netbsd-3, and netbsd-3-0 no longer have this problem
- not sure if this also happens on real hardware (not on tme)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.