From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Subject: [Qemu-devel] [PULL 05/14] cpus: Don't kick un-realized cpus.
Date: Thu, 26 Mar 2015 17:02:25 +0100 [thread overview]
Message-ID: <1427385754-13012-6-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1427385754-13012-1-git-send-email-pbonzini@redhat.com>
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
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 <peter.crosthwaite@xilinx.com>
Message-Id: <1427107689-6946-1-git-send-email-peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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
next prev parent reply other threads:[~2015-03-26 16:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 16:02 [Qemu-devel] [PULL 00/14] Misc bugfixes for 2.3.0-rc2 Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 01/14] rcu tests: fix compilation on 32-bit ppc Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 02/14] fw_cfg: factor out initialization of FW_CFG_ID (rev. number) Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 03/14] i6300esb: Correct endiannness Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 04/14] i6300esb: Fix signed integer overflow Paolo Bonzini
2015-03-26 16:02 ` Paolo Bonzini [this message]
2015-03-26 16:02 ` [Qemu-devel] [PULL 06/14] megasas: use PCI DMA APIs Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 07/14] vmw_pvscsi: " Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 08/14] nbd: Fix up comment after commit e140177 Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 09/14] m68k: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 10/14] mips: " Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 11/14] sparc: " Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 12/14] exec: avoid possible overwriting of mmaped area in qemu_ram_remap Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 13/14] misc: fix typos in copyright declaration Paolo Bonzini
2015-03-26 16:02 ` [Qemu-devel] [PULL 14/14] virtio-scsi-dataplane: fix memory leak for VirtIOSCSIVring Paolo Bonzini
2015-03-26 18:34 ` [Qemu-devel] [PULL 00/14] Misc bugfixes for 2.3.0-rc2 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427385754-13012-6-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).