On 21 March 2018 at 13:55, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 19/03/2018 22:07, Michael Clark wrote: >> We need to use atomic_cmpxchg >> in the PTE update to detect the case where the PTE has changed between >> reading it and updating the accessed dirty bits. > > Yes, this makes sense. In fact having such a function (more precisely > address_space_atomic_cmpxchg) would be useful for x86 too. Right now > x86 is wrong in not using cmpxchg.
Yeah, this is a known missing feature in our APIs for memory accesses (it only starts to matter with MTTCG, really). We ought to have functions that guarantee that they do the access as a single 32/64 bit load/store, as well as having atomic support. PPC and Arm TLB walk code will need these. For the moment we just ignore the possibility of races here, but for the 2.13 timeframe we really ought to design a solution to this properly. thanks -- PMM