All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RFC v1] i386: hvf: Fix smp boot hangs
@ 2019-01-23  7:34 Heiher
  2019-01-23  9:45 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Heiher @ 2019-01-23  7:34 UTC (permalink / raw)
  To: Paolo Bonzini, Richard Henderson, Eduardo Habkost; +Cc: qemu-devel, Heiher

The machine that with hvf accelerator and smp sometimes boot hangs
because all processors are executing instructions at startup,
including early I/O emulations. We should just allow the bootstrap
processor to initialize the machine and then to wake up slave
processors by interrupt.

Signed-off-by: Heiher <r@hev.cc>
---
 target/i386/hvf/hvf.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index e193022c03..0921fcba45 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -499,7 +499,6 @@ void hvf_reset_vcpu(CPUState *cpu) {
     }
 
     hv_vm_sync_tsc(0);
-    cpu->halted = 0;
     hv_vcpu_invalidate_tlb(cpu->hvf_fd);
     hv_vcpu_flush(cpu->hvf_fd);
 }
@@ -582,8 +581,6 @@ int hvf_init_vcpu(CPUState *cpu)
 
     wvmcs(cpu->hvf_fd, VMCS_TPR_THRESHOLD, 0);
 
-    hvf_reset_vcpu(cpu);
-
     x86cpu = X86_CPU(cpu);
     x86cpu->env.xsave_buf = qemu_memalign(4096, 4096);
 
@@ -659,8 +656,6 @@ int hvf_vcpu_exec(CPUState *cpu)
     int ret = 0;
     uint64_t rip = 0;
 
-    cpu->halted = 0;
-
     if (hvf_process_events(cpu)) {
         return EXCP_HLT;
     }
-- 
2.20.1

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

* Re: [Qemu-devel] [PATCH RFC v1] i386: hvf: Fix smp boot hangs
  2019-01-23  7:34 [Qemu-devel] [PATCH RFC v1] i386: hvf: Fix smp boot hangs Heiher
@ 2019-01-23  9:45 ` Paolo Bonzini
  2019-01-23 11:05   ` Heiher
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2019-01-23  9:45 UTC (permalink / raw)
  To: Heiher, Richard Henderson, Eduardo Habkost; +Cc: qemu-devel

On 23/01/19 08:34, Heiher wrote:
> The machine that with hvf accelerator and smp sometimes boot hangs
> because all processors are executing instructions at startup,
> including early I/O emulations. We should just allow the bootstrap
> processor to initialize the machine and then to wake up slave
> processors by interrupt.
> 
> Signed-off-by: Heiher <r@hev.cc>
> ---
>  target/i386/hvf/hvf.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> index e193022c03..0921fcba45 100644
> --- a/target/i386/hvf/hvf.c
> +++ b/target/i386/hvf/hvf.c
> @@ -499,7 +499,6 @@ void hvf_reset_vcpu(CPUState *cpu) {
>      }
>  
>      hv_vm_sync_tsc(0);
> -    cpu->halted = 0;
>      hv_vcpu_invalidate_tlb(cpu->hvf_fd);
>      hv_vcpu_flush(cpu->hvf_fd);
>  }
> @@ -582,8 +581,6 @@ int hvf_init_vcpu(CPUState *cpu)
>  
>      wvmcs(cpu->hvf_fd, VMCS_TPR_THRESHOLD, 0);
>  
> -    hvf_reset_vcpu(cpu);

Why this?

>      x86cpu = X86_CPU(cpu);
>      x86cpu->env.xsave_buf = qemu_memalign(4096, 4096);
>  
> @@ -659,8 +656,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>      int ret = 0;
>      uint64_t rip = 0;
>  
> -    cpu->halted = 0;
> -
>      if (hvf_process_events(cpu)) {
>          return EXCP_HLT;
>      }
> 

Looks good apart from the question above.

Paoo

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

* Re: [Qemu-devel] [PATCH RFC v1] i386: hvf: Fix smp boot hangs
  2019-01-23  9:45 ` Paolo Bonzini
@ 2019-01-23 11:05   ` Heiher
  0 siblings, 0 replies; 3+ messages in thread
From: Heiher @ 2019-01-23 11:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Richard Henderson, Eduardo Habkost, qemu-devel

On Wed, Jan 23, 2019 at 5:45 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 23/01/19 08:34, Heiher wrote:
> > The machine that with hvf accelerator and smp sometimes boot hangs
> > because all processors are executing instructions at startup,
> > including early I/O emulations. We should just allow the bootstrap
> > processor to initialize the machine and then to wake up slave
> > processors by interrupt.
> >
> > Signed-off-by: Heiher <r@hev.cc>
> > ---
> >  target/i386/hvf/hvf.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
> > index e193022c03..0921fcba45 100644
> > --- a/target/i386/hvf/hvf.c
> > +++ b/target/i386/hvf/hvf.c
> > @@ -499,7 +499,6 @@ void hvf_reset_vcpu(CPUState *cpu) {
> >      }
> >
> >      hv_vm_sync_tsc(0);
> > -    cpu->halted = 0;
> >      hv_vcpu_invalidate_tlb(cpu->hvf_fd);
> >      hv_vcpu_flush(cpu->hvf_fd);
> >  }
> > @@ -582,8 +581,6 @@ int hvf_init_vcpu(CPUState *cpu)
> >
> >      wvmcs(cpu->hvf_fd, VMCS_TPR_THRESHOLD, 0);
> >
> > -    hvf_reset_vcpu(cpu);
>
> Why this?
It looks redundant. I think it is enough to reset vcpu from
x86_cpu_reset, likes kvm.
https://git.qemu.org/?p=qemu.git;a=blob;f=target/i386/cpu.c;h=2f5412592d30ea7a24810f3bf6a8c7d4b035a0f9;hb=952bc8b3c2cbba78261923a1e8ca55cda261dee9#l4732
Do you think it is correct?
>
> >      x86cpu = X86_CPU(cpu);
> >      x86cpu->env.xsave_buf = qemu_memalign(4096, 4096);
> >
> > @@ -659,8 +656,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >      int ret = 0;
> >      uint64_t rip = 0;
> >
> > -    cpu->halted = 0;
> > -
> >      if (hvf_process_events(cpu)) {
> >          return EXCP_HLT;
> >      }
> >
>
> Looks good apart from the question above.
>
> Paoo

Thank you reply.

-- 
Best regards!
Hev
https://hev.cc

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

end of thread, other threads:[~2019-01-23 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23  7:34 [Qemu-devel] [PATCH RFC v1] i386: hvf: Fix smp boot hangs Heiher
2019-01-23  9:45 ` Paolo Bonzini
2019-01-23 11:05   ` Heiher

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.