From owner-freebsd-current@FreeBSD.ORG Thu May 14 22:53:26 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 019141065672 for ; Thu, 14 May 2009 22:53:26 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 958CD8FC16 for ; Thu, 14 May 2009 22:53:25 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id B447F5C026 for ; Fri, 15 May 2009 06:53:24 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 2220755D1755; Fri, 15 May 2009 06:53:24 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id BCs6XJf+Ffvh; Fri, 15 May 2009 06:52:30 +0800 (CST) Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net [76.237.33.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 1D6E355D174B; Fri, 15 May 2009 06:52:23 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=VKHZPQQdVK5rFZghqP4nqbuyhz/0Khuw4B/6OA6JigYFRvjI8E7j9h/mn++ihVums rpI1qVKN1NLkiGWmxUt7A== Message-ID: <4A0CA096.4020706@delphij.net> Date: Thu, 14 May 2009 15:52:06 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.21 (X11/20090408) MIME-Version: 1.0 To: Alexander Sack References: <3c0b01820905141202w113966dp4bfbab73d84d585@mail.gmail.com> <4A0C7544.6010304@delphij.net> <3c0b01820905141301h1b08fc0ay1e6a1676b5a149d4@mail.gmail.com> <4A0C8F30.8080404@delphij.net> <3c0b01820905141505r5b8ea64bq42cdea70ee288015@mail.gmail.com> In-Reply-To: <3c0b01820905141505r5b8ea64bq42cdea70ee288015@mail.gmail.com> X-Enigmail-Version: 0.95.7 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, d@delphij.net Subject: Re: Broadcom bge(4) panics while shutting down X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net 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 22:53:26 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Alexander, Alexander Sack wrote: [...] >> @@ -3193,6 +3193,9 @@ bge_rxeof(struct bge_softc *sc) >> BGE_UNLOCK(sc); >> (*ifp->if_input)(ifp, m); >> BGE_LOCK(sc); >> + >> + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) >> + return; >> } > > Xin this looks fine by me, I actually put this up in the while loop as > I mentioned before which I think is functionality equivalent (can you > gain some optimizations by putting in the while loop though compiler > wise than a separate compilation unit?). I think the two is not semantically the same... For this case an explicit 'return' would mean that no further actions, say the things right after the while loop, would be taken. In my opinion that this is better since there is no protection over these DMA maps (which could have been released elsewhere). Note that I'm still not quite confident about the logic, we might just narrowed but not closed the race completely - these BGE_LOCK()/UNLOCK()'s could hit some problem if one thread has done bge_stop() very quickly. That would require more work, though, I don't have a very good plan at this moment... Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkoMoJYACgkQi+vbBBjt66DULwCcCN8AjNLgQU7oiOyKeackBKar V+YAoKHA6dDJymCi8rQEsr7h8m84KoW6 =HWBp -----END PGP SIGNATURE-----