Subject: Re: port-sparc64/37499 (sparc64 GENERIC / INSTALL kernels occasional panic on boot)
To: None <jdc@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Julian Coleman <jdc@coris.org.uk>
List: netbsd-bugs
Date: 12/08/2007 14:25:02
The following reply was made to PR port-sparc64/37499; it has been noted by GNATS.

From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@NetBSD.org
Cc: martin@NetBSD.org
Subject: Re: port-sparc64/37499 (sparc64 GENERIC / INSTALL kernels occasional panic on boot)
Date: Sat, 8 Dec 2007 14:22:02 +0000

 > Julian has analyzed the problem and has a patch already
 
 Analised the problem, yes.  Patch, sort of - more of a hack ;-)
 
 The problem is that we die in gem_rint(), on line 1523:
 
 		m->m_data += 2; /* We're already off by two */ 
 
 This is because we assign `m' on line 1514:
   
 		m = rxs->rxs_mbuf;
 
 and `rxs' hasn't been set up because gem_init() and gem_meminit() haven't
 yet run.
 
 So, the patch^Whack is:
 
   - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
 --- src/sys/dev/ic/gem.c.dist   2007-12-03 15:21:08.000000000 +0000
 +++ src/sys/dev/ic/gem.c        2007-12-04 22:21:48.000000000 +0000
 @@ -1448,6 +1448,11 @@
 
 	DPRINTF(sc, ("%s: gem_rint\n", sc->sc_dev.dv_xname));
 
 +if ((ifp->if_flags & IFF_UP) == 0) {
 +printf("gem_rint() whilst !IFF_UP\n");
 +return 1;
 +} 
 +
 	/*
 	 * Read the completion register once.  This limits
 	 * how long the following loop can execute.
   - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
 
 I'm curious why we get the interrupt at this point though, because I thought
 we had disabled RX and TX interrupts.  I see the printf() fire only once on
 a network booted Blade 100, both with OF version 4.5 and also with 4.17.
 
 Martin suggested using a variable that is set when meminit() runs and just
 ignoring interrupts if the variable is unset.  I think that this is probably
 the best way - the interrupt seems harmless otherwise.
 
 J
 
 -- 
   My other computer also runs NetBSD    /        Sailing at Newbiggin
         http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/