From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nadav Har'El" Subject: Re: [PATCH 08/31] nVMX: Fix local_vcpus_link handling Date: Tue, 17 May 2011 20:57:43 +0300 Message-ID: <20110517175743.GA14864@fermat.math.technion.ac.il> References: <1305575004-nyh@il.ibm.com> <201105161948.p4GJm1as001742@rice.haifa.ibm.com> <20110517131918.GA3809@amt.cnet> <4DD27998.1040105@redhat.com> <20110517143532.GA2490@fermat.math.technion.ac.il> <20110517144257.GA6622@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, gleb@redhat.comqg To: Marcelo Tosatti Return-path: Received: from mailgw12.technion.ac.il ([132.68.225.12]:54697 "EHLO mailgw12.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755745Ab1EQR5s (ORCPT ); Tue, 17 May 2011 13:57:48 -0400 Content-Disposition: inline In-Reply-To: <20110517144257.GA6622@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, May 17, 2011, Marcelo Tosatti wrote about "Re: [PATCH 08/31] nVMX: Fix local_vcpus_link handling": > > For example, currently, vmclear_local_vcpus() not only VMCLEARs the vmcss, > > it also sets vmx->vcpu.cpu = -1, xmv->launched=0 for the vcpus holding these > > VMCSs. If we had only a list of VMCSs, how can we mark the vcpus as being not > > currently loaded (cpu=-1)? > > Do it in vcpu_clear, its just an optimization not necessary in > vmclear_local_vcpus path. Well, what if (say) we're running L2, and L1's vmcs is saved in saved_vmcs01 and is not the current vmcs of the vcpu, and then we shut down the CPU on which this saved_vmcs01 was loaded. We need not only to VMCLEAR this vmcs, we need to also remember that this vmcs is not loaded, so when we nested_vmexit back to L1, we know we need to load the vmcs again. There's solution to this (which Avi also mentioned in his email) - it is to use everywhere my "saved_vmcs" type (which I'd rename "loaded vmcs"), which includes the vmcs *and* the cpu (and possibly "launched"). If the "cpu" field was part of vmx, this was easy - but "cpu" is a field of vcpu, not vmx, so I have problems encapsulating both "vmcs" and "cpu" in one structure everywhere. These are the kind of problems I wrapped my head with, until I gave up and came up with the current solution... -- Nadav Har'El | Tuesday, May 17 2011, 14 Iyyar 5771 nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Bigamy: Having one wife too many. http://nadav.harel.org.il |Monogamy: The same thing!