On Tue, Oct 16, 2018 at 08:08:44AM -0700, Sean Christopherson wrote: >On Tue, 2018-10-09 at 15:32 +0000, richard.weiyang@xxxxxxxxx wrote: >> > If the PTE is indeed writable, we can also create the shadow PTE with >> > write permissions even though we're handling a read fault.????Marking >> > the SPTE as writable means we don't take another page fault if/when >> > the guest writes the page, e.g. in a RMW scenario we take one page >> > fault instead of two. >> > >> This makes sence to me. >> >> As you mentioned in the last sentense of previous paragraph, a read-only >> PTE with writable VMA means the PTE is indeed writalbe. In this case we >> could set the SPTE as write to reduce another page fault in a RMW >> scenario. >> >> After all I still have one confusion: >> >> ?? My confusion is why the 2nd __get_user_pages_fast() would succeed >> ?? while the 1st failed with same parameters passed. Do we touch the PTE >> ?? mapping during get_user_pages_unlocked()? > >Yep, get_user_pages_unlocked() will fault-in the page if necessary. Ah, got it. Thanks :-) -- Wei Yang Help you, Help me