i386: hvf: Fix smp boot hangs
RFC PATCH 1/1 i386: hvf: Fix smp boot hangs
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.
--- target/i386/hvf/hvf.c | 5 ----- 1 file changed, 5 deletions(-)
target/i386/hvf/hvf.c +0 -5
@@ -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 ; }
Signature · 1 line
2.20.1
Quoted 24 lines · 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 <[email protected]>--- target/i386/hvf/hvf.c | 5 ----- 1 file changed, 5 deletions(-)target/i386/hvf/hvf.c +0
-1@@ -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); }
target/i386/hvf/hvf.c int hvf_init_vcpu(CPUState *cpu) · line 585
Quoted 4 lines
target/i386/hvf/hvf.c +0
-1@@ -582,8 +581,6 @@ int hvf_init_vcpu(CPUState *cpu)wvmcs (cpu->hvf_fd,VMCS_TPR_THRESHOLD ,0 ); -hvf_reset_vcpu (cpu);
Why this?
target/i386/hvf/hvf.c int hvf_vcpu_exec(CPUState *cpu) · line 661
Quoted 13 lines
target/i386/hvf/hvf.c +0
-2x86cpu =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
Quoted 27 lines · Paolo Bonzini
Quoted 25 lines · 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 <[email protected]>--- target/i386/hvf/hvf.c | 5 ----- 1 file changed, 5 deletions(-)target/i386/hvf/hvf.c +0
-1@@ -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)
Quoted 5 lines
target/i386/hvf/hvf.c int hvf_init_vcpu(CPUState *cpu) · line 585
Quoted 3 lines
target/i386/hvf/hvf.c +0
-1wvmcs (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?
Quoted 17 lines
Quoted 6 lines
target/i386/hvf/hvf.c +0
-0x86cpu =X86_CPU (cpu); x86cpu->env.xsave_buf =qemu_memalign (4096 ,4096 );target/i386/hvf/hvf.c int hvf_vcpu_exec(CPUState *cpu) · line 661
Quoted 8 lines
target/i386/hvf/hvf.c +0
-2@@ -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.
Quoted 1 line
Paoo
Thank you reply.
Signature · 3 lines
Best regards! Hev https://hev.cc