[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/14] cpus: Don't kick un-realized cpus.
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/14] cpus: Don't kick un-realized cpus. |
Date: |
Thu, 26 Mar 2015 17:02:25 +0100 |
From: Peter Crosthwaite <address@hidden>
following a464982499b2f637f6699e3d03e0a9d2e0b5288b, it's now possible for
there to be attempts to take the BQL before CPUs have been realized in
cases where a machine model inits peripherals before the first CPU.
BQL lock aquisition kicks the first_cpu, leading to a segfault if this
happens pre-realize. Guard the CPU kick routine to perform no action for
a CPU that doesn't exist or doesn't have a thread yet.
There was a fix to this with commit
6b49809c597331803ea941eadda813e5bb4e8fe2, but the check there misses
the case where the CPU has been inited and not realized. Strengthen the
check to make sure that the first_cpu has a thread (i.e. it is
realized) before allowing the kick.
Signed-off-by: Peter Crosthwaite <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 314df16..e6dcae3 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1119,7 +1119,7 @@ bool qemu_in_vcpu_thread(void)
void qemu_mutex_lock_iothread(void)
{
atomic_inc(&iothread_requesting_mutex);
- if (!tcg_enabled() || !first_cpu) {
+ if (!tcg_enabled() || !first_cpu || !first_cpu->thread) {
qemu_mutex_lock(&qemu_global_mutex);
atomic_dec(&iothread_requesting_mutex);
} else {
--
2.3.3
- [Qemu-devel] [PULL 00/14] Misc bugfixes for 2.3.0-rc2, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 01/14] rcu tests: fix compilation on 32-bit ppc, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 04/14] i6300esb: Fix signed integer overflow, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 05/14] cpus: Don't kick un-realized cpus.,
Paolo Bonzini <=
- [Qemu-devel] [PULL 02/14] fw_cfg: factor out initialization of FW_CFG_ID (rev. number), Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 07/14] vmw_pvscsi: use PCI DMA APIs, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 08/14] nbd: Fix up comment after commit e140177, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 06/14] megasas: use PCI DMA APIs, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 03/14] i6300esb: Correct endiannness, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 13/14] misc: fix typos in copyright declaration, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 12/14] exec: avoid possible overwriting of mmaped area in qemu_ram_remap, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 09/14] m68k: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 10/14] mips: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory, Paolo Bonzini, 2015/03/26
- [Qemu-devel] [PULL 11/14] sparc: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory, Paolo Bonzini, 2015/03/26