All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] target-i386 : fix a race condition result to lost INIT
  2017-07-30 20:01 ` [Qemu-devel] " Peng Hao
@ 2017-07-30 12:40   ` Wanpeng Li
  -1 siblings, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2017-07-30 12:40 UTC (permalink / raw)
  To: Peng Hao
  Cc: Paolo Bonzini, Marcelo Tosatti, Richard Henderson,
	Eduardo Habkost, kvm, qemu-devel@nongnu.org Developers

2017-07-31 4:01 GMT+08:00 Peng Hao <peng.hao2@zte.com.cn>:
> 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@zte.com.cn>
> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] target-i386 : fix a race condition result to lost INIT
@ 2017-07-30 12:40   ` Wanpeng Li
  0 siblings, 0 replies; 4+ messages in thread
From: Wanpeng Li @ 2017-07-30 12:40 UTC (permalink / raw)
  To: Peng Hao
  Cc: Paolo Bonzini, Marcelo Tosatti, Richard Henderson,
	Eduardo Habkost, kvm, qemu-devel@nongnu.org Developers

2017-07-31 4:01 GMT+08:00 Peng Hao <peng.hao2@zte.com.cn>:
> 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@zte.com.cn>
> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH]  target-i386 : fix a race condition result to lost INIT
@ 2017-07-30 20:01 ` Peng Hao
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Hao @ 2017-07-30 20:01 UTC (permalink / raw)
  To: pbonzini, mtosatti, rth, ehabkost; +Cc: kvm, qemu-devel, Peng Hao

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.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH] target-i386 : fix a race condition result to lost INIT
@ 2017-07-30 20:01 ` Peng Hao
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Hao @ 2017-07-30 20:01 UTC (permalink / raw)
  To: pbonzini, mtosatti, rth, ehabkost; +Cc: kvm, qemu-devel, Peng Hao

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.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-30 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-30 20:01 [PATCH] target-i386 : fix a race condition result to lost INIT Peng Hao
2017-07-30 20:01 ` [Qemu-devel] " Peng Hao
2017-07-30 12:40 ` Wanpeng Li
2017-07-30 12:40   ` [Qemu-devel] " Wanpeng Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.