From yoichi@alcoholic.geiin.org  Wed Mar 23 13:40:40 2005
Return-Path: <yoichi@alcoholic.geiin.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 88DA716A4CE; Wed, 23 Mar 2005 13:40:40 +0000 (GMT)
Received: from alcoholic.geiin.org (usen-59x87x89x234.ap-US02.usen.ad.jp [59.87.89.234])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id DF2B043D2F; Wed, 23 Mar 2005 13:40:39 +0000 (GMT)
	(envelope-from yoichi@alcoholic.geiin.org)
Received: by alcoholic.geiin.org (Postfix, from userid 1001)
	id C656B1E8F7; Wed, 23 Mar 2005 22:40:38 +0900 (JST)
Message-Id: <20050323134038.C656B1E8F7@alcoholic.geiin.org>
Date: Wed, 23 Mar 2005 22:40:38 +0900 (JST)
From: Yoichi NAKAYAMA <yoichi@FreeBSD.org>
Reply-To: Yoichi NAKAYAMA <yoichi@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: yoichi@FreeBSD.org
Subject: xl_detach cause panic
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         79160
>Category:       kern
>Synopsis:       [xl] [patch] xl_detach cause panic
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 23 13:50:02 GMT 2005
>Closed-Date:    Wed Nov 23 04:43:18 GMT 2005
>Last-Modified:  Wed Nov 23 04:43:18 GMT 2005
>Originator:     Yoichi NAKAYAMA
>Release:        FreeBSD-current
>Organization:
Geiin.org
>Environment:
	
>Description:
I'm using cardbus NIC 3CXFE575CT-AP, which uses xl driver.
When I eject the card, I met panic as follows:
panic: _mtx_lock_sleep: recursed on non-recursive mutex xl0 @ /usr/src/sys/pci/if_xl.c:3050
db> trace
kdb_enter(...)
panic(...)
_mtx_lock_sleep(...)
_mtx_lock_flags(...)
xl_ioctl(...)
if_delmulti(...)
in6_delmulti(...)
in6_purgeaddr(...)
if_detach(...)
ether_ifdetach(...)
xl_detach(...)
device_detach(...)
cardbus_detach_card(...)
cbb_removal(...)
cbb_event_thread(...)

>How-To-Repeat:
detach xl device

>Fix:
Remove lock while calling ether_ifdetach(). Almost same problem has been reported before for sys/pci/if_vr.c:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/pci/if_vr.c?rev=1.98&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
There are some other files with similar problem, perhaps.

--- src/sys/pci/if_xl.c.orig
+++ src/sys/pci/if_xl.c
@@ -1705,7 +1705,9 @@
 	if (device_is_attached(dev)) {
 		xl_reset(sc);
 		xl_stop(sc);
+		XL_UNLOCK(sc);
 		ether_ifdetach(ifp);
+		XL_LOCK(sc);
 	}
 	if (sc->xl_miibus)
 		device_delete_child(dev, sc->xl_miibus);

>Release-Note:
>Audit-Trail:

From: Yoichi Nakayama <yoichi@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc: yoichi@FreeBSD.org
Subject: Re: kern/79160: [xl] [patch] xl_detach cause panic
Date: Wed, 23 Nov 2005 13:38:53 +0900

 I've updated to 7-current system yesterday, and there is no panic
 described in this PR. Close this PR, please.
 -- 
 Yoichi NAKAYAMA
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Wed Nov 23 04:42:49 GMT 2005 
State-Changed-Why:  
Apparently fixed in -CURRENT. 

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