From patchwork Thu Jun 2 08:54:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Har'El X-Patchwork-Id: 842982 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p528shuL026788 for ; Thu, 2 Jun 2011 08:54:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755135Ab1FBIyy (ORCPT ); Thu, 2 Jun 2011 04:54:54 -0400 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:48971 "EHLO mtagate3.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530Ab1FBIyx (ORCPT ); Thu, 2 Jun 2011 04:54:53 -0400 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p528spv6000339 for ; Thu, 2 Jun 2011 08:54:51 GMT Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p528spNb2642158 for ; Thu, 2 Jun 2011 09:54:51 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p528so7K031239 for ; Thu, 2 Jun 2011 09:54:51 +0100 Received: from moren.haifa.ibm.com (moren.haifa.ibm.com [9.148.32.214]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p528soog031236; Thu, 2 Jun 2011 09:54:50 +0100 Received: by moren.haifa.ibm.com (Postfix, from userid 500) id 589883806F0; Thu, 2 Jun 2011 11:54:52 +0300 (IDT) Cc: kvm@vger.kernel.org, "Tian, Kevin" To: "Avi Kivity" , "Marcelo Tosatti" From: "Nadav Har'El" Subject: [PATCH] nVMX: Fix bug preventing more than two levels of nesting Message-Id: <20110602085452.589883806F0@moren.haifa.ibm.com> Date: Thu, 2 Jun 2011 11:54:52 +0300 (IDT) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Jun 2011 08:54:58 +0000 (UTC) The nested VMX feature is supposed to fully emulate VMX for the guest. This (theoretically) not only allows it to run its own guests, but also also to further emulate VMX for its own guests, and allow arbitrarily deep nesting. This patch fixes a bug (discovered by Kevin Tian) in handling a VMLAUNCH by L2, which prevented deeper nesting. Deeper nesting now works (I only actually tested L3), but is currently *absurdly* slow, to the point of being unusable. Signed-off-by: Nadav Har'El --- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- .before/arch/x86/kvm/vmx.c 2011-06-02 10:46:13.000000000 +0300 +++ .after/arch/x86/kvm/vmx.c 2011-06-02 10:46:13.000000000 +0300 @@ -5691,8 +5691,8 @@ static int vmx_handle_exit(struct kvm_vc if (vmx->nested.nested_run_pending) kvm_make_request(KVM_REQ_EVENT, vcpu); - if (exit_reason == EXIT_REASON_VMLAUNCH || - exit_reason == EXIT_REASON_VMRESUME) + if (!is_guest_mode(vcpu) && (exit_reason == EXIT_REASON_VMLAUNCH || + exit_reason == EXIT_REASON_VMRESUME)) vmx->nested.nested_run_pending = 1; else vmx->nested.nested_run_pending = 0;