Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] MSR_KVM_MIGRATION_CONTROL is disabled during CPU offline and system 
suspend but is never re-enabled upon online/resume, permanently breaking live 
migration.
--

commit 44d44f9fdfe9da0700b2023c4cf04e9f6f582d4c
Author: Sean Christopherson <[email protected]>

x86/kvm: Don't disable kvmclock on BSP in syscore_suspend()

This commit prevents KVM from disabling kvmclock on the BSP during
syscore_suspend(). It introduces a kvm_guest_cpu_action enum to pass specific
actions down to the kvmclock CPU offline path, ensuring the clock is preserved
across a suspend/resume cycle.

> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index c81a24d0efdf6..fd1c417b4f9b9 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -460,7 +460,7 @@ static void __init sev_map_percpu_data(void)

[ ... ]

> -static void kvm_guest_cpu_offline(bool shutdown)
> +static void kvm_guest_cpu_offline(enum kvm_guest_cpu_action action)
>  {
>       kvm_disable_steal_time();
>       if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
> @@ -468,9 +468,10 @@ static void kvm_guest_cpu_offline(bool shutdown)
>       if (kvm_para_has_feature(KVM_FEATURE_MIGRATION_CONTROL))
>               wrmsrq(MSR_KVM_MIGRATION_CONTROL, 0);

[Severity: High]
This isn't a bug introduced by this patch, but I noticed that
MSR_KVM_MIGRATION_CONTROL is cleared to 0 here during CPU offline and system
suspend, but it does not appear to be re-enabled upon online/resume.

Since this patch introduces the kvm_guest_cpu_action enum to solve an
identical state-machine issue for kvmclock, should we also use this action
enum to ensure the migration control MSR isn't incorrectly cleared on
suspend? Otherwise, wouldn't a single CPU hotplug event or a suspend/resume
cycle permanently disable live migration for the entire VM?

>       kvm_pv_disable_apf();
> -     if (!shutdown)
> +     if (action != KVM_GUEST_SHUTDOWN)
>               apf_task_wake_all();
> -     kvmclock_disable();
> +
> +     kvmclock_cpu_action(action);
>  }

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=26

Reply via email to