From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 5/5] KVM: VMX: conditionally disable 2M pages Date: Wed, 10 Jun 2009 12:18:56 +0300 Message-ID: <4A2F7A80.6070703@redhat.com> References: <20090609213009.436123773@amt.cnet> <20090609213312.998029496@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, sheng.yang@intel.com To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60075 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbZFJJS5 (ORCPT ); Wed, 10 Jun 2009 05:18:57 -0400 In-Reply-To: <20090609213312.998029496@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: 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