From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] Activate Virtualization On Demand Date: Mon, 14 Sep 2009 13:46:35 -0300 Message-ID: <20090914164635.GA11728@amt.cnet> References: <1252505938-3944-1-git-send-email-agraf@suse.de> <20090914132342.GA8664@amt.cnet> <20090914161453.GA9816@amt.cnet> <78577088-4F27-48EB-81E2-27F34F3776F3@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Alexander Graf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:7281 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbZINQue (ORCPT ); Mon, 14 Sep 2009 12:50:34 -0400 Content-Disposition: inline In-Reply-To: <78577088-4F27-48EB-81E2-27F34F3776F3@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 14, 2009 at 06:25:20PM +0200, Alexander Graf wrote: >>> having succeeded. The hardware_enable_all caller calls >>> hardware_disable_all (kvm_usage_count--) when enabling fails. >> >> But it does not hold any lock in between hardware_enable_all >> and hardware_disable_all. >> >> So its unsafe if another kvm_create_vm call happens in between, whil= e >> kvm_usage_count is 1 ? > > So what we really need is a lock, so hardware_enable_all doesn't get = =20 > called twice? Isn't that what the kvm_lock here does? Either that or check hardware_enable_failed atomic variable even=20 if kvm_usage_count > 1. >>>> Also, better move vmx.c's ept_sync_global from vmx_init to >>>> hardware_enable. >>> >>> Why? What does that do? >> >> 25.3.3.4 Guidelines for Use of the INVEPT Instruction >> >> Software can use the INVEPT instruction with the =E2=80=9Call-contex= t=E2=80=9D >> INVEPT type immediately after execution of the VMXON instruction or >> immediately prior to execution of the VMXOFF instruction. Either >> prevents potentially undesired retention of information cached from = =20 >> EPT >> paging structures between separate uses of VMX operation. > > Hmhm. I don't have EPT hardware to test things on, but I can of cours= e =20 > make a blind move of the call. OK, i can do some basic testing before applying the patch. > > Alex