On Thu, 20 Sep 2018, John David Anglin wrote: > This patch may resolve some races in TLB handling. Hopefully, TLB inserts are > accesses and > protected by spin lock. > > If not, we may need to IPI calls and do local purges on PA 2.0. > > Dave > > -- > John David Anglin dave.anglin@xxxxxxxx > - purge_tlb_entries(vma->vm_mm, addr); > set_pte(ptep, pte_mkold(pte)); > + purge_tlb_entries(vma->vm_mm, addr); I think you don't need to swap set_pte and purge_tlb_entries. This piece of code can't race with the TLB handlers because they hold the lock. If you drop the lock from the TLB handlers, it would cause more problems and it couldn't be saved by swapping set_pte and purge_tlb_entries. > #ifdef CONFIG_SMP > or,COND(=) %r0,\spc,%r0 > - sync > - or,COND(=) %r0,\spc,%r0 > - stw \spc,0(\tmp) > + stw,ma \spc,0(\tmp) Does the standard somewhere say that the "ma" completer works like a memory barrier? I didn't know about this. Mikulas