Re: [patch] SMP alternatives

From: Mikulas Patocka (mikulas_at_artax.karlin.mff.cuni.cz)
Date: 11/24/05

  • Next message: Dmitry Torokhov: "Re: Mouse issues in -mm"
    Date:	Thu, 24 Nov 2005 04:23:59 +0100 (CET)
    To: Alan Cox <alan@lxorguk.ukuu.org.uk>
    
    

    On Wed, 23 Nov 2005, Alan Cox wrote:

    > On Mer, 2005-11-23 at 10:42 -0800, Linus Torvalds wrote:
    >> Of course, if it's in one of the low 12 bits of %cr3, there would have to
    >> be a "enable this bit" in %cr4 or something. Historically, you could write
    >> any crap in the low bits, I think.
    >
    > There is a much much better way to do it than just user space and
    > without hitting cr3/cr4 - put "lock works" in the PAT and while we'll
    > have to add PAT support which we need to do anyway we would get a world
    > where on uniprocessor lock prefix only works on addresse targets we want
    > it to - ie pci_alloc_consistent() pages.

    Given the CPU architecture it is unimplementable. Intructions are split
    into microinstuctions and they are executed out of order. PAT is looked up
    when LOAD microinstruction is executed. Imagine this

    MOV EDX, [address1]
    LOCK ADD [address2], EDX

    that is translated to

    LOAD EDX, [address1]
    LOAD TMP1, [address2]
    ADD TMP1, EDX
    STORE [address2], TMP1

    ... now LOAD finds LOCK attribute in PAT --- so it locks the bus, however
    EDX is still not loaded. Now LOAD EDX can't execute because the bus is
    locked and ADD and STORE can't execute because they're waiting for LOAD
    EDX. Deadlock.

    Locks are so slow not because they are locks (if the target is in L1
    cache, they operate only on cache and don't go to bus at all), but because
    they need to flush completely microinstruction pool to avoid problems like
    this. Of course Intel won't waste silicon in the execution engine for
    instructions that execute so rarely, so they microcode them instead. So
    lock detection is done at the decoder.

    Mikulas

    > Alan
    >
    > -
    > 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/
    >
    -
    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/


  • Next message: Dmitry Torokhov: "Re: Mouse issues in -mm"

    Relevant Pages

    • Re: Wantto: Lock Computer then execute command (load a black screen)
      ... Windows + L just lets me lock my computer. ... It doesn't allow me to execute a ... command, or load a program, or start my screensaver immediately. ...
      (microsoft.public.windowsxp.general)
    • Re: a few issues with events
      ... the compiler or JIT engine should always be able to check if a thing is null and just not execute the code using the null reference. ... Of course, this would lead to problems where code silently fails when a reference is null, in many cases simply not executing code that's very important to execute. ... you should never lock on "this" anyway. ... If you want a thread blocked on Jointo process messages, you will probably have to use p/invoke to get at the SendMessagefunction directly, and also override the WndProc method in your Form class so that you can receive the message sent by SendMessage. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Fwd: [HP3000-L] Max Extents and Extents size from intrinsic FFILEINFO
      ... EXECUTE: FALSE ... APPEND: FALSE ... LOCK: FALSE ... * To join/leave the list, search archives, change list settings, * ...
      (comp.sys.hp.mpe)
    • Re: CANT FIND SEGER SONG .Lock and load
      ... Time to lock and load ... Time to get control ... I can see where Im goin, but I cant see the light ...
      (rec.gambling.poker)
    • Re: CANT FIND SEGER SONG .Lock and load
      ... Time to lock and load ... Time to get control ... I can see where Im goin, but I cant see the light ...
      (rec.gambling.poker)