From markd@osprey.grizzly.com  Fri May 23 09:02:46 1997
Received: from osprey.grizzly.com (med.sc.scruznet.com [165.227.115.28])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id JAA27126
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 23 May 1997 09:02:39 -0700 (PDT)
Received: (from markd@localhost) by osprey.grizzly.com (8.8.5/8.7.3) id JAA00427; Fri, 23 May 1997 09:04:50 -0700 (PDT)
Message-Id: <199705231604.JAA00427@osprey.grizzly.com>
Date: Fri, 23 May 1997 09:04:50 -0700 (PDT)
From: Mark Diekhans <markd@Grizzly.COM>
Reply-To: markd@Grizzly.COM
To: FreeBSD-gnats-submit@freebsd.org
Subject: SCSI tape drive with AHA 2940 locks up system.
X-Send-Pr-Version: 3.2

>Number:         3671
>Category:       kern
>Synopsis:       SCSI tape drive with AHA 2940 locks up system.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 23 09:10:01 PDT 1997
>Closed-Date:    Sun Mar 22 09:05:37 PST 1998
>Last-Modified:  Sun Mar 22 09:06:42 PST 1998
>Originator:     Mark Diekhans
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
>Environment:

   ASUS P55T2P4
   Pentium 166
   
    ahc0 <Adaptec 2940 SCSI host adapter> rev 0 int a irq 11
    ahc0: aic7870 Single Channel, SCSI Id=7, 16 SCBs
    ahc0 waiting for scsi devices to settle
    (ahc0:0:0): "HP C3725S 6039" type 0 fixed SCSI 2
    sd0(ahc0:0:0): Direct-Access 2047MB (4194058 512 byte sec
    (ahc0:1:0): "SEAGATE ST32550N 0015" type 0 fixed SCSI 2
    sd1(ahc0:1:0): Direct-Access 2047MB (4194058 512 byte sec
    (ahc0:2:0): "WANGTEK 6130-FS 3.04" type 1 removable SCSI
    st0(ahc0:2:0): Sequential-Access density code 0x13,  driv
    ahc0:A:5: refuses synchronous negotiation. Using asynchro
    (ahc0:5:0): "IOMEGA ZIP 100 D.09" type 0 removable SCSI 2
    sd2(ahc0:5:0): Direct-Access
    sd2(ahc0:5:0): ILLEGAL REQUEST asc:24,0 Invalid field in
    sd2 could not mode sense (4). Using ficticious geometry
    96MB (196608 512 byte sectors)


>Description:

   Writting DAT tape with 16K block size often often locks up the system.

>How-To-Repeat:

	yes | dd of=/dev/rst0 bs=16384

>Fix:

	
>Release-Note:
>Audit-Trail:

From: Helbig@BA-Stuttgart.DE
To: freebsd-gnats-submit@freebsd.org, markd@Grizzly.COM
Cc:  Subject: Re:kern/3671:SCSItape drive with AHA2940 locksup system.
Date: Sun, 25 May 1997 11:33:11 +0200 (MET DST)

 Here are some more facts, that might help to fix the bug.
 
 This all happened on a machine with  ASUS P55T2P4 motherboard and 
 Adaptec AHA 2940 SCSI controller while trying to install
 FreeBSD 2.2.1 from a Toshiba CDROM XM-3801 TA, SCSI-ID 2 to
 Seagate ST52160N harddisk, SCSI-ID 0.
 
 Installing with 2.2.1 boot.flp went fine till copying started
 to the HD. The system hang after about two seconds.
 
 The same happened when installing with a 2.2.2 boot.flp.
 
 <ALT F4> or <ALT F2> did not work - no panic messages.
 
 Trying to install with a 2.1.7 (*not* 2.1.7.1) boot.flp
 gave us a panic message with approximately these wordings:
 
 Target did not send identify ...
 
 A workaround consisted of setting   
 "Initiating Sync Negotiation"
 to "NO" on all SCSI-ID w/o devices and setting
 "Enable Disc Connection"
 to "YES" on all SCSI-IDs w/o devices in the Adaptec BIOS.
 Menu "Additinal Options", Submenu "SCSI Device Configuration".
 
 After this, the installation worked like a charm.
 
 Hope this helps.
 
 Wolfgang

From: Mark Diekhans <markd@Grizzly.COM>
To: Helbig@BA-Stuttgart.DE
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/3671:SCSItape drive with AHA2940 locksup system.
Date: Mon, 26 May 1997 14:33:37 -0700 (PDT)

 Thanks for the suggestions.  This didn't help.  Nor did a block size of
 512 bytes.  It appears that this problem might be related to EOT handling.
 It takes quite a while for the system to lock up, enough time for the
 tape to have been written.
 
 Mark
 
 >From: Helbig@BA-Stuttgart.DE
 >
 >Here are some more facts, that might help to fix the bug.
 >
 >A workaround consisted of setting   
 >"Initiating Sync Negotiation"
 >to "NO" on all SCSI-ID w/o devices and setting
 >"Enable Disc Connection"
 >to "YES" on all SCSI-IDs w/o devices in the Adaptec BIOS.
 >Menu "Additinal Options", Submenu "SCSI Device Configuration".
 >
 >After this, the installation worked like a charm.

From: Mark Diekhans <markd@Grizzly.COM>
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: kern/3671: SCSI tape drive with AHA 2940 locks up system.
Date: Wed, 28 May 1997 19:07:49 -0700 (PDT)

 More information on this bug:
   It appears to occurs at tape close time no matter how much of the tape
 has been written or what the block size is.  The following messages appeared
 on the console (transcribed by hand) before the system hung:
 
 st0(ahc0:2:0): SCB 0x2 - Timed out in command phase, SCSISIGI=0x84
                SEQADDR=0x42 SCSISEQ=0x12 SSTAT0=0x7 SSTAT1=0x2
 st0(ahc0:2:0): abort message in message buffer
 st0(ahc0:2:0): SCB 2 - abort completed
 st0(ahc0:2:0): No longer in time out
 st0(ahc0:2:0): SCB0x2 - timed out while idle LASTPHASE = 0x1, SCSIIGI=0x0
                SEQADDR=0x5 SCSISEQ=0x12 SSTAT0=0x5 SSTAT1=0xa
 st0(ahc0:2:0): SCB 2 : Imediate reset  Flags=0x1
 ahc0: Issued channel A Bus Reset.
       1 SCBs aborted
 

From: "J. B." <jbr@idiom.com>
To: freebsd-gnats-submit@freebsd.org, markd@grizzly.com
Cc:  Subject: Re: kern/3671: SCSI tape drive with AHA 2940 locks up system.
Date: Thu, 16 Oct 1997 15:19:50 -0700 (PDT)

 Has happened twice to me with an AHA 2940 and an Exabyte 8200.
 Did not happen on my prior 2.1.6? version, but
 happens now in my 2.2.1-RELEASE version.
 
 No error messages, system just freezes.
 The last things I see in the log are the "normal" error messages
 Oct 15 20:42:53 jbr /kernel: st0(ahc0:5:0): Target Busy
 which I believe is due to a out-of-date firmware on the Exabyte.
 Has never caused a crash before.
 
 Seems to occur mid-tape correlating to some audible tape motion
 command (Click!).  
 
 I don't have the sequence of events, but I had another crash
 using the AHA 2940 with a CD-ROM writer (Phillips CDD 2000).  Has
 not happened again.
 
        J.

From: "J. B." <jbr@idiom.com>
To: freebsd-gnats-submit@freebsd.org, jbr@idiom.com, markd@grizzly.com
Cc:  Subject: Re: kern/3671: SCSI tape drive with AHA 2940 locks up system.
Date: Thu, 16 Oct 1997 16:21:26 -0700 (PDT)

 Got an error, it made it to the error log, once, but each line 
 was repeated twice on each Xterm.
 
 Oct 16 16:09:14 jbr /kernel: ahc0:A:5: ahc_intr - referenced scb not valid durin
 g seqint 0x71 scb(255)
 Oct 16 16:09:14 jbr /kernel: ahc0: WARNING no command for scb 255 (cmdcmplt)
 Oct 16 16:09:14 jbr /kernel: QOUTCNT == 1
 
 
         J.

From: Mark Diekhans <markd@Grizzly.COM>
To: jbr@idiom.com
Cc: freebsd-gnats-submit@freebsd.org, jbr@idiom.com
Subject: Re: kern/3671: SCSI tape drive with AHA 2940 locks up system.
Date: Thu, 16 Oct 1997 19:29:30 -0700 (PDT)

 >Date: Thu, 16 Oct 1997 16:21:26 -0700 (PDT)
 >Got an error, it made it to the error log, once, but each line 
 >was repeated twice on each Xterm.
 >
 >Oct 16 16:09:14 jbr /kernel: ahc0:A:5: ahc_intr - referenced scb not valid durin
 >g seqint 0x71 scb(255)
 >Oct 16 16:09:14 jbr /kernel: ahc0: WARNING no command for scb 255 (cmdcmplt)
 >Oct 16 16:09:14 jbr /kernel: QOUTCNT == 1
 
 Does this happen on rewind?  On my system, all is fine until rewind, then it
 hangs because of a scsi timeout.  I was able to track it to a timeout on a
 PREVENT_ALLOW scsi request to the tape drive.  The enclosed patch hacks around
 it the timeout, although it doesn't deal with why the system is hanging
 instead of handling the timeout.
 
 Mark
 
 
 
 
 *** scsi_base.c.ORG	Fri Jun 13 19:21:17 1997
 --- scsi_base.c	Thu Oct 16 18:52:50 1997
 ***************
 *** 310,316 ****
 --- 310,327 ----
   		0,
   		0,
   		2,
 + #if 0
   		5000,
 + #else
 + /*
 +  * HACK from markd@grizzly.com:  Adaptec 2940/WANGTEK 6130-FS DAT: this will
 +  * time out and cause a system hang when st issues this command after a rewind.
 +  * To avoid timeout, set it to larger than the time to rewind the tape.
 +  * Don't know the true cause here.
 +  */
 + 
 + 		1000*60*10,  /* 10 minutes */
 + #endif
   		NULL,
   		flags));
   }
 

From: Mark Diekhans <markd@Grizzly.COM>
To: freebsd-gnats-submit@freebsd.org
Cc:  Subject: Re: kern/3671 SCSI tape drive with AHA 2940 locks up system.
Date: Sun, 22 Mar 1998 02:09:01 -0800 (PST)

 Please close this report.  The problem was caused by a old 
 SCSI tape drive that appeared to have problems with the
 SCSI-II AHC host adapter.  As of 2.2.5, the kernel
 did a much better job of handling the SCSI timeouts
 (i.e. it doesn't lock up the whole system), although its
 not perfect, as it did hang once.  Drive behaving better
 by setting tweaking in AHC bios config for the device.
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Sun Mar 22 09:05:37 PST 1998 
State-Changed-Why:  
Closed at originator's request. 
>Unformatted:
