All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Schnell <mschnell@lumino.de>
To: linux-kernel@vger.kernel.org, nios2-dev <nios2-dev@sopc.et.ntust.edu.tw>
Subject: atomic RAM ?
Date: Thu, 08 Apr 2010 09:32:53 +0200	[thread overview]
Message-ID: <4BBD86A5.5030109@lumino.de> (raw)

... continuing a discussion on a similar issue some months ago ...

Hi experts,
To do Futex in userspace and many things in the Kernel there are several
predefined "atomic" macros.

Depending on the arch, there are several ways to do this:

 - normal "read-modify-write" processor instructions that by design are
not interrupted  (e.g. x86 and 68K non-SMP)
 - normal "read-modify-write" processor instructions that by design are
not interrupted and bus locking (e.g. Ubicom 7K SMP)
 - normal "read-modify-write" processor instructions with bus lock
prefix instruction (x86 SMP)
 - disable, enable the Interrupt (non-SMP archs that allow for this,
often used in user space with uClinux)
 - "atomic region": the global ISR (return) code detects and finalizes
atomic functions, because they are in a certain code region (non-SMP
archs that don't have atomic instructions, e.g. BlackFin)

Now I (we ?) face a new class of archs. Here I use the (currently
non-SMP), MMU-enabled NIOS2 (provided as IP-Core in Altera FPGA). I
suppose there are other IP-Core processors or otherwise expendable CPUs
with similar specs:

 - no normal processor "read-modify-write" instructions that by design
are not interrupted or even bus-locking
 - new "custom" processor instructions can be defined that might work
atomically, as well not interruptible as kind of bus-locking for SMP use
 - these custom instructions can't access the memory in normal way
(through the MMU and the cache).

So to implement atomic instructions a dedicated RAM area would be needed
to hold the atomically accessible data. Same can't be accessed by the
CPU in other ways. This RAM area would be implemented with the new
atomic instructions and be located within the FPGA and thus could
accessed very fast (no cache issues).

Of course this would need for the Kernel and the libraries to avoid any
access to that RAM area with normal instructions. All code would need to
use the set of "atomic" macros to access that RAM. Here I suppose we
would need some additional atomic Macros such as "atomic_malloc()",
"atomic_read_word()" etc, which, with normal archs would just reproduce
the standard code.

Of course the size of the "atomic RAM" would be limited and thus a
system error would be generated if same would be exhausted. I don't
think that, with the intended "embedded" use, this would be a serious issue.

I feel that thinking about this could be viable task - even if this
might ask for some modifications in the global arch-independent Kernel
and/or library code, as I suppose this is the only way to allow for
implementing an SMP design with NIOS and similar archs. (Happily these
modifications would be "compatible" by design as with any existing arch
just the existing code would be reproduced by the new Macros and so
their use is strictly optional with any arch other than those that would
profit from the new implementation.)

What do you think ?

-Michael


             reply	other threads:[~2010-04-08  8:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  7:32 Michael Schnell [this message]
     [not found] ` <4BBDA1CB.3070204@davidnewall.com>
2010-04-08  9:52   ` atomic RAM ? Michael Schnell
2010-04-12 12:54     ` Pavel Machek
2010-04-14  8:42       ` Michael Schnell
     [not found] ` <k2gbca41b4c1004080243nc45a10aereaae18557808c943@mail.gmail.com>
2010-04-08 10:12   ` Michael Schnell
2010-04-08 10:45 ` Alan Cox
2010-04-08 12:11   ` Michael Schnell
2010-04-08 12:14     ` David Miller
2010-04-08 12:30       ` Michael Schnell
2010-04-08 14:15         ` Arnd Bergmann
2010-04-09 10:54           ` Michael Schnell
     [not found]           ` <4BBEECC8.10005@lumino.de>
     [not found]             ` <201004091714.04990.arnd@arndb.de>
2010-04-12  9:58               ` Michael Schnell
2010-04-12 15:02                 ` Arnd Bergmann
2010-04-13 10:11                   ` Michael Schnell
     [not found]                 ` <u2j42b5547a1004120845x87d7f2f7wd4acea1144153dd6@mail.gmail.com>
2010-04-13  8:39                   ` [Nios2-dev] " Michael Schnell
2010-04-08 13:37     ` Alan Cox
2010-04-09 10:55       ` Michael Schnell
2010-04-09 11:54         ` Alan Cox
2010-04-09 12:53           ` Michael Schnell
2010-04-09 13:15             ` Alan Cox
2010-04-09 13:14               ` Michael Schnell
2010-04-09 13:32               ` Michael Schnell
2010-04-14 12:46       ` Michael Schnell
2010-04-14 12:57         ` Alan Cox
2010-04-14 14:38           ` Michael Schnell
2010-04-09  1:36 ` Mike Frysinger
2010-04-09  9:23   ` Michael Schnell

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=4BBD86A5.5030109@lumino.de \
    --to=mschnell@lumino.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nios2-dev@sopc.et.ntust.edu.tw \
    /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.