lkml.org 
[lkml]   [1999]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    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
    instructions.
    * 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.


    --
    Manfred


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:55    [W:2.219 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site