From owner-p4-projects@FreeBSD.ORG Mon Jun 29 09:52:52 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5722E1065672; Mon, 29 Jun 2009 09:52:50 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA8D31065679 for ; Mon, 29 Jun 2009 09:52:49 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 983C18FC0C for ; Mon, 29 Jun 2009 09:52:49 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5T9qnVx092691 for ; Mon, 29 Jun 2009 09:52:49 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5T9qnLt092689 for perforce@freebsd.org; Mon, 29 Jun 2009 09:52:49 GMT (envelope-from mav@freebsd.org) Date: Mon, 29 Jun 2009 09:52:49 GMT Message-Id: <200906290952.n5T9qnLt092689@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Cc: Subject: PERFORCE change 165384 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 09:52:52 -0000 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. */