From owner-freebsd-net@FreeBSD.ORG Tue Mar 1 23:49:59 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B347D16A4CE; Tue, 1 Mar 2005 23:49:59 +0000 (GMT) Received: from stephanie.unixdaemons.com (stephanie.unixdaemons.com [67.18.111.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 427F843D73; Tue, 1 Mar 2005 23:49:59 +0000 (GMT) (envelope-from bmilekic@technokratis.com) Received: from stephanie.unixdaemons.com (bmilekic@localhost.unixdaemons.com [127.0.0.1])j21NnbFQ020169; Tue, 1 Mar 2005 18:49:37 -0500 (EST) Received: (from bmilekic@localhost) by stephanie.unixdaemons.com (8.13.3/8.12.1/Submit) id j21NnbO9020168; Tue, 1 Mar 2005 18:49:37 -0500 (EST) (envelope-from bmilekic@technokratis.com) X-Authentication-Warning: stephanie.unixdaemons.com: bmilekic set sender to bmilekic@technokratis.com using -f Date: Tue, 1 Mar 2005 18:49:37 -0500 From: Bosko Milekic To: Kris Kennaway Message-ID: <20050301234937.GA19502@technokratis.com> References: <20050301000436.GA33346@xor.obsecurity.org> <200503011340.18162.jhb@FreeBSD.org> <20050301231438.GA25573@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050301231438.GA25573@xor.obsecurity.org> User-Agent: Mutt/1.4.2.1i cc: John Baldwin cc: net@freebsd.org cc: rwatson@freebsd.org cc: freebsd-sparc64@freebsd.org cc: sparc64@freebsd.org cc: Bosko Milekic cc: bmilekic@freebsd.org Subject: Re: Race condition in mb_free_ext()? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2005 23:49:59 -0000 You know, the more and more we run into these problems specific to how reference counting is performed, I keep wondering whether some cleverly defined macros for dealing with common reference counting operations would be worthwhile. I'm not saying "introduce a refcount_t type and a full-blown abstraction," but some template-like stuff might be useful. It took a while just to get the refcount decrement on free path free of races on SMP, and that's only in the mbuf code. -Bosko On Tue, Mar 01, 2005 at 03:14:38PM -0800, Kris Kennaway wrote: > On Tue, Mar 01, 2005 at 06:04:27PM -0500, Bosko Milekic wrote: > > > This does not appear to explain the livelock. > > alc and dwhite tracked it down to a missing volatile causing gcc to > mis-optimize the loop: > > - cnt = *(m->m_ext.ref_cnt); > + cnt = *(volatile u_int *)(m->m_ext.ref_cnt); > > I'm currently testing that. > > Kris -- Bosko Milekic bmilekic@technokratis.com bmilekic@FreeBSD.org