qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] racing between pause_all_vcpus() and qemu_cpu_stop()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] racing between pause_all_vcpus() and qemu_cpu_stop()
Date: Tue, 2 Oct 2018 18:46:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 02/10/2018 12:34, Peter Maydell wrote:
> On 2 October 2018 at 10:59, Paolo Bonzini <address@hidden> wrote:
>> On 02/10/2018 11:04, Peter Maydell wrote:
>>> On 2 October 2018 at 09:58, Paolo Bonzini <address@hidden> 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.

It will already do it in qemu_wait_io_event_common.  So perhaps it's
enough to do cpu_exit(cpu) in pause_all_vcpus() and cpu_stop_current(),
instead of cpu_stop_current() which incorrectly sets cpu->stopped to true?

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]