capability races (was: Re: Seeing ENOTCAPABLE from write FDs in kqueue?)

Adrian Chadd adrian at freebsd.org
Fri Jun 20 02:05:50 UTC 2014


[snip]

I'm increasingly wary of hand-rolled memory barrier / atomic using
constructs like this. It's way, way too easy to shoot a foot off on an
architecture that you don't have or know.

So, if we're going down this rabbit hole further, I think we should
first define all the places this stuff gets touched and try to come up
with some behavioral description that we could try and link to some
existing (non-patent-encumbered) no-lock based design pattern.

So in your example, yes the pointer assignment is atomic, but there's
no current guarantee that anything currently operating on that pointer
has finished. That's what things like RCU address.

It's cool that you've kept digging into this :-)


-a


More information about the freebsd-arch mailing list