From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex =?utf-8?Q?Benn=C3=A9e?= Subject: Re: [PATCH 01/10] arm/arm64: KVM: Fix ordering of timer/GIC on guest entry Date: Tue, 09 Jun 2015 12:29:35 +0100 Message-ID: <87wpzd6rxc.fsf@linaro.org> References: <1433783045-8002-1-git-send-email-marc.zyngier@arm.com> <1433783045-8002-2-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Christoffer Dall , Eric Auger , Andre Przywara To: Marc Zyngier Return-path: Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:37836 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbbFIL3Q (ORCPT ); Tue, 9 Jun 2015 07:29:16 -0400 In-reply-to: <1433783045-8002-2-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: Marc Zyngier writes: > As we now inject the timer interrupt when we're about to enter > the guest, it makes a lot more sense to make sure this happens > before the vgic code queues the pending interrupts. > > Otherwise, we get the interrupt on the following exit, which is > not great for latency (and leads to all kind of bizarre issues > when using with active interrupts at the HW level). > > Signed-off-by: Marc Zyngier > --- > arch/arm/kvm/arm.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c > index d9631ec..46db690 100644 > --- a/arch/arm/kvm/arm.c > +++ b/arch/arm/kvm/arm.c > @@ -529,9 +529,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcp= u, struct kvm_run *run) > if (vcpu->arch.pause) > vcpu_pause(vcpu); > =20 > - kvm_vgic_flush_hwstate(vcpu); > kvm_timer_flush_hwstate(vcpu); > =20 > + kvm_vgic_flush_hwstate(vcpu); > + > local_irq_disable(); > =20 > /* > @@ -544,8 +545,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu= , struct kvm_run *run) > =20 > if (ret <=3D 0 || need_new_vmid_gen(vcpu->kvm)) { > local_irq_enable(); > - kvm_timer_sync_hwstate(vcpu); > kvm_vgic_sync_hwstate(vcpu); > + kvm_timer_sync_hwstate(vcpu); > continue; > } > =20 > @@ -577,9 +578,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcp= u, struct kvm_run *run) > * Back from guest > *************************************************************/ > =20 > - kvm_timer_sync_hwstate(vcpu); > kvm_vgic_sync_hwstate(vcpu); > =20 > + kvm_timer_sync_hwstate(vcpu); > + > ret =3D handle_exit(vcpu, run, ret); > } Reviewed-by: Alex Benn=C3=A9e --=20 Alex Benn=C3=A9e