Skip to contentSkip to conversation

PROBLEM: aic7xxx can hang PC on SMP kernel 2.4.22

DISCUSSION Simon Munton 2 participants 3 messages Nov 6, 2003 – Nov 7, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

Hi

I've recently had a problem of my PC freezing when using my scsi scanner via the aic7xxx driver. It only occurs when built for SMP,and is triggered by the scanner returning busy status.

The busy status results in the driver creating a timer to freeze the device for half a second (in ahc_linux_handle_scsi_status()). When the timer expires, the function ahc_linux_dev_timed_unfreeze() is called, and this can call ahc_linux_free_device(). ahc_linux_free_device() calls del_timer_sync(), and this is the point at which the PC hangs.

Essentially, del_timer_sync() has been called from the timer expiry function; it then waits for the timer function to finish, which won't happen (on SMP machines).

I looked at the aic79xx driver which has similar code to handle busy status, but in the aic79xx driver, the ahd_linux_free_device() function calls del_timer(), not del_timer_sync().

Simon

#1 lore raw
Quoted 5 lines

Hi

I've recently had a problem of my PC freezing when using my scsi scanner via the aic7xxx driver. It only occurs when built for SMP,and is triggered by the scanner returning busy status.

...

The attached patch should fix this for you. It is included in the latest driver source that I will be uploading in a moment to my website. RPMs and DUDs will follow as soon as the build completes.

--
Justin

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#191 - /home/gibbs/mod_devel/scsi/aic7xxx/aic79xx_osm.c ====

home/gibbs/mod_devel/scsi/aic7xxx/aic79xx_osm.c renamed from tmp/tmp.27544.0 +4 -4
@@ -1215,8 +1215,7 @@
 	 && (dev->flags & AIC_DEV_SLAVE_CONFIGURED) != 0) {
 		dev->flags |= AIC_DEV_UNCONFIGURED;
 		if (TAILQ_EMPTY(&dev->busyq)
-		 && dev->active == 0
-		 && (dev->flags & AIC_DEV_TIMER_ACTIVE) == 0)
+		 && dev->active == 0)
 			ahd_linux_free_device(ahd, dev);
 	}
 	ahd_midlayer_entrypoint_unlock(ahd, &flags);
@@ -2250,6 +2249,7 @@
 					if (targ->devices[j] == NULL)
 						continue;
 					dev = targ->devices[j];
+					del_timer_sync(&dev->timer);
 					ahd_linux_free_device(ahd, dev);
 				}
 				/*
@@ -4501,8 +4501,7 @@
 
 	if (TAILQ_EMPTY(&dev->busyq)) {
 		if ((dev->flags & AIC_DEV_UNCONFIGURED) != 0
-		 && dev->active == 0
-		 && (dev->flags & AIC_DEV_TIMER_ACTIVE) == 0)
+		 && dev->active == 0)
 			ahd_linux_free_device(ahd, dev);
 	} else if ((dev->flags & AIC_DEV_ON_RUN_LIST) == 0) {
 		TAILQ_INSERT_TAIL(&ahd->platform_data->device_runq, dev, links);
@@ -5024,6 +5023,7 @@
 	 && (dev->flags & AIC_DEV_ON_RUN_LIST) == 0)
 		ahd_linux_run_device_queue(ahd, dev);
 	if ((dev->flags & AIC_DEV_UNCONFIGURED) != 0
+	 && TAILQ_EMPTY(&dev->busyq)
 	 && dev->active == 0)
 		ahd_linux_free_device(ahd, dev);
 	ahd_unlock(ahd, &s);

==== //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#254 - /home/gibbs/mod_devel/scsi/aic7xxx/aic7xxx_osm.c ====

home/gibbs/mod_devel/scsi/aic7xxx/aic7xxx_osm.c renamed from tmp/tmp.27544.1 +6 -6
@@ -1217,8 +1217,7 @@
 	 && (dev->flags & AIC_DEV_SLAVE_CONFIGURED) != 0) {
 		dev->flags |= AIC_DEV_UNCONFIGURED;
 		if (TAILQ_EMPTY(&dev->busyq)
-		 && dev->active == 0
-	 	 && (dev->flags & AIC_DEV_TIMER_ACTIVE) == 0)
+		 && dev->active == 0)
 			ahc_linux_free_device(ahc, dev);
 	}
 	ahc_midlayer_entrypoint_unlock(ahc, &flags);
@@ -1928,6 +1927,7 @@
 					if (targ->devices[j] == NULL)
 						continue;
 					dev = targ->devices[j];
+					del_timer_sync(&dev->timer);
 					ahc_linux_free_device(ahc, dev);
 				}
 				/*
@@ -3950,7 +3950,7 @@
 {
 	struct aic_linux_target *targ;
 
-	del_timer_sync(&dev->timer);
+	del_timer(&dev->timer);
 	targ = dev->target;
 	targ->devices[dev->lun] = NULL;
 	free(dev, M_DEVBUF);
@@ -4203,8 +4203,7 @@
 
 	if (TAILQ_EMPTY(&dev->busyq)) {
 		if ((dev->flags & AIC_DEV_UNCONFIGURED) != 0
-		 && dev->active == 0
-	 	 && (dev->flags & AIC_DEV_TIMER_ACTIVE) == 0)
+		 && dev->active == 0)
 			ahc_linux_free_device(ahc, dev);
 	} else if ((dev->flags & AIC_DEV_ON_RUN_LIST) == 0) {
 		TAILQ_INSERT_TAIL(&ahc->platform_data->device_runq, dev, links);
@@ -4679,7 +4678,8 @@
 	if (dev->qfrozen == 0
 	 && (dev->flags & AIC_DEV_ON_RUN_LIST) == 0)
 		ahc_linux_run_device_queue(ahc, dev);
-	if (TAILQ_EMPTY(&dev->busyq)
+	if ((dev->flags & AIC_DEV_UNCONFIGURED) != 0
+	 && TAILQ_EMPTY(&dev->busyq)
 	 && dev->active == 0)
 		ahc_linux_free_device(ahc, dev);
 	ahc_unlock(ahc, &s);
#2 lore raw
Quoted 2 lines · Justin T. Gibbs

The attached patch should fix this for you. It is included in the latest driver source that I will be uploading in a moment to my website.

Thanks, that did fix it.

Simon