From mike@lir.urgle.com  Sun Aug  8 21:54:59 2004
Return-Path: <mike@lir.urgle.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0290C16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  8 Aug 2004 21:54:59 +0000 (GMT)
Received: from lir.urgle.com (lir.urgle.com [80.177.40.52])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4E9EF43D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  8 Aug 2004 21:54:58 +0000 (GMT)
	(envelope-from mike@lir.urgle.com)
Received: from lir.urgle.com (localhost [127.0.0.1])
	by lir.urgle.com (8.13.1/8.13.1) with ESMTP id i78Lsu9l029419
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 8 Aug 2004 22:54:56 +0100 (BST)
	(envelope-from mike@lir.urgle.com)
Received: (from mike@localhost)
	by lir.urgle.com (8.13.1/8.13.1/Submit) id i78Lsumx029418;
	Sun, 8 Aug 2004 22:54:56 +0100 (BST)
	(envelope-from mike)
Message-Id: <200408082154.i78Lsumx029418@lir.urgle.com>
Date: Sun, 8 Aug 2004 22:54:56 +0100 (BST)
From: Mike Bristow <mike@lir.urgle.com>
Reply-To: Mike Bristow <mike@lir.urgle.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] vr(4) implements panic(9)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         70189
>Category:       kern
>Synopsis:       [patch] vr(4) implements panic(9)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    rwatson
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 08 22:00:38 GMT 2004
>Closed-Date:    Tue Oct 19 15:36:40 GMT 2004
>Last-Modified:  Tue Oct 19 15:36:40 GMT 2004
>Originator:     Mike Bristow
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD lir.urgle.com 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Sun Aug 8 14:00:07 BST 2004 root@:/scratch/usr.obj/usr/src/sys/GENERIC i386

Panic observed on system cvsuped with
*default date=2004.07.27.00.00.00

fix tested on that and also
*default date=2004.08.07.00.00.00

>Description:

	Kernel panics at boot with:
panic: mutex vr0 not owned at /usr/src/sys/pci/if_vr.c:571
cpuid=1;
KDB: enter: panic
[thread 100077]
Stopped at      kdb_enter+0x30: leave

db> trace
kdb_enter(...)
panic(...)
_mtx_assert(...)
vr_setcfg(...)
vr_miibus_statchg(...)
miibus_statchg(...)
mii_phy_update(...)
amphy_service(...)
mii_pollstat(...)
vr_ifmedia_sts(...)
ifmedia_ioctl(...)
vr_ioctl(...)
ifhwioctl(...)
ifioctl(...)
soo_ioctl(...)
ioctl(...)
syscakk(...)
Xint0x80_syscall(...)


	
>How-To-Repeat:
	Fit NIC driven by vr(4); try to use!
>Fix:

Apply:

--- sys/pci/if_vr.c.orig	Sat Aug  7 12:57:45 2004
+++ sys/pci/if_vr.c	Sat Aug  7 12:58:53 2004
@@ -1561,7 +1561,9 @@
 	struct mii_data		*mii;
 
 	mii = device_get_softc(sc->vr_miibus);
+	VR_LOCK(sc);
 	mii_pollstat(mii);
+	VR_UNLOCK(sc);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
 }
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->rwatson 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Mon Aug 9 22:41:35 GMT 2004 
Responsible-Changed-Why:  
I committed a similar change to address the same issue as if_vr.c:1.93: 

revision 1.93 
date: 2004/08/07 19:40:19;  author: rwatson;  state: Exp;  lines: +2 -0 
Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(), 
since vr_setcfg() expects it. 

Reported by:    Mike Bristow <mike@urgle.com> 

Could you confirm whether that solves this problem for you? 


http://www.freebsd.org/cgi/query-pr.cgi?pr=70189 

From: Mike Bristow <mike@urgle.com>
To: mike@lir.urgle.com, freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/70189: [patch] vr(4) implements panic(9)
Date: Wed, 11 Aug 2004 19:33:43 +0100

 Sorry I missed the update on the PR.
 
 The summary is 1.93 stops the reported panic, but introduces a new one; 
 see Message-Id: <1092044482.20927.35.camel@singsing.eng.demon.net> sent 
 to freebsd-current for details.
 
 I note that 1.94 has been commited; I am trying that now.
 
State-Changed-From-To: open->closed 
State-Changed-By: bms 
State-Changed-When: Tue Oct 19 15:36:28 GMT 2004 
State-Changed-Why:  
scottl already committed a fix for this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=70189 
>Unformatted:
