[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

aac success w/ PERC 3/Di



I made a small change to my previous patch and have been running for
days now with no problems.  I set sc->sc_link.openings to 128 instead of
the original 512.  This patch also incorporates a hack to check and
recover from running short of ccb's for debugging purposes, but it has 
never been triggered.

I tortured both containers simultaneously for hours and didn't have a
single lock up or error message.  The patch and dmesg are below.  I'd
be curious to hear if anyone else running a 3/Di has success with this
patch.

I got the idea to play around with openings more after reading about a
buggy NetBSD driver having problems depending on the number of SCSI bus
targets.  Judging from the OpenBSD twe driver I guess the correct thing 
to do would be something like:

	sc->sc_link.openings = AAC_ADAP_NORM_CMD_ENTRIES / nunits;

where nunits is the number of containers in the array, but I haven't had
a chance to test this.


Index: aac.c
===================================================================
RCS file: /home/cvsup/src/sys/dev/ic/aac.c,v
retrieving revision 1.14
diff -c -r1.14 aac.c
*** aac.c	27 Mar 2002 15:02:59 -0000	1.14
--- aac.c	6 May 2002 10:03:18 -0000
***************
*** 83,89 ****
  void	aac_enqueue_ccb(struct aac_softc *, struct aac_ccb *);
  int	aac_enqueue_fib(struct aac_softc *, int, struct aac_ccb *);
  void	aac_eval_mapping(u_int32_t, int *, int *, int *);
! int	aac_exec_ccb(struct aac_ccb *);
  void	aac_free_ccb(struct aac_softc *, struct aac_ccb *);
  struct aac_ccb *aac_get_ccb(struct aac_softc *, int);
  #if 0
--- 83,89 ----
  void	aac_enqueue_ccb(struct aac_softc *, struct aac_ccb *);
  int	aac_enqueue_fib(struct aac_softc *, int, struct aac_ccb *);
  void	aac_eval_mapping(u_int32_t, int *, int *, int *);
! void	aac_build_ccb(struct aac_ccb *);
  void	aac_free_ccb(struct aac_softc *, struct aac_ccb *);
  struct aac_ccb *aac_get_ccb(struct aac_softc *, int);
  #if 0
***************
*** 241,247 ****
  	sc->sc_link.adapter_softc = sc;
  	sc->sc_link.adapter = &aac_switch;
  	sc->sc_link.device = &aac_dev;
! 	sc->sc_link.openings = AAC_ADAP_NORM_CMD_ENTRIES; /* XXX optimal? */
  	sc->sc_link.adapter_buswidth = AAC_MAX_CONTAINERS;
  	sc->sc_link.adapter_target = AAC_MAX_CONTAINERS;
  
--- 241,247 ----
  	sc->sc_link.adapter_softc = sc;
  	sc->sc_link.adapter = &aac_switch;
  	sc->sc_link.device = &aac_dev;
! 	sc->sc_link.openings = 128; /* AAC_ADAP_NORM_CMD_ENTRIES; */ /* XXX optimal? */
  	sc->sc_link.adapter_buswidth = AAC_MAX_CONTAINERS;
  	sc->sc_link.adapter_target = AAC_MAX_CONTAINERS;
  
***************
*** 724,738 ****
  				}
  			}
  
! 			ccb = aac_get_ccb(sc, xs->flags);
! 
! 			/*
! 			 * We are out of commands, try again in a little while.
! 			 */
! 			if (ccb == NULL) {
! 				xs->error = XS_DRIVER_STUFFUP;
! 				AAC_UNLOCK(sc, lock);
! 				return (TRY_AGAIN_LATER);
  			}
  
  			ccb->ac_blockno = blockno;
--- 724,737 ----
  				}
  			}
  
! 			/* XXX evil hack so we don't die on lack of ccb's */
! 			ccb = NULL;
! 			while (ccb == NULL) {
! 				ccb = aac_get_ccb(sc, xs->flags);
! 				if (ccb == NULL) {
! 					printf("aac_get_ccb returned null\n");
! 					tsleep(&sc->sc_free_ccb, PRIBIO, "aac_ccb", 0);
! 				}
  			}
  
  			ccb->ac_blockno = blockno;
***************
*** 938,952 ****
  
  	/* Controller has a message for us? */
  	if (reason & AAC_DB_COMMAND_READY) {
- 		aac_host_command(sc);
  		AAC_CLEAR_ISTATUS(sc, AAC_DB_COMMAND_READY);
  		claimed = 1;
  	}
      
  	/* Controller has a response for us? */
  	if (reason & AAC_DB_RESPONSE_READY) {
- 		aac_host_response(sc);
  		AAC_CLEAR_ISTATUS(sc, AAC_DB_RESPONSE_READY);
  		claimed = 1;
  	}
  
--- 937,951 ----
  
  	/* Controller has a message for us? */
  	if (reason & AAC_DB_COMMAND_READY) {
  		AAC_CLEAR_ISTATUS(sc, AAC_DB_COMMAND_READY);
+ 		aac_host_command(sc);
  		claimed = 1;
  	}
      
  	/* Controller has a response for us? */
  	if (reason & AAC_DB_RESPONSE_READY) {
  		AAC_CLEAR_ISTATUS(sc, AAC_DB_RESPONSE_READY);
+ 		aac_host_response(sc);
  		claimed = 1;
  	}
  
***************
*** 1471,1486 ****
  	while ((ccb = TAILQ_FIRST(&sc->sc_ccbq)) != NULL) {
  
  		xs = ccb->ac_xs;
! 		if (ccb->ac_flags & AAC_ACF_WATCHDOG)
  			timeout_del(&xs->stimeout);
  
! 		if (aac_exec_ccb(ccb) == 0) {
  			ccb->ac_flags |= AAC_ACF_WATCHDOG;
  			timeout_set(&ccb->ac_xs->stimeout, aac_watchdog, ccb);
  			timeout_add(&xs->stimeout,
  			    (AAC_WATCH_TIMEOUT * hz) / 1000);
  			break;
  		}
  		TAILQ_REMOVE(&sc->sc_ccbq, ccb, ac_chain);
  
  		if ((xs->flags & SCSI_POLL) == 0) {
--- 1470,1493 ----
  	while ((ccb = TAILQ_FIRST(&sc->sc_ccbq)) != NULL) {
  
  		xs = ccb->ac_xs;
! 
! 		if (ccb->ac_flags & AAC_ACF_WATCHDOG) {
  			timeout_del(&xs->stimeout);
+ 		/* watchdog timer implies ccb already built */
+ 		} else {
+ 			aac_build_ccb(ccb);
+ 		}
  
! 		if (aac_start(ccb) == EBUSY) {
  			ccb->ac_flags |= AAC_ACF_WATCHDOG;
  			timeout_set(&ccb->ac_xs->stimeout, aac_watchdog, ccb);
  			timeout_add(&xs->stimeout,
  			    (AAC_WATCH_TIMEOUT * hz) / 1000);
  			break;
  		}
+ 
+ 		xs->error = XS_NOERROR;
+ 		xs->resid = 0;
  		TAILQ_REMOVE(&sc->sc_ccbq, ccb, ac_chain);
  
  		if ((xs->flags & SCSI_POLL) == 0) {
***************
*** 1491,1498 ****
  	}
  }
  
! int
! aac_exec_ccb(ccb)
  	struct aac_ccb *ccb;
  {
  	struct scsi_xfer *xs = ccb->ac_xs;
--- 1498,1505 ----
  	}
  }
  
! void
! aac_build_ccb(ccb)
  	struct aac_ccb *ccb;
  {
  	struct scsi_xfer *xs = ccb->ac_xs;
***************
*** 1504,1510 ****
  	struct aac_blockwrite *bw;
  	bus_dmamap_t xfer;
  
! 	AAC_DPRINTF(AAC_D_CMD, ("aac_exec_ccb(%p, %p) ", xs, ccb));
  
  	/* build the FIB */
  	fib = ccb->ac_fib;
--- 1511,1517 ----
  	struct aac_blockwrite *bw;
  	bus_dmamap_t xfer;
  
! 	AAC_DPRINTF(AAC_D_CMD, ("aac_build_ccb(%p, %p) ", xs, ccb));
  
  	/* build the FIB */
  	fib = ccb->ac_fib;
***************
*** 1569,1579 ****
  		    sizeof(struct aac_sg_entry);
  	}
  
! 	aac_start(ccb);
! 
! 	xs->error = XS_NOERROR;
! 	xs->resid = 0;
! 	return (1);
  }
  
  /********************************************************************************
--- 1576,1582 ----
  		    sizeof(struct aac_sg_entry);
  	}
  
! 	return;
  }
  
  /********************************************************************************

OpenBSD 3.1-current (GENERIC) #13: Sun May  5 18:01:23 EDT 2002
    root@maia:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III (Coppermine) ("GenuineIntel" 686-class) 927 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SYS,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SIMD
real mem  = 536395776 (523824K)
avail mem = 491532288 (480012K)
using 5689 buffers containing 26923008 bytes (26292K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(00) BIOS, date 05/17/01, BIOS32 rev. 0 @ 0xffe90
pcibios0 at bios0: rev. 2.1 @ 0xf0000/0x10000
pcibios0: PCI IRQ Routing Table rev. 1.0 @ 0xfc270/160 (8 entries)
pcibios0: no compatible PCI ICU found: ICU vendor 0x1166 product 0x0200
pcibios0: Warning, unable to fix up PCI interrupt routing
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc0000/0x8000 0xc8000/0x4000! 0xec000/0x4000!
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "ServerWorks CNB20HE Host" rev 0x23
pchb1 at pci0 dev 0 function 1 "ServerWorks CNB20HE Host" rev 0x01
pci1 at pchb1 bus 2
ppb0 at pci1 dev 2 function 0 "Intel i960 RM PCI-PCI" rev 0x01
pci2 at ppb0 bus 3
"Adaptec AIC-7899F" rev 0x01 at pci2 dev 4 function 0 not configured
"Adaptec AIC-7899 U160" rev 0x01 at pci2 dev 4 function 1 not configured
aac0 at pci1 dev 2 function 1 "Dell PERC 3/Di" rev 0x01: irq 5
aac0: i960RX 100MHz, 126MB, optional battery present (3) Kernel 2.5-0
scsibus0 at aac0: 64 targets
sd0 at scsibus0 targ 0 lun 0: <Adaptec, Container #00, > SCSI2 0/direct fixed
sd0: 34710MB, 4425 cyl, 255 head, 63 sec, 512 bytes/sec, 71087625 sec total
sd1 at scsibus0 targ 1 lun 0: <Adaptec, Container #01, > SCSI2 0/direct fixed
sd1: 34710MB, 4425 cyl, 255 head, 63 sec, 512 bytes/sec, 71087625 sec total
fxp0 at pci1 dev 4 function 0 "Intel 82557" rev 0x08: irq 10, address 00:b0:d0:f0:e1:0e
inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 4
pchb2 at pci0 dev 0 function 2 "ServerWorks I/O Bridge" rev 0x01
pchb3 at pci0 dev 0 function 3 "ServerWorks I/O Bridge" rev 0x01
vga1 at pci0 dev 14 function 0 "ATI Rage XL" rev 0x27
wsdisplay0 at vga1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 15 function 0 "ServerWorks ROSB4 SouthBridge" rev 0x50
pciide0 at pci0 dev 15 function 1 "ServerWorks IDE" rev 0x00: DMA (unsupported), channel 0 configured to compatibility, channel 1 configured to compatibility
atapiscsi0 at pciide0 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <SAMSUNG, CD-ROM SN-124, q009> SCSI0 5/cdrom removable
pciide0: channel 1 ignored (not responding; disabled or no drives?)
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pmsi0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pmsi0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
sysbeep0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pccom0: console
pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
biomask 4060 netmask 4460 ttymask 54e2
pctr: 686-class user-level performance counters enabled
mtrr: Pentium Pro MTRR support
dkcsum: sd0 matched BIOS disk 80
dkcsum: sd1 matched BIOS disk 81
root on sd0a
rootdev=0x400 rrootdev=0xd00 rawdev=0xd02
aac0: ** Battery charge is now OK


-- 
Brandin Claar
Assistant Research Engineer
Penn State Applied Research Lab