* [PATCH] KVM: arm64: Only open the interrupt window on exit due to an interrupt
@ 2022-03-04 13:59 Marc Zyngier
2022-03-04 14:27 ` Mark Rutland
0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2022-03-04 13:59 UTC (permalink / raw)
To: linux-arm-kernel, kvmarm, kvm
Cc: Mark Rutland, James Morse, Suzuki K Poulose, Alexandru Elisei
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>
---
arch/arm64/kvm/arm.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index fefd5774ab55..f49ebdd9c990 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -887,9 +887,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
* context synchronization event) is necessary to ensure that
* pending interrupts are taken.
*/
- local_irq_enable();
- isb();
- local_irq_disable();
+ if (ARM_EXCEPTION_CODE(ret) == ARM_EXCEPTION_IRQ) {
+ local_irq_enable();
+ isb();
+ local_irq_disable();
+ }
guest_timing_exit_irqoff();
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: arm64: Only open the interrupt window on exit due to an interrupt
2022-03-04 13:59 [PATCH] KVM: arm64: Only open the interrupt window on exit due to an interrupt Marc Zyngier
@ 2022-03-04 14:27 ` Mark Rutland
0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2022-03-04 14:27 UTC (permalink / raw)
To: Marc Zyngier
Cc: linux-arm-kernel, kvmarm, kvm, James Morse, Suzuki K Poulose,
Alexandru Elisei
On Fri, Mar 04, 2022 at 01:59:14PM +0000, Marc Zyngier wrote:
> 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>
Mark.
> ---
> arch/arm64/kvm/arm.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index fefd5774ab55..f49ebdd9c990 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -887,9 +887,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
> * context synchronization event) is necessary to ensure that
> * pending interrupts are taken.
> */
> - local_irq_enable();
> - isb();
> - local_irq_disable();
> + if (ARM_EXCEPTION_CODE(ret) == ARM_EXCEPTION_IRQ) {
> + local_irq_enable();
> + isb();
> + local_irq_disable();
> + }
>
> guest_timing_exit_irqoff();
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-04 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 13:59 [PATCH] KVM: arm64: Only open the interrupt window on exit due to an interrupt Marc Zyngier
2022-03-04 14:27 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox