Re: [PATCH] nve(4) locking cleanup

From: John Baldwin <jhb_at_freebsd.org>
Date: Thu, 17 Nov 2005 11:03:29 -0500
On Thursday 17 November 2005 08:46 am, David Xu wrote:
> John Baldwin wrote:
> >I have a patch for nve(4) which fixes at least one known LOR in the driver
> > and generally fixes up the locking.  If you have an nve(4) card that
> > currently works, please test this patch to make sure it doesn't break
> > anything.  If you have an nve(4) card that doesn't work, this patch
> > probably won't help.
> >
> >http://www.FreeBSD.org/~jhb/patches/nve_locking.patch
>
> After this patch is applied, I got:
> nve0: <NVIDIA nForce MCP7 Networking Adapter> port 0xb400-0xb407 mem
> 0xec000000-0xec000fff irq 20 at device 5.0 on pci0
> nve0: nve_oslockacquire: normal mutex not held
> nve0: nve_oslockrelease: normal mutex not held

Ah, I think I messsed up the conditional for this when I added the sc->dead 
checks.  I'll update the patch in a second.  These warnings aren't a problem 
during attach before ether_ifattach() and bus_setup_intr() or after 
ether_ifdetach() in detach.  Here's the relevant diff to the old patch:

--- //depot/user/jhb/acpipci/dev/nve/if_nve.c
+++ /home/john/work/p4/acpipci/dev/nve/if_nve.c
_at__at_ -1726,7 +1726,7 _at__at_
 
 	DEBUGOUT(NVE_DEBUG_LOCK, "nve: nve_oslockacquire\n");
 
-	if (!mtx_owned(&sc->mtx) && !device_is_attached(sc->dev) && !sc->dead)
+	if (!mtx_owned(&sc->mtx) && device_is_attached(sc->dev) && !sc->dead)
 		device_printf(sc->dev, "%s: normal mutex not held\n", __func__);
 	NVE_OSLOCK((struct nve_softc *)lock);
 
_at__at_ -1742,7 +1742,7 _at__at_
 	DEBUGOUT(NVE_DEBUG_LOCK, "nve: nve_oslockrelease\n");
 
 	NVE_OSUNLOCK((struct nve_softc *)lock);
-	if (!mtx_owned(&sc->mtx) && !device_is_attached(sc->dev) && !sc->dead)
+	if (!mtx_owned(&sc->mtx) && device_is_attached(sc->dev) && !sc->dead)
 		device_printf(sc->dev, "%s: normal mutex not held\n", __func__);
 
 	return (1);

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Thu Nov 17 2005 - 15:04:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:47 UTC