[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 06/11] sparc/sparc64: grab BQL before calling
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 06/11] sparc/sparc64: grab BQL before calling cpu_check_irqs |
Date: |
Mon, 6 Mar 2017 14:22:38 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 06/03/2017 11:28, Alex Bennée wrote:
>> This can be called from gdbstub, so you need to put the lock/unlock
>> around helper_wrpsr's call to cpu_put_psr instead. Also please add a
>> comment /* Called with BQL held. */ around cpu_put_psr.
>
> OK will do. I have to say its hard to see the gdbstub being under the
> BQL. Is this a feature of the packet handling being done in the main IO
> thread?
Yes.
It's probably nigh time to have stronger debug facilities for locks,
including changing our lock policy comments to optional assertions.
I'm even thinking of doing something like C++'s std::unique_lock, for
example
// Takes a lock and unlocks it when the scope is left.
// c++: std::lock_guard<std::mutex> sl(some_lock);
QEMU_SCOPED_MUTEX(QemuMutex, some_lock) sl;
// The lock is also unlocked correctly when the scope is left.
// c++: std::unique_lock<std::mutex> sl(some_lock);
QEMU_SCOPED_MUTEX(QemuMutex, some_lock) sl;
...
for (;;) {
qemu_scoped_mutex_unlock(&sl);
if (foo) {
break;
}
...
qemu_scoped_mutex_lock(&sl);
}
// The lock is taken later.
// c++: std::unique_lock<std::mutex> sl(some_lock, std::defer_lock);
QEMU_SCOPED_MUTEX_DEFER(QemuMutex, some_lock) sl;
...
if (x) {
qemu_scoped_mutex_lock(&sl);
}
Paolo
[Qemu-devel] [PATCH v2 07/11] s390x/misc_helper.c: wrap IO instructions in BQL, Alex Bennée, 2017/03/02
[Qemu-devel] [PATCH v2 08/11] target/xtensa: hold BQL for interrupt processing, Alex Bennée, 2017/03/02
[Qemu-devel] [PATCH v2 10/11] target/arm/helper: make it clear the EC field is also in hex, Alex Bennée, 2017/03/02
[Qemu-devel] [PATCH v2 11/11] hw/intc/arm_gic: modernise the DPRINTF, Alex Bennée, 2017/03/02