From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] Activate Virtualization On Demand v2 Date: Wed, 05 Nov 2008 11:54:03 +0100 Message-ID: <49117B4B.8060406@suse.de> References: <1225874896-13186-1-git-send-email-agraf@suse.de> <706158FABBBA044BAD4FE898A02E4BC2172ECF06@pdsmsx503.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" , "avi@redhat.com" , "kraxel@redhat.com" , "anthony@codemonkey.ws" , "Sander.Vanleeuwen@sun.com" , "zach@vmware.com" , "brogers@novell.com" To: "Zhang, Xiantao" Return-path: Received: from cantor2.suse.de ([195.135.220.15]:58062 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752AbYKEKyG (ORCPT ); Wed, 5 Nov 2008 05:54:06 -0500 In-Reply-To: <706158FABBBA044BAD4FE898A02E4BC2172ECF06@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Zhang, Xiantao wrote: > Alexander Graf wrote: > >> X86 CPUs need to have some magic happening to enable the >> virtualization >> extensions on them. This magic can result in unpleasant results for >> users, like blocking other VMMs from working (vmx) or using invalid >> TLB >> entries (svm). >> >> Currently KVM activates virtualization when the respective kernel >> module >> is loaded. This blocks us from autoloading KVM modules without >> breaking >> other VMMs. >> >> To circumvent this problem at least a bit, this patch introduces on >> demand activation of virtualization. This means, that instead >> virtualization is enabled on creation of the first virtual machine >> and disabled on removal of the last one. >> >> So using this, KVM can be easily autoloaded, while keeping other >> hypervisors usable. >> >> v2 adds returns to non-x86 hardware_enables and adds IA64 change >> >> Signed-off-by: Alexander Graf >> --- >> arch/ia64/kvm/kvm-ia64.c | 8 +++-- >> arch/powerpc/kvm/powerpc.c | 3 +- >> arch/s390/kvm/kvm-s390.c | 3 +- >> arch/x86/kvm/svm.c | 13 +++++-- >> arch/x86/kvm/vmx.c | 7 ++++- >> arch/x86/kvm/x86.c | 4 +- >> include/asm-x86/kvm_host.h | 2 +- >> include/linux/kvm_host.h | 2 +- >> virt/kvm/kvm_main.c | 72 >> +++++++++++++++++++++++++++++++------------ 9 files changed, 80 >> insertions(+), 34 deletions(-) >> >> diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c >> index c25c75b..2bd79db 100644 >> --- a/arch/ia64/kvm/kvm-ia64.c >> +++ b/arch/ia64/kvm/kvm-ia64.c >> @@ -110,7 +110,7 @@ long ia64_pal_vp_create(u64 *vpd, u64 *host_iva, >> u64 *opt_handler) >> >> static DEFINE_SPINLOCK(vp_lock); >> >> -void kvm_arch_hardware_enable(void *garbage) >> +int kvm_arch_hardware_enable(void *garbage) >> { >> long status; >> long tmp_base; >> @@ -124,7 +124,7 @@ void kvm_arch_hardware_enable(void *garbage) >> slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); >> local_irq_restore(saved_psr); >> if (slot < 0) >> - return; >> + return -ENOMEM; >> > > Return -EINVAL maybe more accurate. Here slot < 0 means invalid or uncorrect parameters are passed to ia64_itr_entry. > Xiantao > Okies.