KVM: arm64: Only open the interrupt window on exit due to an interrupt

Now that we properly account for interrupts taken whilst the guest
was running, it becomes obvious that there is no need to open
this accounting window if we didn't exit because of an interrupt.

This saves a number of system register accesses and other barriers
if we exited for any other reason (such as a trap, for example).

Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20220304135914.1464721-1-maz@kernel.org
This commit is contained in:
Marc Zyngier 2022-03-04 12:04:49 +00:00
parent 4c11113c1a
commit f7659f8bcd

View File

@ -945,9 +945,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
* context synchronization event) is necessary to ensure that * context synchronization event) is necessary to ensure that
* pending interrupts are taken. * pending interrupts are taken.
*/ */
local_irq_enable(); if (ARM_EXCEPTION_CODE(ret) == ARM_EXCEPTION_IRQ) {
isb(); local_irq_enable();
local_irq_disable(); isb();
local_irq_disable();
}
guest_timing_exit_irqoff(); guest_timing_exit_irqoff();