lkml.org 
[lkml]   [2006]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an arch doesn't support it


    On Thu, 7 Dec 2006, Nick Piggin wrote:
    >
    > It might be reasonable to implement this watered down version, but:
    > don't some architectures have restrictions on what instructions can
    > be issued between the ll and the sc?

    Yes. You really probably do not want to expose ll/sc on a C level because
    of this.

    On alpha, the architecture manual says (I didn't go back and check, but
    I'm pretty sure) that a ld.l and st.c cannot have a taken branch in
    between then, for example. That basically means that you can't allow the
    compiler to reorder the basic blocks (which it often will with a
    while-loop).

    Now, I actually suspect that this was not a microarchitectural flaw, and
    that a branch would _work_ there, and that the architecture manual was
    just being anal, but strictly speaking, it means that these things had
    better always be in assembly, and you can sadly not expose them (on alpha,
    at least) as higher-level primitives as such - you can only expose the
    end result ("cmpxchg" or similar).

    Linus
    -
    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: 2009-11-18 23:46    [W:4.903 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site