On Mon, 2018-02-12 at 11:41 +0100, Paolo Bonzini wrote: > 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. Ok. > 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. Can you explain ? I'm not sure I got what you mean here. > 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. Not pHyp then, I don't think we have any such thing on PAPR, you are probably thinking about s390 ? How do you tell the guest on x86 ? You synthetize some kind of artificial interrupt ? There's a paravirt stuff for the guest to tell you it knows about it ? Or some other mechanism ? For powerpc, we could do something similar fairly easily since we are paravirtualized but I'd like to see how that's plumbed into the exist archs who use it so we don't diverge too much. Cheers, Ben.