Re: Race condition in mb_free_ext()?
From: John Baldwin (jhb_at_FreeBSD.org)
Date: 03/02/05
- Previous message: Ruslan Ermilov: "Re: netgraph question : how to intercept incoming IP packets of a certain type?"
- In reply to: Bosko Milekic: "Re: Race condition in mb_free_ext()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: Bosko Milekic <bmilekic@technokratis.com> Date: Wed, 2 Mar 2005 10:16:36 -0500
On Tuesday 01 March 2005 06:49 pm, Bosko Milekic wrote:
> 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.
Yeah, I have those simple refcount_foo() macros that operate on ints that
would work for here and things like ucreds. Being macros, each arch can
override if they have a better native instruction (xadd on x86, fetchadd on
ia64, etc.)
> -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
-- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
- Previous message: Ruslan Ermilov: "Re: netgraph question : how to intercept incoming IP packets of a certain type?"
- In reply to: Bosko Milekic: "Re: Race condition in mb_free_ext()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]