Date: Sun, 15 Dec 2013 12:47:08 -0800 From: Adrian Chadd <adrian@freebsd.org> To: Ryan Stone <rysto32@gmail.com> Cc: freebsd-net <freebsd-net@freebsd.org> Subject: Re: buf_ring in HEAD is racy Message-ID: <CAJ-Vmonw5=tQCCV2XUV=TD9c0NebCjDch2fpGp%2BsUMd4JLcJrg@mail.gmail.com> In-Reply-To: <CAFMmRNyPKWt4psvXoJ%2BrwrX1R%2Bu1oM8EBbK%2BbG6JzU%2BVZrEXng@mail.gmail.com> References: <CAFMmRNyJpvZ0AewWr62w16=qKer%2BFNXUJJy0Qc=EBqMnUV3OyQ@mail.gmail.com> <CAJ-Vmo=7DWgBFB=j2_qsFM3YwgO56LETjGXuAYaiaicMMqL19Q@mail.gmail.com> <CAFMmRNyPKWt4psvXoJ%2BrwrX1R%2Bu1oM8EBbK%2BbG6JzU%2BVZrEXng@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@gmail.com> wrote: > On Sat, Dec 14, 2013 at 7:08 PM, Adrian Chadd <adrian@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmonw5=tQCCV2XUV=TD9c0NebCjDch2fpGp%2BsUMd4JLcJrg>