[lkml]   [1999]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: spin_unlock optimization(i386)
    Erich Boleyn wrote:
    > But, it is not needed to avoid any kind of re-ordering that IA32 will
    > do. I still maintain that.
    > IA32 just doesn't do program visible reordering. Any reordering is
    > done only as a performance enhancement and with temporary results that
    > are checked prior to becoming committed state.
    It's invisible on single CPU system, but clearly visible on SMP:

    * you (speculatively) execute read instructions ahead of write
    * you do not send write instructions immediately out of the CPU core,
    they sit in a write buffer.
    * the write buffer is private to each CPU.
    * on _single_ cpu, you correct the effects of the reordering (ie if a
    write sits in the write buffer, and I reread that memory address, the
    the CPU notices that, and uses the new value from the write
    buffer/discards the temporary result.)

    BUT: since the write buffer is private to each CPU, you cannot correct
    the effects of the reordering on SMP.

    The program that I sent you yesterday exploits this problem, you could
    run it with a suitable tracer:
    * with "lock;bts", it doesn't hang.
    * with "mov", it hangs.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:55    [W:0.030 / U:12.988 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site