Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-05 Thread Xiao Guangrong
[ CCed Zhang Yang ] On 06/04/2015 04:36 PM, Paolo Bonzini wrote: On 04/06/2015 10:23, Xiao Guangrong wrote: So, why do you need to always use IPAT=0? Can patch 15 keep the current logic for RAM, like this: if (is_mmio || kvm_arch_has_noncoherent_dma(vcpu-kvm)) ret =

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-04 Thread Paolo Bonzini
On 04/06/2015 10:26, Xiao Guangrong wrote: CR0.CD is always 0 in both host and guest, i guess it's why we cleared CR0.CD and CR0.NW in vmx_set_cr0(). It reminds me that we should check guest CR0.CD before check guest MTRR and disable guest PAT if guest CR0.CD = 1. I think it can be done

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-04 Thread Xiao Guangrong
On 06/03/2015 03:55 PM, Paolo Bonzini wrote: On 03/06/2015 04:56, Xiao Guangrong wrote: On 06/01/2015 05:36 PM, Paolo Bonzini wrote: On 30/05/2015 12:59, Xiao Guangrong wrote: Currently guest MTRR is completely prohibited if cache snoop is supported on IOMMU (!noncoherent_dma) and

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-04 Thread Paolo Bonzini
On 04/06/2015 10:23, Xiao Guangrong wrote: So, why do you need to always use IPAT=0? Can patch 15 keep the current logic for RAM, like this: if (is_mmio || kvm_arch_has_noncoherent_dma(vcpu-kvm)) ret = kvm_mtrr_get_guest_memory_type(vcpu, gfn)

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-04 Thread Xiao Guangrong
On 06/04/2015 04:23 PM, Xiao Guangrong wrote: On 06/03/2015 03:55 PM, Paolo Bonzini wrote: On 03/06/2015 04:56, Xiao Guangrong wrote: On 06/01/2015 05:36 PM, Paolo Bonzini wrote: On 30/05/2015 12:59, Xiao Guangrong wrote: Currently guest MTRR is completely prohibited if cache snoop

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-03 Thread Paolo Bonzini
On 03/06/2015 04:56, Xiao Guangrong wrote: On 06/01/2015 05:36 PM, Paolo Bonzini wrote: On 30/05/2015 12:59, Xiao Guangrong wrote: Currently guest MTRR is completely prohibited if cache snoop is supported on IOMMU (!noncoherent_dma) and host does the emulation based on the knowledge

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-02 Thread Xiao Guangrong
On 06/01/2015 05:36 PM, Paolo Bonzini wrote: On 30/05/2015 12:59, Xiao Guangrong wrote: Currently guest MTRR is completely prohibited if cache snoop is supported on IOMMU (!noncoherent_dma) and host does the emulation based on the knowledge from host side, however, host side is not the good

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-01 Thread Paolo Bonzini
On 01/06/2015 11:36, Paolo Bonzini wrote: Does this have a performance impact on shadow? Perhaps we could cache in struct kvm_arch_memory_slot whether the memslot is covered by MTRRs? Nevermind, patch 15 answers my question. Paolo -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-06-01 Thread Paolo Bonzini
On 30/05/2015 12:59, Xiao Guangrong wrote: Currently guest MTRR is completely prohibited if cache snoop is supported on IOMMU (!noncoherent_dma) and host does the emulation based on the knowledge from host side, however, host side is not the good point to know what the purpose of guest is. A

[PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range

2015-05-30 Thread Xiao Guangrong
Based on Intel's SDM, mapping huge page which do not have consistent memory cache for each 4k page will cause undefined behavior In order to avoiding this kind of undefined behavior, we force to use 4k pages under this case Signed-off-by: Xiao Guangrong guangrong.x...@linux.intel.com ---