On 2 October 2018 at 10:59, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 02/10/2018 11:04, Peter Maydell wrote: >> On 2 October 2018 at 09:58, Paolo Bonzini <pbonz...@redhat.com> wrote: >>> >>> First, the reset code should indeed use run_on_cpu (it need not be safe >>> i.e. stop-the-world; just run it in the vCPU thread). It certainly >>> doesn't do this right now. >> >> I don't understand this part. We're resetting the entire world: >> surely we need to stop the entire world first ? > > Most of the world is stopped because it only runs with BQL taken. vCPU > isn't, so we ensure it is stopped by: 1) using run_on_cpu to synchronize > with the executed TBs (or KVM_RUN) 2) ensuring the execution loop is > paused after reset, which is the cpu_can_run part that you snipped.
Maybe I just don't understand what you're suggesting should be done via run-on-cpu. But it seems to me that the problem here is that cpu_stop_current() should not call qemu_cpu_stop() immediately, but instead arrange that this vCPU calls qemu_cpu_stop() when it gets back out of the execution loop. thanks -- PMM