buf_ring in HEAD is racy

Ryan Stone rysto32 at gmail.com
Sun Dec 15 06:41:40 UTC 2013


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