Messages in this thread Patch in this message | | | Date | Sat, 12 Sep 1998 12:01:27 +0200 (CEST) | From | Oliver Neukum <> | Subject | looking for more testers |
| |
Hello,
i am looking for more testers of a patch that makes aha152x.c friendly to SMP. It is tested on one system in UP and on one system in SMP ,thanks to Kelly French, but i would like another tester before i consider it ready. UP testers are welcome, too. The patch saves a few bytes. The diff is against 2.1.121, earlier versions are available.
Oliver Neukum --- aha152x.c Mon Jun 29 18:35:25 1998 +++ linux/drivers/scsi/aha152x.c Mon Jun 29 21:48:24 1998 @@ -23,6 +23,10 @@ * $Id: aha152x.c,v 1.18 1996/09/07 20:10:40 fischer Exp $ * * $Log: aha152x.c,v $ + * Revision 1.19 1998/06/29 19:14:03 neukum + * - basic change for SMP + * - __initfunc added + * * Revision 1.18 1996/09/07 20:10:40 fischer * - fixed can_queue handling (multiple outstanding commands working again) * @@ -343,7 +347,7 @@ #include <linux/wait.h> #include <linux/ioport.h> #include <linux/proc_fs.h> - +#include <linux/init.h> #include "aha152x.h" #include <linux/stat.h> @@ -568,6 +572,8 @@ #define SIGNATURE_COUNT (sizeof(signatures) / sizeof(struct signature)) #endif +/* try make it good for SMP */ +spinlock_t aha152x_lock = SPIN_LOCK_UNLOCKED; static void do_pause(unsigned amount) /* Pause for amount*10 milliseconds */ { @@ -677,7 +683,10 @@ } /* called from init/main.c */ -void aha152x_setup(char *str, int *ints) +/* is this still true ? */ + +__initfunc(void aha152x_setup(char *str, int *ints)) + { if(setup_count>2) panic("aha152x: you can only configure up to two controllers\n"); @@ -774,7 +783,8 @@ } -int aha152x_detect(Scsi_Host_Template * tpnt) +__initfunc(int aha152x_detect(Scsi_Host_Template * tpnt)) + { int i, j, ok; #if defined(AUTOCONF) @@ -1123,8 +1133,8 @@ SCpnt->SCp.sent_command = 0; /* Turn led on, when this is the first command. */ - save_flags(flags); - cli(); + /* SMP 1 */ + spin_lock_irqsave(&aha152x_lock, flags); HOSTDATA(shpnt)->commands++; if(HOSTDATA(shpnt)->commands==1) SETPORT(PORTA, 1); @@ -1140,7 +1150,8 @@ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0); SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0); } - restore_flags(flags); + /* SMP 2 */ + spin_unlock_irqrestore(&aha152x_lock, flags); #if defined(DEBUG_RACE) leave_driver("queue"); @@ -1168,9 +1179,8 @@ unsigned long flags; Scsi_Cmnd *ptr, *prev; - save_flags(flags); - cli(); - + /* SMP 3 */ + spin_lock_irqsave(&aha152x_lock, flags); #if defined(DEBUG_ABORT) if(HOSTDATA(shpnt)->debug & debug_abort) { printk("aha152x: abort(), SCpnt=0x%08x, ", (unsigned int) SCpnt); @@ -1193,7 +1203,8 @@ HOSTDATA(shpnt)->commands--; - restore_flags(flags); + /* SMP 4 */ + spin_unlock_irqrestore(&aha152x_lock, flags); ptr->host_scribble = NULL; ptr->result = DID_ABORT << 16; @@ -1210,7 +1221,8 @@ if(!CURRENT_SC) printk("bus busy w/o current command, "); - restore_flags(flags); + /* SMP 5 */ + spin_unlock_irqrestore(&aha152x_lock, flags); return SCSI_ABORT_BUSY; } @@ -1221,7 +1233,8 @@ HOSTDATA(shpnt)->commands--; /* target entered bus free before COMMAND COMPLETE, nothing to abort */ - restore_flags(flags); + /* SMP 6 */ + spin_unlock_irqrestore(&aha152x_lock, flags); CURRENT_SC->result = DID_ERROR << 16; CURRENT_SC->scsi_done(CURRENT_SC); CURRENT_SC = (Scsi_Cmnd *) NULL; @@ -1238,7 +1251,8 @@ if(!ptr) { /* command wasn't found */ printk("command not found\n"); - restore_flags(flags); + /* SMP 7 */ + spin_unlock_irqrestore(&aha152x_lock, flags); return SCSI_ABORT_NOT_RUNNING; } @@ -1271,8 +1285,9 @@ HOSTDATA(shpnt)->abort_result=SCSI_ABORT_SUCCESS; HOSTDATA(shpnt)->aborting++; HOSTDATA(shpnt)->abortion_complete=0; - - restore_flags(flags); + + /* SMP 8 */ + spin_unlock_irqrestore(&aha152x_lock, flags); /* sleep until the abortion is complete */ while(!HOSTDATA(shpnt)->abortion_complete) @@ -1282,7 +1297,8 @@ return HOSTDATA(shpnt)->abort_result; } else { /* we're already aborting a command */ - restore_flags(flags); + /* SMP 9 */ + spin_unlock_irqrestore(&aha152x_lock, flags); return SCSI_ABORT_BUSY; } @@ -1353,8 +1369,9 @@ CURRENT_SC=NULL; } - save_flags(flags); - cli(); + + /* SMP 11 */ + spin_lock_irqsave(&aha152x_lock, flags); prev=NULL; ptr=DISCONNECTED_SC; while(ptr) { if(!ptr->device->soft_reset) { @@ -1375,7 +1392,8 @@ ptr = (Scsi_Cmnd *) ptr->host_scribble; } } - restore_flags(flags); + /* SMP 12 */ + spin_unlock_irqrestore(&aha152x_lock, flags); #if defined(DEBUG_RESET) if(HOSTDATA(shpnt)->debug & debug_reset) { @@ -1480,9 +1498,9 @@ printk("done(%x), ", error); #endif - save_flags(flags); - cli(); - + + /* SMP 13 */ /* will it crash here ? :-; */ + spin_lock_irqsave(&aha152x_lock, flags); done_SC = CURRENT_SC; CURRENT_SC = NULL; @@ -1495,8 +1513,8 @@ if(HOSTDATA(shpnt)->debug & debug_queues) printk("ok (%d), ", HOSTDATA(shpnt)->commands); #endif - restore_flags(flags); - + /* SMP 14 */ + spin_unlock_irqrestore(&aha152x_lock, flags); SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0); SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0); @@ -1575,11 +1593,12 @@ if(HOSTDATA(shpnt)->debug & debug_queues) printk("i+, "); #endif - save_flags(flags); - cli(); + /* SMP 15 */ + spin_lock_irqsave(&aha152x_lock, flags); append_SC(&ISSUE_SC, CURRENT_SC); CURRENT_SC=NULL; - restore_flags(flags); + /* SMP 16 */ + spin_unlock_irqrestore(&aha152x_lock, flags); } /* disable sequences */ @@ -1638,8 +1657,8 @@ printk("identify=%02x, lun=%d, ", identify_msg, identify_msg & 0x3f); #endif - save_flags(flags); - cli(); + /* SMP 17 */ + spin_lock_irqsave(&aha152x_lock, flags); #if defined(DEBUG_QUEUES) if(HOSTDATA(shpnt)->debug & debug_queues) @@ -1653,7 +1672,8 @@ } CURRENT_SC->SCp.phase &= ~disconnected; - restore_flags(flags); + /* SMP 18 */ + spin_unlock_irqrestore(&aha152x_lock, flags); make_acklow(shpnt); if(getphase(shpnt)!=P_MSGI) { @@ -1671,14 +1691,15 @@ if(!CURRENT_SC) { /* bus is free to issue a queued command */ if(TESTHI(SSTAT1, BUSFREE) && ISSUE_SC) { - save_flags(flags); - cli(); + /* SMP 19 */ + spin_lock_irqsave(&aha152x_lock, flags); #if defined(DEBUG_QUEUES) if(HOSTDATA(shpnt)->debug & debug_queues) printk("i-, "); #endif CURRENT_SC = remove_first_SC(&ISSUE_SC); - restore_flags(flags); + /* SMP 20 */ + spin_unlock_irqrestore(&aha152x_lock, flags); #if defined(DEBUG_INTR) || defined(DEBUG_SELECTION) || defined(DEBUG_PHASES) if(HOSTDATA(shpnt)->debug & (debug_intr|debug_selection|debug_phases)) @@ -2142,8 +2163,7 @@ SETPORT(SXFRCTL0, CH1|CLRCH1); if(CURRENT_SC->SCp.phase & disconnected) { - save_flags(flags); - cli(); + spin_lock_irqsave(&aha152x_lock, flags); #if defined(DEBUG_QUEUES) if(HOSTDATA(shpnt)->debug & debug_queues) printk("d+, "); @@ -2151,7 +2171,7 @@ append_SC(&DISCONNECTED_SC, CURRENT_SC); CURRENT_SC->SCp.phase |= 1<<16; CURRENT_SC = NULL; - restore_flags(flags); + spin_unlock_irqrestore(&aha152x_lock, flags); SETBITS(SCSISEQ, ENRESELI); @@ -2792,8 +2812,7 @@ { unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&aha152x_lock, flags); printk("aha152x: entering %s() (%x)\n", func, jiffies); if(in_driver) { printk("%s should leave first.\n", should_leave); @@ -2802,15 +2821,14 @@ in_driver++; should_leave=func; - restore_flags(flags); + spin_unlock_irqrestore(&aha152x_lock, flags); } static void leave_driver(const char *func) { unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&aha152x_lock, flags); printk("\naha152x: leaving %s() (%x)\n", func, jiffies); if(!in_driver) { printk("aha152x: %s already left.\n", should_leave); @@ -2819,7 +2837,7 @@ in_driver--; should_leave=func; - restore_flags(flags); + spin_unlock_irqrestore(&aha152x_lock, flags); } #endif @@ -2881,8 +2899,7 @@ unsigned long flags; Scsi_Cmnd *ptr; - save_flags(flags); - cli(); + spin_lock_irqsave(&aha152x_lock, flags); printk("QUEUE STATUS:\nissue_SC:\n"); for(ptr=ISSUE_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) show_command(ptr); @@ -2899,7 +2916,7 @@ disp_ports(shpnt); disp_enintr(shpnt); - restore_flags(flags); + spin_unlock_irqrestore(&aha152x_lock, flags); } int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) @@ -3173,8 +3190,7 @@ SPRINTF(AHA152X_REVID "\n"); - save_flags(flags); - cli(); + spin_lock_irqsave(&aha152x_lock, flags); SPRINTF("ioports 0x%04lx to 0x%04lx\n", shpnt->io_port, shpnt->io_port+shpnt->n_io_port-1); @@ -3257,7 +3273,7 @@ } else SPRINTF("no disconnected commands\n"); - restore_flags(flags); + spin_unlock_irqrestore(&aha152x_lock, flags); pos += get_ports(shpnt, pos); | |