RISC-V: KVM: Exit run-loop immediately if xfer_to_guest fails
authorAnup Patel <apatel@ventanamicro.com>
Wed, 7 Dec 2022 03:46:21 +0000 (09:16 +0530)
committerAnup Patel <anup@brainfault.org>
Wed, 7 Dec 2022 03:46:21 +0000 (09:16 +0530)
If xfer_to_guest_mode_handle_work() fails in the run-loop then exit
the run-loop immediately instead of doing it after some more work.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/vcpu.c

index 71ebbc4821f0e34fbb0f5bcdfb1b4f9a654cd236..17d5b3f8c2eecbfbab0049f793add08760b1d3a2 100644 (file)
@@ -984,8 +984,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
        while (ret > 0) {
                /* Check conditions before entering the guest */
                ret = xfer_to_guest_mode_handle_work(vcpu);
-               if (!ret)
-                       ret = 1;
+               if (ret)
+                       continue;
+               ret = 1;
 
                kvm_riscv_gstage_vmid_update(vcpu);