From nobody@FreeBSD.org  Thu May 20 14:36:58 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 C48A11065686
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 May 2010 14:36:58 +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 B33838FC2E
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 May 2010 14:36:58 +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 o4KEawei077137
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 May 2010 14:36:58 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4KEaw9T077136;
	Thu, 20 May 2010 14:36:58 GMT
	(envelope-from nobody)
Message-Id: <201005201436.o4KEaw9T077136@www.freebsd.org>
Date: Thu, 20 May 2010 14:36:58 GMT
From: Andrew Boyer <aboyer@averesystems.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: cxgb panic calling without cxgb_set_lro() without port lock held
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         146759
>Category:       kern
>Synopsis:       [cxgb] [patch] cxgb panic calling cxgb_set_lro() without port lock held
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    np
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 20 14:40:07 UTC 2010
>Closed-Date:    Thu Oct 25 19:09:40 UTC 2012
>Last-Modified:  Thu Oct 25 19:09:40 UTC 2012
>Originator:     Andrew Boyer
>Release:        RELENG_7
>Organization:
Avere Systems
>Environment:
FreeBSD armada2 7.1-RELEASE-p3 FreeBSD 7.1-RELEASE-p3 #140: Wed May 19 16:52:20 EDT 2010     root@XXX:/usr/home/aboyer/src/freebsd/src/sys/amd64/compile/DEBUG  amd64
>Description:
The cxgb driver causes a kernel panic if you try to disable LRO; it asserts that the port lock is held when there is no way that it could be.  This problem appears to have existed for a long time (SVN 181616, Aug 2008?).

We must be the only people disabling LRO.
>How-To-Repeat:
'ifconfig cxgb0 -lro'
>Fix:
Take the port lock before calling cxgb_set_lro() in src/sys/dev/cxgb/cxgb_main.c.

diff -u cxgb_main.c cxgb_main_upd.c 
--- cxgb_main.c	2010-05-20 10:24:49.000000000 -0400
+++ cxgb_main_upd.c	2010-05-20 10:26:22.000000000 -0400
@@ -2106,8 +2106,10 @@
 		if (mask & IFCAP_LRO) {
 			ifp->if_capenable ^= IFCAP_LRO;
 
+			PORT_LOCK(p);
 			/* Safe to do this even if cxgb_up not called yet */
 			cxgb_set_lro(p, ifp->if_capenable & IFCAP_LRO);
+			PORT_UNLOCK(p);
 		}
 		if (mask & IFCAP_VLAN_HWTAGGING) {
 			ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;


>Release-Note:
>Audit-Trail:

From: Andrew Boyer <aboyer@averesystems.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/146759: cxgb panic calling without cxgb_set_lro() without port lock held
Date: Thu, 20 May 2010 11:00:56 -0400

 Obviously I meant the title to be "cxgb panic calling cxgb_set_lro() =
 without port lock held".
 
 -Andrew
 
 --------------------------------------------------
 Andrew Boyer	aboyer@averesystems.com
 
 
 
 
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu May 20 15:45:51 UTC 2010 
Responsible-Changed-Why:  
Fix synopsis per submitter request and assign. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/146759: commit references a PR
Date: Thu, 20 May 2010 18:22:57 +0000 (UTC)

 Author: np
 Date: Thu May 20 18:22:45 2010
 New Revision: 208356
 URL: http://svn.freebsd.org/changeset/base/208356
 
 Log:
   Remove invalid assertion.
   
   Holding the adapter lock while changing the LRO settings is sufficient.
   
   PR:		kern/146759
   MFC after:	3 days
 
 Modified:
   head/sys/dev/cxgb/cxgb_main.c
 
 Modified: head/sys/dev/cxgb/cxgb_main.c
 ==============================================================================
 --- head/sys/dev/cxgb/cxgb_main.c	Thu May 20 17:30:55 2010	(r208355)
 +++ head/sys/dev/cxgb/cxgb_main.c	Thu May 20 18:22:45 2010	(r208356)
 @@ -1979,7 +1979,6 @@ cxgb_set_lro(struct port_info *p, int en
  	struct adapter *adp = p->adapter;
  	struct sge_qset *q;
  
 -	PORT_LOCK_ASSERT_OWNED(p);
  	for (i = 0; i < p->nqsets; i++) {
  		q = &adp->sge.qs[p->first_qset + i];
  		q->lro.enabled = (enabled != 0);
 _______________________________________________
 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->patched 
State-Changed-By: eadler 
State-Changed-When: Tue Mar 1 10:15:34 EST 2011 
State-Changed-Why:  
committed in head 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146759 
Responsible-Changed-From-To: freebsd-net->np 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Tue Mar 1 10:22:59 EST 2011 
Responsible-Changed-Why:  
same as above 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146759 
State-Changed-From-To: patched->closed 
State-Changed-By: np 
State-Changed-When: Thu Oct 25 19:09:00 UTC 2012 
State-Changed-Why:  
Fixed in r208356. 

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