Skip to content

Commit 4198f38

Browse files
committed
KVM: x86: Eliminate "handling" of impossible errors during SUSPEND
Drop KVM's handling of kvm_set_guest_paused() failure when reacting to a SUSPEND notification, as kvm_set_guest_paused() only "fails" if the vCPU isn't using kvmclock, and KVM's notifier callback pre-checks that kvmclock is active. I.e. barring some bizarre edge case that shouldn't be treated as an error in the first place, kvm_arch_suspend_notifier() can't fail. Reviewed-by: Paul Durrant <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d9c5ed0 commit 4198f38

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

arch/x86/kvm/x86.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6905,21 +6905,15 @@ static int kvm_arch_suspend_notifier(struct kvm *kvm)
69056905
{
69066906
struct kvm_vcpu *vcpu;
69076907
unsigned long i;
6908-
int ret = 0;
6909-
6910-
kvm_for_each_vcpu(i, vcpu, kvm) {
6911-
if (!vcpu->arch.pv_time.active)
6912-
continue;
69136908

6914-
ret = kvm_set_guest_paused(vcpu);
6915-
if (ret) {
6916-
kvm_err("Failed to pause guest VCPU%d: %d\n",
6917-
vcpu->vcpu_id, ret);
6918-
break;
6919-
}
6920-
}
6909+
/*
6910+
* Ignore the return, marking the guest paused only "fails" if the vCPU
6911+
* isn't using kvmclock; continuing on is correct and desirable.
6912+
*/
6913+
kvm_for_each_vcpu(i, vcpu, kvm)
6914+
(void)kvm_set_guest_paused(vcpu);
69216915

6922-
return ret ? NOTIFY_BAD : NOTIFY_DONE;
6916+
return NOTIFY_DONE;
69236917
}
69246918

69256919
int kvm_arch_pm_notifier(struct kvm *kvm, unsigned long state)

0 commit comments

Comments
 (0)