Marcelo Tosatti wrote: > On Fri, Jun 11, 2010 at 09:31:38PM +0800, Xiao Guangrong wrote: >> If the sync-sp just sync transient, don't mark its pte notrap >> >> Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx> >> --- >> arch/x86/include/asm/kvm_host.h | 2 +- >> arch/x86/kvm/mmu.c | 11 ++++------- >> arch/x86/kvm/paging_tmpl.h | 5 +++-- >> 3 files changed, 8 insertions(+), 10 deletions(-) > > Xiao, > > Can you explain the reasoning for this? > Marcelo, In the kvm_sync_page_transient() path, the sp is keep unsync and sp->gfn is not write protected, we can't set 'spte == shadow_notrap_nonpresent_pte' if the 'gpte.p == 0' in this case. It's because if 'gpte.p == 0', when guest change the gpte's mapping, it's no need to flush tlb(p == 0 means the mapping is not in tlb), if we set spte to 'shadow_notrap_nonpresent_pte', we will miss the chance to update the mapping, also a incorrect #PF will pass to guest directly, may cause guest crash. And, this is the reasoning we do mmu_convert_notrap() in kvm_sync_page_transient() before, this patch just avoid this unnecessary workload. :-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html