|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [RFC v4 16/28] tcg: drop global lock during TCG code execution |
Date: | Tue, 6 Sep 2016 21:03:42 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 08/11/2016 08:24 AM, Alex Bennée 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? (2) If there's a good reason why not, then perhaps if (mr->global_locking) { qemu_mutex_lock_iothread(); do_something; qemu_mutex_unlock_iothread(); } else { do_something; } is a better pattern to use. r~
[Prev in Thread] | Current Thread | [Next in Thread] |