public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Joseph Seigh" <jseigh_02@xemaps.com>
To: linux-kernel@vger.kernel.org
Subject: Re: What does atomic_read actually do?
Date: Sat, 18 Dec 2004 14:20:44 -0500	[thread overview]
Message-ID: <opsi7xcuizs29e3l@grunion> (raw)
In-Reply-To: 1103394867.4127.18.camel@laptopd505.fenrus.org

On Sat, 18 Dec 2004 19:34:27 +0100, Arjan van de Ven <arjan@infradead.org>  
wrote:

> On Sat, 2004-12-18 at 11:23 -0500, Joseph Seigh wrote:
>> It doesn't do anything that would actually guarantee that the fetch from
>> memory would be atomic as far as I can see, at least in the x86 version.
>
> define atomic....
>
> what linux atomics guarantee you is that you either "see" the old or the
> new value if you use atomic_* as the sole accessor API, with the
> footnote that this only holds if you don't forcefully misalign the
> atomic_t.
>
> if you want ordering guarantees on top... you need to use explicit
> bariers for that (wmb/rmb and friends).
>
> For the "no inbetween" rule, doing the read the way x86 does works on
> x86, since x86 makes sure that on the write side, no intermediate
> results become visible.

I mean atomic in the either old or new sense.  I'm wondering what  
guarantees
the atomicity.  Not the C standard.  I can see the gcc compiler uses a MOV
instruction to load the atomic_t from memory which is guaranteed atomic by
the architecture if aligned properly.  But gcc does that for any old int
as far as I can see, so why use atomic_read?

Joe Seigh


  reply	other threads:[~2004-12-18 19:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-18 16:23 What does atomic_read actually do? Joseph Seigh
2004-12-18 17:11 ` Paolo Ornati
2004-12-18 18:14   ` Joseph Seigh
2004-12-18 18:34 ` Arjan van de Ven
2004-12-18 19:20   ` Joseph Seigh [this message]
2004-12-18 19:39     ` Joe Korty
2004-12-18 19:54     ` Arjan van de Ven
2004-12-18 20:43       ` Joseph Seigh
2004-12-18 21:03         ` Brian Gerst
2004-12-19 22:21         ` Robert Love
2004-12-19 23:50           ` Joseph Seigh
2004-12-20 11:51             ` Arjan van de Ven
2004-12-20 12:52             ` Andrea Arcangeli
2004-12-20 20:51               ` Joseph Seigh
2004-12-18 20:47 ` Brian Gerst

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=opsi7xcuizs29e3l@grunion \
    --to=jseigh_02@xemaps.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox