Message ID | 1433783045-8002-2-git-send-email-marc.zyngier@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Marc Zyngier <marc.zyngier@arm.com> 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 <marc.zyngier@arm.com> > --- > 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 *vcpu, struct kvm_run *run) > if (vcpu->arch.pause) > vcpu_pause(vcpu); > > - kvm_vgic_flush_hwstate(vcpu); > kvm_timer_flush_hwstate(vcpu); > > + kvm_vgic_flush_hwstate(vcpu); > + > local_irq_disable(); > > /* > @@ -544,8 +545,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) > > if (ret <= 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; > } > > @@ -577,9 +578,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) > * Back from guest > *************************************************************/ > > - kvm_timer_sync_hwstate(vcpu); > kvm_vgic_sync_hwstate(vcpu); > > + kvm_timer_sync_hwstate(vcpu); > + > ret = handle_exit(vcpu, run, ret); > } Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
On Mon, Jun 08, 2015 at 06:03:56PM +0100, Marc Zyngier wrote: > 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 <marc.zyngier@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 *vcpu, struct kvm_run *run) if (vcpu->arch.pause) vcpu_pause(vcpu); - kvm_vgic_flush_hwstate(vcpu); kvm_timer_flush_hwstate(vcpu); + kvm_vgic_flush_hwstate(vcpu); + local_irq_disable(); /* @@ -544,8 +545,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) if (ret <= 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; } @@ -577,9 +578,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) * Back from guest *************************************************************/ - kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); + kvm_timer_sync_hwstate(vcpu); + ret = handle_exit(vcpu, run, ret); }
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 <marc.zyngier@arm.com> --- arch/arm/kvm/arm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)