On Sat, 8 Jul 2006, J.A. [UTF-8] Magallón wrote: > On Fri, 7 Jul 2006 17:22:22 -0500 (CDT), Chase Venters <[email protected]> wrote: > > > > .L7: > > > movl $1, mtx <========= > > > movl spinvar, %eax > > > movl $0, mtx <========= > > > testl %eax, %eax > > > jne .L7 > > > popl %ebp > > > ret > > > > NO! It's not better. You're still not syncing or locking the bus! If you > > refer to the fact that the "movl $1" has magically appeared, that's > > because you've just PAPERED OVER THE PROBLEM WITH "volatile", which is > > _exactly_ what Linus is telling you NOT TO DO. > > > > BTW, I really don't mind if a given architecnture has to lock the bus or > say a prayer to Budha to reload a variable. I want it to be reloaded at > every (or a certain, in case of a (volatile)mtx cast) usage. The compiler > is the responsible of knowing what to do. What if nextgen P4 Xeon do not > need a bus lock ? Will you rewrite the kernel ? Looks like you need to read Documentation/memory-barriers.txt. That file explains why the above assembly code is not correct. Bonus question: what stops the processor from coalescing or rearranging the three movl instructions in that assembly? > -- > J.A. Magallon <jamagallon()ono!com> \ Software is like sex: > \ It's better when it's free > Mandriva Linux release 2007.0 (Cooker) for i586 > Linux 2.6.17-jam01 (gcc 4.1.1 20060518 (prerelease)) #2 SMP PREEMPT Wed -- Vadim Lobanov - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- References:
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Andrew Morton <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- [patch] spinlocks: remove 'volatile'
- From: Ingo Molnar <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Krzysztof Halasa <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "J.A. Magallón" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Chase Venters <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "J.A. Magallón" <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- Prev by Date: Re: [patch] spinlocks: remove 'volatile'
- Next by Date: Re: Process events: Fix biarch compatibility
- Previous by thread: Re: [patch] spinlocks: remove 'volatile'
- Next by thread: Re: [patch] spinlocks: remove 'volatile'
- Index(es):