Date: Mon, 29 Jun 2009 09:52:49 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 165384 for review Message-ID: <200906290952.n5T9qnLt092689@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165384 Change 165384 by mav@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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906290952.n5T9qnLt092689>