buf_ring in HEAD is racy

Adrian Chadd adrian at freebsd.org
Sun Dec 15 20:47:09 UTC 2013


surely we can do this without critical enter/exit..

How's this implementation of single-reader multiple-writer compare to
like, the dozens of other userland ones that are out there in the open
source world?



-a

On 14 December 2013 22:41, Ryan Stone <rysto32 at gmail.com> wrote:
> On Sat, Dec 14, 2013 at 7:08 PM, Adrian Chadd <adrian at freebsd.org> wrote:
>> Honestly, we could just do with a generic multi-writer, single-reader
>> ring type that we can re-use for other things, rather than just mbufs.
>
> That is actually exactly what buf_ring is -- it deals with void *, not
> struct mbuf *.
>
>> We could also have the code run in userland and do some very in-depth
>> stress testing of it there rather than needing it to be in the kernel.
>
> For testing purposes this isn't very hard -- I did it yesterday while
> debugging this problem. The one trick is that buf_ring uses
> critical_enter/critical_exit to prevent livelock (which was woefully
> undocumented in the code) so when I was testing I had to make sure
> that I didn't have more threads than cores.


More information about the freebsd-net mailing list