Re: [PATCH] target-i386 : fix a race condition result to lost INIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2017-07-31 4:01 GMT+08:00 Peng Hao <peng.hao2@xxxxxxxxxx>:
> when SMP VM start, AP may lost INIT because of receiving INIT between
> kvm_vcpu_ioctl_x86_get/set_vcpu_events.
>
>    vcpu 0                             vcpu 1
>                                kvm_vcpu_ioctl_x86_get_vcpu_events
>                                        events->smi.latched_init=0
>  send INIT to vcpu1
>    set vcpu1's pending_events
>                                kvm_vcpu_ioctl_x86_set_vcpu_events
>                                     events->smi.latched_init == 0
>                                       clear INIT in pending_events
> considering migration, just at level >= KVM_PUT_RESET_STATE,
> add KVM_VCPUEVENT_VALID_SMM in events.flags.I think it is better to
> modify in qemu.

Do it in qemu just avoids to trigger the bug instead of fixing it. Why
we touch INIT pending if INIT is not latched in SMM?

Regards,
Wanpeng Li

>
> Signed-off-by: Peng Hao <peng.hao2@xxxxxxxxxx>
> ---
>  target/i386/kvm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index a6613e1..be146cb 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -2438,7 +2438,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
>          /* Stop SMI delivery on old machine types to avoid a reboot
>           * on an inward migration of an old VM.
>           */
> -        if (!cpu->kvm_no_smi_migration) {
> +        if (!cpu->kvm_no_smi_migration && (level >= KVM_PUT_RESET_STATE)) {
>              events.flags |= KVM_VCPUEVENT_VALID_SMM;
>          }
>      }
> --
> 1.8.3.1
>
>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux