Subject: panic on SCSI_TEST kernel
To: None <fair@clock.org>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 11/10/1995 15:13:51
> Date: Fri, 10 Nov 1995 11:39:36 -0800
> From: "Erik E. Fair"  (Time Keeper) <fair@clock.org>
> 
> Wouldn't it be a good idea to meter the driver a little and track both the
> number of commands enqueued (see what the high water mark is), and the
> exclusion logic that is supposed to make sure that this panic can't happen?
> 
> Erik Fair

Perhaps yes.  The "high water mark" is controlled by sc_link.openings
which is used by the common SCSI code.  The common code should never
try to enqueue more commands than the number of openings advertized.

The maximum number of commands that it might ever be useful to enqueue
is the number of target/LUN destinations on your SCSI bus (max=8*8).

I just noticed something odd about sc_link.openings:
Most other SCSI drivers (i.e. aic6360) set openings=2 but
actualy have a larger number of queue slots (i.e. 8).
Seems worth while to try this for ncr_si.

(Changes attached for those who'd like to try it.)

Gordon

*** ncr5380var.h.~1~	Tue Oct 31 07:34:37 1995
--- ncr5380var.h	Fri Nov 10 12:06:26 1995
***************
*** 66,72 ****
  #define	SR_ERROR			4	/* Error occurred */
  	int		sr_status;		/* Status code from last cmd */
  };
! #define	SCI_OPENINGS	4		/* Up to 4 commands at once */
  
  
  struct ncr5380_softc {
--- 66,72 ----
  #define	SR_ERROR			4	/* Error occurred */
  	int		sr_status;		/* Status code from last cmd */
  };
! #define	SCI_OPENINGS	16		/* How many commands we can enqueue. */
  
  
  struct ncr5380_softc {

*** ncr5380sbc.c.~5~	Fri Nov  3 17:28:18 1995
--- ncr5380sbc.c	Fri Nov 10 15:03:20 1995
***************
*** 388,394 ****
  		for (j = 0; j < 8; j++)
  			sc->sc_matrix[i][j] = NULL;
  
! 	sc->sc_link.openings = SCI_OPENINGS;
  	sc->sc_prevphase = PHASE_INVALID;
  	sc->sc_msg_flags = 0;	/* XXX */
  
--- 388,394 ----
  		for (j = 0; j < 8; j++)
  			sc->sc_matrix[i][j] = NULL;
  
! 	sc->sc_link.openings = 2;	/* XXX - Not SCI_OPENINGS ? */
  	sc->sc_prevphase = PHASE_INVALID;
  	sc->sc_msg_flags = 0;	/* XXX */