Re: [patch 5/5] KVM: VMX: conditionally disable 2M pages

Avi Kivity
2009-06-10T09:18:57Z

Marcelo Tosatti wrote:
> Disable usage of 2M pages if VMX_EPT_2MB_PAGE_BIT (bit 16) is clear
> in MSR_IA32_VMX_EPT_VPID_CAP and EPT is enabled.
>
> Index: kvm/virt/kvm/kvm_main.c
> ===================================================================
> --- kvm.orig/virt/kvm/kvm_main.c
> +++ kvm/virt/kvm/kvm_main.c
> @@ -85,6 +85,8 @@ static long kvm_vcpu_ioctl(struct file *
>
> static bool kvm_rebooting;
>
> +static bool largepages_disabled = false;
> +
> #ifdef KVM_CAP_DEVICE_ASSIGNMENT
> static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head,
> int assigned_dev_id)
> @@ -1184,6 +1186,10 @@ int __kvm_set_memory_region(struct kvm *
> if ((base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE - 1))
> for (i = 0; i < largepages; ++i)
> new.lpage_info[i].write_count = 1;
> +
> + if (largepages_disabled)
> + for (i = 0; i < largepages; ++i)
> + new.lpage_info[i].write_count = 1;
> }
>

Please reuse the loop above, it's exactly the same (think of 1GB pages).

--
error compiling committee.c: too many arguments to function