Skip to contentSkip to conversation

Canonical ring-buffer code : SMP, single-reader/writer

DISCUSSION Tom Brown 1 participant 1 message Oct 17, 2010

lore
Share & tools
lore

Tom Brown

author
#0 lore raw

Does anyone happen to know of any good example code that I could use in a driver for a simple single-reader, single-writer, ring buffer, on an SMP system?

My own code doesn't use any locks, but I'm concerned that it may be flaky. It's running on an 8-core processor, and I'm worried that I may be seeing SMP locking issues which I don't understand because the driver is on one core, while the user is on another core.

In my case, the producer is the driver, and the consumer is the user. I could just lock all the driver writes to the buffer and the driver's update of the shared 'last written' pointer, but that seems a really poor design.

Thanks -

Tom