Re: BIG problem with BusLogic SCSI and/or something else

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu Oct 12 2000 - 11:02:10 EST


On Thu, 12 Oct 2000, Matthias Andree wrote:

> > Note that the sync-rate of target 6, the device I added, has been
> > turned down to try to eliminate any hardware problems. Also note
> > that the entire drive has been read/written with the BusLogic BIOS
> > diagnostic setup utility.
>
> That BIOS setup tool might just use asynchronous I/O for anything,
> so this may not be an indicator in any way.
>
> Did you check your cable length and termination? You need exactly two
> terminators, one at each end of the cable. None in between. Note that
> the host adaptor does not get terminated if you connect two cables to
> it.

Sorry. I know about SCSI.

>
> Do you have a different machine with null-modem or something? You could
> copy your syslog/klog output there, or you could send it to a different
> host in your LAN.
>

There is some race when I/O is being performed between two disks on
a SMP machine.

This fixes the race although it may be too "brute-force" to be the
"final" version because one may not want to single-thread everything
as I have done.

--- linux-2.2.17/drivers/scsi/BusLogic.c.orig Thu Oct 12 10:44:04 2000
+++ linux-2.2.17/drivers/scsi/BusLogic.c Thu Oct 12 11:50:32 2000
@@ -50,6 +50,9 @@
 #include "scsi.h"
 #include "hosts.h"
 #include "sd.h"
+
+static spinlock_t BusLogic_lock = SPIN_LOCK_UNLOCKED;
+
 #include "BusLogic.h"
 #include "FlashPoint.c"
 
@@ -413,6 +416,7 @@
   waiting for the Host Adapter Ready bit to be set in the Status Register.
 */
 
+
 static int BusLogic_Command(BusLogic_HostAdapter_T *HostAdapter,
                             BusLogic_OperationCode_T OperationCode,
                             void *ParameterData,
@@ -424,7 +428,6 @@
   unsigned char *ReplyPointer = (unsigned char *) ReplyData;
   BusLogic_StatusRegister_T StatusRegister;
   BusLogic_InterruptRegister_T InterruptRegister;
- ProcessorFlags_T ProcessorFlags = 0;
   int ReplyBytes = 0, Result;
   long TimeoutCounter;
   /*
@@ -433,17 +436,6 @@
   if (ReplyLength > 0)
     memset(ReplyData, 0, ReplyLength);
   /*
- If the IRQ Channel has not yet been acquired, then interrupts must be
- disabled while issuing host adapter commands since a Command Complete
- interrupt could occur if the IRQ Channel was previously enabled by another
- BusLogic Host Adapter or another driver sharing the same IRQ Channel.
- */
- if (!HostAdapter->IRQ_ChannelAcquired)
- {
- save_flags(ProcessorFlags);
- cli();
- }
- /*
     Wait for the Host Adapter Ready bit to be set and the Command/Parameter
     Register Busy bit to be reset in the Status Register.
   */
@@ -632,8 +624,6 @@
     Restore the interrupt status if necessary and return.
   */
 Done:
- if (!HostAdapter->IRQ_ChannelAcquired)
- restore_flags(ProcessorFlags);
   return Result;
 }
 
--- linux-2.2.17/drivers/scsi/BusLogic.h.orig Thu Oct 12 11:22:44 2000
+++ linux-2.2.17/drivers/scsi/BusLogic.h Thu Oct 12 11:47:07 2000
@@ -1509,6 +1509,7 @@
 void BusLogic_AcquireHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
                                      ProcessorFlags_T *ProcessorFlags)
 {
+ spin_lock_irqsave(&BusLogic_lock, *ProcessorFlags);
 }
 
 
@@ -1520,6 +1521,7 @@
 void BusLogic_ReleaseHostAdapterLock(BusLogic_HostAdapter_T *HostAdapter,
                                      ProcessorFlags_T *ProcessorFlags)
 {
+ spin_unlock_irqrestore(&BusLogic_lock, *ProcessorFlags);
 }
 
 

Cheers,
Dick Johnson

Penguin : Linux version 2.2.17 on an i686 machine (801.18 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:23 EST