lkml.org 
[lkml]   [2015]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/15] KVM: MTRR: do not map huage page for non-consistent range


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 good example is that pass-throughed VGA
> frame buffer is not always UC as host expected

Can you explain how? The original idea was that such a framebuffer
would be kvm_is_reserved_pfn and thus be unconditionally UC.

> +bool kvm_mtrr_check_gfn_range_consistency(struct kvm_vcpu *vcpu, gfn_t gfn,
> + int page_num)
> +{
> + struct mtrr_looker looker;
> + struct kvm_mtrr *mtrr_state = &vcpu->arch.mtrr_state;
> + u64 start = gfn_to_gpa(gfn), end = gfn_to_gpa(gfn + page_num);
> + int type = -1;
> +
> + mtrr_for_each_mem_type(&looker, mtrr_state, start, end) {
> + if (type == -1) {
> + type = looker.mem_type;
> + continue;
> + }
> +
> + if (type != looker.mem_type)
> + return false;
> + }
> +
> + if ((type != -1) && looker.partial_map &&
> + (mtrr_state->def_type != type))
> + return false;
> +

No Pascal-like parentheses.

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?

Paolo


\
 
 \ /
  Last update: 2015-06-01 12:01    [W:0.146 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site