*BSD News Article 2600


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!network.ucsd.edu!sdd.hp.com!elroy.jpl.nasa.gov!ucla-cs!ucla-mic!scott
From: scott@pita.cns.ucla.edu (Scott Burris)
Subject: 386BSD 0.1: kmem_map too small panic fix
Message-ID: <1992Jul27.131414.12063@mic.ucla.edu>
Nntp-Posting-Host: pita.cns.ucla.edu
Reply-To: scott@pita.cns.ucla.edu (Scott Burris)
Organization: UCLA Campus Network Services
Date: 27 Jul 92 13:14:14 PDT
Lines: 55

Problem:

Sometime the kernel crashes on bootup with a kmem_map too small panic.

Solution:

To my knowledge, this only happens with SCSI systems.  In the SCSI driver,
the block size of the disk is obtained through a SCSI READ CAPACITY
command.  Unfortunately, sometimes the returned block size is insane,
causing the kernel to go belly up.

* HACK ALERT * HACK ALERT * HACK ALERT * HACK ALERT * HACK ALERT *
Although the following change fixes the problem by looping until a reasonable
looking block size is returned (never more than 1 loop in my experience),
I don't understand why the bogus information is returned in the first
place.  I consider this to be more of a hack than a fix, since the READ
CAPACITY code should work correctly the first time.

My advice is to not install this patch unless you are getting the
panic described above.

Patch follows:


*** as.c	Sun Jul 19 08:15:02 1992
--- as.c.orig	Sat Jul 18 20:10:32 1992
***************
*** 438,444 ****
  		goto done;
  	}
  
- bsagain:
  	as->scsi_cdb_len = 10;
  	bzero(cdb, 10);
  	cdb[0] = 0x25;  /* SCSI_READCAPACITY */
--- 434,439 ----
***************
*** 450,460 ****
  		
  	}
  
- 	if (as->disk && as->bs > 10000) {
- 		printf("weird bs %d\n", as->bs);
- 		goto bsagain;
- 	}
- 
  if(asverbose)
  	printf("block size %d disksize %d ", as->bs, disksize);
  
--- 445,450 ----
--
----------
Scott Burris
UCLA Campus Network Services
cnetslb@oac.ucla.edu (213) 206-4860 - OR - scott@pita.cns.ucla.edu