lkml.org 
[lkml]   [2007]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 0/24] make atomic_read() behave consistently across all architectures
    Date
    On Sunday 09 September 2007 19:18, Arjan van de Ven wrote:
    > On Sun, 9 Sep 2007 19:02:54 +0100
    > Denys Vlasenko <vda.linux@googlemail.com> wrote:
    >
    > > Why is all this fixation on "volatile"? I don't think
    > > people want "volatile" keyword per se, they want atomic_read(&x) to
    > > _always_ compile into an memory-accessing instruction, not register
    > > access.
    >
    > and ... why is that?
    > is there any valid, non-buggy code sequence that makes that a
    > reasonable requirement?

    Well, if you insist on having it again:

    Waiting for atomic value to be zero:

            while (atomic_read(&x))
                    continue;

    gcc may happily convert it into:

    reg = atomic_read(&x);
    while (reg)
    continue;

    Expecting every driver writer to remember that atomic_read is not in fact
    a "read from memory" is naive. That won't happen. Face it, majority of
    driver authors are a bit less talented than Ingo Molnar or Arjan van de Ven ;)
    The name of the macro is saying that it's a read.
    We are confusing users here.

    It's doubly confusing that cpy_relax(), which says _nothing_ about barriers
    in its name, is actually a barrier you need to insert here.
    --
    vda
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-09-10 12:59    [W:4.043 / U:0.300 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site