On 12/02/2018 11:33, Benjamin Herrenschmidt wrote: > My limited understanding > right now is that we set it via gup on a write fault in the struct > page, and it can only be cleared via page_mkclean which takes the > mapping out. But I haven't checked that this is 100% tight (meaning we > don't actually rely on the 2nd level page table dirty bit except for > dirty_map tracking). Yeah, 2nd-level page tables only use dirty bits internally for KVM's dirty page logging (if it's active) or don't use them at all. In fact I don't know about PPC but on x86 we actually do write-protection except on the newest processors that have a dirty page _log_ in addition to the bits. With the bits only, scanning the page tables and clearing the bits atomically one page at a time is incredibly slow and hits the cache really badly. With write protection, each fault is slower but KVM_GET_DIRTY_LOG is hundreds of times faster. And slowing down accesses to dirty pages might actually _help_ migration converge---it's not a bug, it's a feature! :) >> See the untested/uncompiled patch below the signature for some ideas. > I can give that a spin tomorrow with a bit of luck (30 other things on > my plate), or maybe Paul can. > > BTW. Is there some doc/explanation about the whole Async page fault > business ? What is it about ? I wonder if it's something we > could/should use as well. Quite likely since it was stolen from pHyp. The idea is that you tell the guest about _host_ page faults and the guest starts running some other process. Then when the host page fault is resolved, you tell the guest about that as well. This way host page faults are resolved without blocking the whole guest. Paolo