From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 1/2] nVMX: Add KVM_REQ_IMMEDIATE_EXIT Date: Mon, 26 Sep 2011 08:02:23 -0300 Message-ID: <20110926110223.GA5169@amt.cnet> References: <1316688715-nyh@il.ibm.com> <201109221052.p8MAquAQ003115@rice.haifa.ibm.com> <20110923123633.GA30599@amt.cnet> <20110925081306.GA20035@fermat.math.technion.ac.il> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, Dave Allan , Federico Simoncelli , Abel Gordon To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35956 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305Ab1IZLDK (ORCPT ); Mon, 26 Sep 2011 07:03:10 -0400 Content-Disposition: inline In-Reply-To: <20110925081306.GA20035@fermat.math.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Sep 25, 2011 at 11:13:06AM +0300, Nadav Har'El wrote: > On Fri, Sep 23, 2011, Marcelo Tosatti wrote about "Re: [PATCH 1/2] nVMX: Add KVM_REQ_IMMEDIATE_EXIT": > > On Thu, Sep 22, 2011 at 01:52:56PM +0300, Nadav Har'El wrote: > > > This patch adds a new vcpu->requests bit, KVM_REQ_IMMEDIATE_EXIT. > > > This bit requests that when next entering the guest, we should run it only > > > for as little as possible, and exit again. > > > > > > We use this new option in nested VMX: When L1 launches L2, but L0 wishes L1 > >... > > > @@ -5647,6 +5648,8 @@ static int vcpu_enter_guest(struct kvm_v > > > } > > > if (kvm_check_request(KVM_REQ_STEAL_UPDATE, vcpu)) > > > record_steal_time(vcpu); > > > + req_immediate_exit = > > > + kvm_check_request(KVM_REQ_IMMEDIATE_EXIT, vcpu); > >... > > The immediate exit information can be lost if entry decides to bail out. > > You can do > > > > req_immediate_exit = kvm_check_request(KVM_REQ_IMMEDIATE_EXIT) > > after preempt_disable() > > and then transfer back the bit in the bail out case in > > if (vcpu->mode == EXITING_GUEST_MODE || vcpu->requests > > Thanks. > > But thinking about this a bit, it seems to me that in my case *losing* this > bit on a canceled entry is the correct thing to do, as turning on this bit was > decided in the injection phase (in enable_irq_window()), and next time, if > the reason to turn on this bit still exists (i.e., L0 has something to inject > to L1, but L2 needs to run), we will turn it on again. Correct, the loss is irrelevant.