From owner-freebsd-current@FreeBSD.ORG Thu May 14 19:27:54 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8459106564A for ; Thu, 14 May 2009 19:27:54 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by mx1.freebsd.org (Postfix) with ESMTP id 8753E8FC23 for ; Thu, 14 May 2009 19:27:54 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so835000yxb.13 for ; Thu, 14 May 2009 12:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Mmi+3XzDRaLHtaq1QzBOqLj89OxVU/2eKDHvJgmTmng=; b=FRSGrXXlw/eGpkkMXi3mipVPiApht41PaeK57/R/+fHHhKQH6p+1GRg4haNmTnJvAR LtbxCWsOqIloNZxSd81r+hJ14U6tP4slMVMU1d89CJf3UG244cf3GYfyltr+YIea0pw7 1eQX7NpAeF8eXGuY9Zy/wEunNZhPinJu89DkE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=FVazQ8YB5dwNRjohBElhzFwKb8QssZJIfegTJ5cx66/wln9ro2y716oeMu8esrgMI8 Nc/xC4bmvwf0GOrPhlz5uNsPhJmb8dlq1zcr8m7/3LB4JRV8vhr5a115XVatBWme2h4S K6u+g2H5W5i7ib7x1VA/005T4TFQZUHfgX+uI= MIME-Version: 1.0 Received: by 10.100.172.16 with SMTP id u16mr3500301ane.85.1242327723386; Thu, 14 May 2009 12:02:03 -0700 (PDT) Date: Thu, 14 May 2009 15:02:03 -0400 Message-ID: <3c0b01820905141202w113966dp4bfbab73d84d585@mail.gmail.com> From: Alexander Sack To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Broadcom bge(4) panics while shutting down X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 19:27:55 -0000 Hello: Under heavy traffic (100% utilization GIGE on a 2 port BGE card) running BGE CURRENT driver I see panics on shutdown. The reason is because bge_rxeof() while processing its RX ring of BD's drops the softc lock when it hands it off to its input function. If bge_stop() is waiting for it, it will then proceed to acquire lock and then quiesce the hardware (reseting the card, clearing out BDs etc.). Once bge_stop() releases the softc lock, then bge_rxeof() under an interrupt context (no polling here) will reacquire and continue to process the ring which is a bad idea. It should check to see if the card is still running before continuing processing BDs (i.e. once IF_DRV_RUNNING has been reset by bge_stop(), bge_rxeof() is done, bail out). Here is my first go around with this patch: -- if_bge.c.CURRENT 2009-05-14 14:39:39.000000000 -0400 +++ if_bge.c 2009-05-14 14:39:24.000000000 -0400 @@ -3081,6 +3081,10 @@ uint16_t vlan_tag = 0; int have_tag = 0; + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + return; + } + #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { if (sc->rxcycles <= 0) This prevents any panics during shutdown under heavy load and AS IT TURNS out (I feel stupid for not looking) that em(4) already had this check in its em_rxeof() function (right at the top of the loop). I'm more than happy changing it to the em style but above seems reasonable to me though I have to verify there isn't anything missing off the loop from a hardware standpoint (I don't think so because bge_stop() did all the dirty work so I believe touching any registers after that from bge_rxeof() is a bad idea). Preliminary testing shows no more panics start and stopping ports under heavy load (panics were almost immediate otherwise). Thoughts? -aps