From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Subject: [PATCH v4 01/11] arm/arm64: KVM: Fix ordering of timer/GIC on guest entry Date: Fri, 7 Aug 2015 16:45:37 +0100 Message-ID: <1438962347-17541-2-git-send-email-marc.zyngier@arm.com> References: <1438962347-17541-1-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christoffer Dall , Eric Auger , Andre Przywara To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Return-path: Received: from foss.arm.com ([217.140.101.70]:43186 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932335AbbHGPpy (ORCPT ); Fri, 7 Aug 2015 11:45:54 -0400 In-Reply-To: <1438962347-17541-1-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Christoffer Dall --- arch/arm/kvm/arm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9ce5cf0..1141d21 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -523,8 +523,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, = struct kvm_run *run) if (vcpu->arch.pause) vcpu_pause(vcpu); =20 - kvm_vgic_flush_hwstate(vcpu); kvm_timer_flush_hwstate(vcpu); + kvm_vgic_flush_hwstate(vcpu); =20 preempt_disable(); local_irq_disable(); @@ -540,8 +540,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, = struct kvm_run *run) if (ret <=3D 0 || need_new_vmid_gen(vcpu->kvm)) { local_irq_enable(); preempt_enable(); - kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); + kvm_timer_sync_hwstate(vcpu); continue; } =20 @@ -587,9 +587,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, = struct kvm_run *run) trace_kvm_exit(kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); preempt_enable(); =20 - - kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); + kvm_timer_sync_hwstate(vcpu); =20 ret =3D handle_exit(vcpu, run, ret); } --=20 2.1.4