From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Date: Sun, 08 Jan 2012 15:22:38 +0000 Subject: Re: [PATCH 13/50] KVM: PPC: booke: check for signals in kvmppc_vcpu_run Message-Id: <4F09B4BE.5080109@redhat.com> List-Id: References: <1325639448-9494-1-git-send-email-agraf@suse.de> <1325639448-9494-14-git-send-email-agraf@suse.de> <4F0997BB.7010404@redhat.com> <1C3D93EB-5348-4421-9114-55A73110EB23@suse.de> In-Reply-To: <1C3D93EB-5348-4421-9114-55A73110EB23@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Graf Cc: kvm-ppc@vger.kernel.org, kvm list , Marcelo Tosatti , Scott Wood On 01/08/2012 05:11 PM, Alexander Graf wrote: > On 08.01.2012, at 14:18, Avi Kivity wrote: > > > On 01/04/2012 03:10 AM, Alexander Graf wrote: > >> From: Scott Wood > >> > >> Currently we check prior to returning from a lightweight exit, > >> but not prior to initial entry. > >> > >> book3s already does a similar test. > >> > >> Signed-off-by: Scott Wood > >> Signed-off-by: Alexander Graf > >> --- > >> arch/powerpc/kvm/booke.c | 10 +++++++++- > >> 1 files changed, 9 insertions(+), 1 deletions(-) > >> > >> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > >> index b642200..9c78589 100644 > >> --- a/arch/powerpc/kvm/booke.c > >> +++ b/arch/powerpc/kvm/booke.c > >> @@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) > >> } > >> > >> local_irq_disable(); > >> + > >> + if (signal_pending(current)) { > >> + kvm_run->exit_reason = KVM_EXIT_INTR; > >> + ret = -EINTR; > >> + goto out; > >> + } > >> + > >> kvm_guest_enter(); > >> ret = __kvmppc_vcpu_run(kvm_run, vcpu); > >> kvm_guest_exit(); > >> - local_irq_enable(); > >> > >> > > > > In general a single check prior to entry is sufficient (well, in > > addition to the one in kvm_vcpu_block()). > > Yes, and IIUC this is the single check prior to entry. On lightweight exit, we don't return from __kvmppc_vcpu_run, but only call kvmppc_handle_exit() and if that exits that we return to the guest, we stay inside of __kvmppc_vcpu_run and don't return from here. It means you check twice per heavyweight exit, no? Once here, and once when kvmppc_handle_exit() returns. If, instead, you move the check to just before the lightweight entry, you check just once per entry, like x86. -- error compiling committee.c: too many arguments to function From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 13/50] KVM: PPC: booke: check for signals in kvmppc_vcpu_run Date: Sun, 08 Jan 2012 17:22:38 +0200 Message-ID: <4F09B4BE.5080109@redhat.com> References: <1325639448-9494-1-git-send-email-agraf@suse.de> <1325639448-9494-14-git-send-email-agraf@suse.de> <4F0997BB.7010404@redhat.com> <1C3D93EB-5348-4421-9114-55A73110EB23@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm-ppc@vger.kernel.org, kvm list , Marcelo Tosatti , Scott Wood To: Alexander Graf Return-path: In-Reply-To: <1C3D93EB-5348-4421-9114-55A73110EB23@suse.de> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 01/08/2012 05:11 PM, Alexander Graf wrote: > On 08.01.2012, at 14:18, Avi Kivity wrote: > > > On 01/04/2012 03:10 AM, Alexander Graf wrote: > >> From: Scott Wood > >> > >> Currently we check prior to returning from a lightweight exit, > >> but not prior to initial entry. > >> > >> book3s already does a similar test. > >> > >> Signed-off-by: Scott Wood > >> Signed-off-by: Alexander Graf > >> --- > >> arch/powerpc/kvm/booke.c | 10 +++++++++- > >> 1 files changed, 9 insertions(+), 1 deletions(-) > >> > >> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > >> index b642200..9c78589 100644 > >> --- a/arch/powerpc/kvm/booke.c > >> +++ b/arch/powerpc/kvm/booke.c > >> @@ -322,11 +322,19 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) > >> } > >> > >> local_irq_disable(); > >> + > >> + if (signal_pending(current)) { > >> + kvm_run->exit_reason = KVM_EXIT_INTR; > >> + ret = -EINTR; > >> + goto out; > >> + } > >> + > >> kvm_guest_enter(); > >> ret = __kvmppc_vcpu_run(kvm_run, vcpu); > >> kvm_guest_exit(); > >> - local_irq_enable(); > >> > >> > > > > In general a single check prior to entry is sufficient (well, in > > addition to the one in kvm_vcpu_block()). > > Yes, and IIUC this is the single check prior to entry. On lightweight exit, we don't return from __kvmppc_vcpu_run, but only call kvmppc_handle_exit() and if that exits that we return to the guest, we stay inside of __kvmppc_vcpu_run and don't return from here. It means you check twice per heavyweight exit, no? Once here, and once when kvmppc_handle_exit() returns. If, instead, you move the check to just before the lightweight entry, you check just once per entry, like x86. -- error compiling committee.c: too many arguments to function