All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Brown <sa212+emis@cyconix.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Canonical ring-buffer code : SMP, single-reader/writer
Date: Sun, 17 Oct 2010 22:50:19 +0100	[thread overview]
Message-ID: <4CBB6F9B.6080803@cyconix.com> (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

                 reply	other threads:[~2010-10-17 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CBB6F9B.6080803@cyconix.com \
    --to=sa212+emis@cyconix.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.