PERFORCE change 165384 for review

Alexander Motin mav at FreeBSD.org
Mon Jun 29 09:52:52 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165384

Change 165384 by mav at mav_mavbook on 2009/06/29 09:52:48

	Fix lock recursion on polling.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#39 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#39 (text+ko) ====

@@ -63,6 +63,7 @@
 static int ahci_resume(device_t dev);
 static int ahci_ch_suspend(device_t dev);
 static int ahci_ch_resume(device_t dev);
+static void ahci_ch_intr_locked(void *data);
 static void ahci_ch_intr(void *data);
 static int ahci_ctlr_reset(device_t dev);
 static void ahci_begin_transaction(device_t dev, union ccb *ccb);
@@ -552,7 +553,7 @@
 		return (ENXIO);
 	}
 	if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
-	    ahci_ch_intr, dev, &ch->ih))) {
+	    ahci_ch_intr_locked, dev, &ch->ih))) {
 		device_printf(dev, "Unable to setup interrupt\n");
 		error = ENXIO;
 		goto err1;
@@ -847,6 +848,17 @@
 }
 
 static void
+ahci_ch_intr_locked(void *data)
+{
+	device_t dev = (device_t)data;
+	struct ahci_channel *ch = device_get_softc(dev);
+
+	mtx_lock(&ch->mtx);
+	ahci_ch_intr(data);
+	mtx_unlock(&ch->mtx);
+}
+
+static void
 ahci_ch_intr(void *data)
 {
 	device_t dev = (device_t)data;
@@ -855,7 +867,6 @@
 	enum ahci_err_type et;
 	int i, ccs, ncq_err = 0;
 
-	mtx_lock(&ch->mtx);
 	/* Read and clear interrupt statuses. */
 	istatus = ATA_INL(ch->r_mem, AHCI_P_IS);
 	ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus);
@@ -924,7 +935,6 @@
 		if (ncq_err)
 			ahci_issue_read_log(dev);
 	}
-	mtx_unlock(&ch->mtx);
 }
 
 /* Must be called with channel locked. */


More information about the p4-projects mailing list