qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 17/26] replay: push replay_mutex_lock up the


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH 17/26] replay: push replay_mutex_lock up the call tree
Date: Fri, 3 Nov 2017 11:17:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 03/11/2017 10:16, Pavel Dovgalyuk wrote:
>> From: Paolo Bonzini [mailto:address@hidden
>> On 31/10/2017 12:26, Pavel Dovgalyuk wrote:
>>> +    /* We need to drop the replay_lock so any vCPU threads woken up
>>> +     * can finish their replay tasks
>>> +     */
>>> +    if (replay_mode != REPLAY_MODE_NONE) {
>>> +        g_assert(replay_mutex_locked());
>>> +        qemu_mutex_unlock_iothread();
>>> +        replay_mutex_unlock();
>>> +        qemu_mutex_lock_iothread();
>>> +    }
>>
>> The assert+unlock+lock here is unnecessary; just do
>>
>>     if (replay_mode != REPLAY_MODE_NONE) {
>>         replay_mutex_unlock();
>>     }
>>
>> which according to a previous suggestion can become just
>>
>>     replay_mutex_unlock();
> 
> We can't remove qemu_mutex_unlock_iothread(), because there is an assert
> inside replay_mutex_unlock(), which checks that iothread is unlocked.

I think the assert is wrong.  Lock hierarchy only applies to lock, not
unlock.

Paolo

>>
>>>      while (!all_vcpus_paused()) {
>>>          qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
>>>          CPU_FOREACH(cpu) {
>>>              qemu_cpu_kick(cpu);
>>>          }
>>>      }
>>> +
>>> +    if (replay_mode != REPLAY_MODE_NONE) {
>>> +        qemu_mutex_unlock_iothread();
>>> +        replay_mutex_lock();
>>> +        qemu_mutex_lock_iothread();
>>> +    }
>>
> 
> Pavel Dovgalyuk
> 




reply via email to

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