lkml.org 
[lkml]   [2005]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: question on memory barrier
    From
    Date
    On Iau, 2005-08-25 at 11:14 +0200, moreau francis wrote:
    > I'm compiling Linux kernel for a MIPS32 cpu. On my platform, writel seems
    > expand to:
    >
    > static inline writel(u32 val, volatile void __iomem *mem)
    > {
    > volatile u32 *__mem;
    > u32 __val;
    >
    > __mem = (void *)((unsigned long)(mem));
    > __val = val;
    >
    > *__mem = __val;
    > }
    >
    > I don't see the magic in it since "volatile" keyword do not handle memory
    > ordering constraints...Linus wrote on volatile keyword, see

    For the case and the platform the volatile is sufficient to force
    ordering. That or the arch code author made a mistake. But I think its
    sufifcient for MIPS. The volatile prevents

    *foo = 1;
    *foo = 2;

    or even

    *foo;

    from being collapsed together or eliminated

    -
    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: 2005-08-25 11:42    [W:0.027 / U:31.028 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site