From nobody@FreeBSD.org  Sat May 15 12:40:05 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AFF5B106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 May 2010 12:40:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F7528FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 May 2010 12:40:05 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o4FCe39P076731
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 May 2010 12:40:03 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4FCe3Ph076719;
	Sat, 15 May 2010 12:40:03 GMT
	(envelope-from nobody)
Message-Id: <201005151240.o4FCe3Ph076719@www.freebsd.org>
Date: Sat, 15 May 2010 12:40:03 GMT
From: Taku YAMAMOTO <taku@tackymt.homeip.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: if_em.c prevents the 2nd time resuming
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         146614
>Category:       kern
>Synopsis:       [em] if_em.c prevents the 2nd time resuming
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    marius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 15 12:50:04 UTC 2010
>Closed-Date:    Tue May 18 17:10:40 UTC 2010
>Last-Modified:  Tue May 18 17:10:40 UTC 2010
>Originator:     Taku YAMAMOTO
>Release:        9.0-CURRENT(after r206001), 8.0-STABLE(after r206211)
>Organization:
Confortune Co., Ltd.
>Environment:
FreeBSD biotite.tackymt.homeip.net 9.0-CURRENT FreeBSD 9.0-CURRENT #190: Thu May 13 13:16:18 JST 2010     taku@biotite.tackymt.homeip.net:/home/taku/work/build/biotite/usr/src/sys/BIOTITE  i386

FreeBSD truth.mskc.confortune.co.jp 8.0-STABLE FreeBSD 8.0-STABLE #10: Tue May 11 15:31:50 JST 2010     root@:/home/tackymt/work/build/truth/usr/src/sys/TRUTH  i386
>Description:
If we let a machine with an em interface suspend, resume then suspend again,
the machine panics on the next resume.

It seems this bug have got introduced by the changeset r206001(head)
and r206211(stable/8).

>How-To-Repeat:
On a machine with em interface and working suspend,
to suspend, resume, suspend again and then resume again will result to a panic.

>Fix:
The attached patch seems to fix the bug.
(Tested on Thinkpad X60 and X61, 9.0-CURRENT and 8.0-STABLE respectively)

I'm not so confident of the correctness of em_resume() part of the fix, though.


Patch attached with submission follows:

--- sys/dev/e1000/if_em.c.orig	2010-04-29 04:22:52.000000000 +0900
+++ sys/dev/e1000/if_em.c	2010-05-08 19:19:43.587862831 +0900
@@ -705,6 +705,9 @@ em_detach(device_t dev)
 		return (EBUSY);
 	}
 
+	if (adapter->led_dev != NULL)
+		led_destroy(adapter->led_dev);
+
 #ifdef DEVICE_POLLING
 	if (ifp->if_capenable & IFCAP_POLLING)
 		ether_poll_deregister(ifp);
@@ -779,9 +782,6 @@ em_resume(device_t dev)
 	struct adapter *adapter = device_get_softc(dev);
 	struct ifnet *ifp = adapter->ifp;
 
-	if (adapter->led_dev != NULL)
-		led_destroy(adapter->led_dev);
-
 	EM_CORE_LOCK(adapter);
 	em_init_locked(adapter);
 	em_init_manageability(adapter);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->marius 
Responsible-Changed-By: marius 
Responsible-Changed-When: Sat May 15 19:40:13 UTC 2010 
Responsible-Changed-Why:  
Grab, this was a mismerge in my revision. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/146614: commit references a PR
Date: Sat, 15 May 2010 19:47:35 +0000 (UTC)

 Author: marius
 Date: Sat May 15 19:46:16 2010
 New Revision: 208117
 URL: http://svn.freebsd.org/changeset/base/208117
 
 Log:
   Fix a mismerge in r206001.
   
   PR:		146614
   Approved by:	jfv (implicit)
   MFC afer:	3 days
 
 Modified:
   head/sys/dev/e1000/if_em.c
 
 Modified: head/sys/dev/e1000/if_em.c
 ==============================================================================
 --- head/sys/dev/e1000/if_em.c	Sat May 15 17:49:56 2010	(r208116)
 +++ head/sys/dev/e1000/if_em.c	Sat May 15 19:46:16 2010	(r208117)
 @@ -710,6 +710,9 @@ em_detach(device_t dev)
  		ether_poll_deregister(ifp);
  #endif
  
 +	if (adapter->led_dev != NULL)
 +		led_destroy(adapter->led_dev);
 +
  	EM_CORE_LOCK(adapter);
  	adapter->in_detach = 1;
  	em_stop(adapter);
 @@ -779,9 +782,6 @@ em_resume(device_t dev)
  	struct adapter *adapter = device_get_softc(dev);
  	struct ifnet *ifp = adapter->ifp;
  
 -	if (adapter->led_dev != NULL)
 -		led_destroy(adapter->led_dev);
 -
  	EM_CORE_LOCK(adapter);
  	em_init_locked(adapter);
  	em_init_manageability(adapter);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/146614: commit references a PR
Date: Tue, 18 May 2010 17:09:34 +0000 (UTC)

 Author: marius
 Date: Tue May 18 17:09:20 2010
 New Revision: 208268
 URL: http://svn.freebsd.org/changeset/base/208268
 
 Log:
   MFC: r208117
   
   Fix a mismerge in r206001 (MFC'ed to stable/8 in r206211).
   
   PR:		146614
   Approved by:	jfv (implicit)
 
 Modified:
   stable/8/sys/dev/e1000/if_em.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
   stable/8/sys/geom/sched/   (props changed)
 
 Modified: stable/8/sys/dev/e1000/if_em.c
 ==============================================================================
 --- stable/8/sys/dev/e1000/if_em.c	Tue May 18 17:02:35 2010	(r208267)
 +++ stable/8/sys/dev/e1000/if_em.c	Tue May 18 17:09:20 2010	(r208268)
 @@ -705,6 +705,9 @@ em_detach(device_t dev)
  		ether_poll_deregister(ifp);
  #endif
  
 +	if (adapter->led_dev != NULL)
 +		led_destroy(adapter->led_dev);
 +
  	EM_CORE_LOCK(adapter);
  	adapter->in_detach = 1;
  	em_stop(adapter);
 @@ -774,9 +777,6 @@ em_resume(device_t dev)
  	struct adapter *adapter = device_get_softc(dev);
  	struct ifnet *ifp = adapter->ifp;
  
 -	if (adapter->led_dev != NULL)
 -		led_destroy(adapter->led_dev);
 -
  	EM_CORE_LOCK(adapter);
  	em_init_locked(adapter);
  	em_init_manageability(adapter);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/146614: commit references a PR
Date: Tue, 18 May 2010 17:09:43 +0000 (UTC)

 Author: marius
 Date: Tue May 18 17:09:22 2010
 New Revision: 208269
 URL: http://svn.freebsd.org/changeset/base/208269
 
 Log:
   MFC: r208117
   
   Fix a mismerge in r206001 (MFC'ed to stable/7 in r208105).
   
   PR:		146614
   Approved by:	jfv (implicit)
 
 Modified:
   stable/7/sys/dev/e1000/if_em.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/e1000/if_em.c
 ==============================================================================
 --- stable/7/sys/dev/e1000/if_em.c	Tue May 18 17:09:20 2010	(r208268)
 +++ stable/7/sys/dev/e1000/if_em.c	Tue May 18 17:09:22 2010	(r208269)
 @@ -705,6 +705,9 @@ em_detach(device_t dev)
  		ether_poll_deregister(ifp);
  #endif
  
 +	if (adapter->led_dev != NULL)
 +		led_destroy(adapter->led_dev);
 +
  	EM_CORE_LOCK(adapter);
  	adapter->in_detach = 1;
  	em_stop(adapter);
 @@ -774,9 +777,6 @@ em_resume(device_t dev)
  	struct adapter *adapter = device_get_softc(dev);
  	struct ifnet *ifp = adapter->ifp;
  
 -	if (adapter->led_dev != NULL)
 -		led_destroy(adapter->led_dev);
 -
  	EM_CORE_LOCK(adapter);
  	em_init_locked(adapter);
  	em_init_manageability(adapter);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: marius 
State-Changed-When: Tue May 18 17:10:19 UTC 2010 
State-Changed-Why:  
close 

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