Re: What protects cpu_tlbstate?

2007-04-05 Thread Jeremy Fitzhardinge
Andi Kleen wrote: >> Hm, I was more wondering about simple compiler reordering. Does the >> relative order of setting and reading cpu_tlbstate.state, active_mm and >> the mm->cpu_vm_mask matter? >> > > Hmm, perhaps a barrier between state and active_mm might be a good idea. > Setting

Re: What protects cpu_tlbstate?

2007-04-05 Thread Andi Kleen
On Thursday 05 April 2007 23:00:22 Jeremy Fitzhardinge wrote: > Andi Kleen wrote: > > The interrupts can only happen when the other CPU is already lazy > > and enter_lazy_tlb would be a nop then. The flushers itself are > > synchronized by the page_table_lock or the mm semaphore. > > > > Against

Re: What protects cpu_tlbstate?

2007-04-05 Thread Jeremy Fitzhardinge
Andi Kleen wrote: > The interrupts can only happen when the other CPU is already lazy > and enter_lazy_tlb would be a nop then. The flushers itself are > synchronized by the page_table_lock or the mm semaphore. > > Against switch_mm it tries to protect with ordering. > > wmb()s are not needed on

Re: What protects cpu_tlbstate?

2007-04-05 Thread Andi Kleen
On Thursday 05 April 2007 21:44:10 Jeremy Fitzhardinge wrote: > Hi, > > What protects the cpu_tlbstate? I see in i386/kernel/smp.c that its > always used in a non-preemptable area, but what prevents races with > interrupts? For example, what prevents leave_mm() called via the > flush_tlb_all

Re: What protects cpu_tlbstate?

2007-04-05 Thread Andi Kleen
On Thursday 05 April 2007 21:44:10 Jeremy Fitzhardinge wrote: Hi, What protects the cpu_tlbstate? I see in i386/kernel/smp.c that its always used in a non-preemptable area, but what prevents races with interrupts? For example, what prevents leave_mm() called via the flush_tlb_all IPI from

Re: What protects cpu_tlbstate?

2007-04-05 Thread Jeremy Fitzhardinge
Andi Kleen wrote: The interrupts can only happen when the other CPU is already lazy and enter_lazy_tlb would be a nop then. The flushers itself are synchronized by the page_table_lock or the mm semaphore. Against switch_mm it tries to protect with ordering. wmb()s are not needed on x86 (ok

Re: What protects cpu_tlbstate?

2007-04-05 Thread Andi Kleen
On Thursday 05 April 2007 23:00:22 Jeremy Fitzhardinge wrote: Andi Kleen wrote: The interrupts can only happen when the other CPU is already lazy and enter_lazy_tlb would be a nop then. The flushers itself are synchronized by the page_table_lock or the mm semaphore. Against switch_mm

Re: What protects cpu_tlbstate?

2007-04-05 Thread Jeremy Fitzhardinge
Andi Kleen wrote: Hm, I was more wondering about simple compiler reordering. Does the relative order of setting and reading cpu_tlbstate.state, active_mm and the mm-cpu_vm_mask matter? Hmm, perhaps a barrier between state and active_mm might be a good idea. Setting active_mm after