[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v4 16/28] tcg: drop global lock during TCG code ex
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC v4 16/28] tcg: drop global lock during TCG code execution |
Date: |
Wed, 7 Sep 2016 17:15:48 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 07/09/2016 08:43, Richard Henderson wrote:
> On 09/06/2016 10:43 PM, Paolo Bonzini wrote:
>>
>>
>> On 07/09/2016 06:03, Richard Henderson wrote:
>>>
>>>> + if (mr->global_locking) {
>>>> + qemu_mutex_lock_iothread();
>>>> + locked = true;
>>>> + }
>>>> memory_region_dispatch_read(mr, physaddr, &val, 1 << SHIFT,
>>>> iotlbentry->attrs);
>>>> + if (locked) {
>>>> + qemu_mutex_unlock_iothread();
>>>> + }
>>>
>>> I'm not keen on this pattern.
>>>
>>> (1) Why not use recursive locks?
>>
>> Probably I'm biased by looking at this code too long, but... how would
>> they help?
>
> You wouldn't check to see if the lock is already taken.
But it's only using qemu_mutex_iothread_locked() at unlock time, when we
exit from longjmp. Here it's looking at a MemoryRegion to see if the
MMIO callbacks need the lock or not (since most of them do).
Paolo