From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PULL 2/6] iothread: Make iothread_stop() idempotent
Date: Tue, 3 Oct 2017 12:28:37 +0200 [thread overview]
Message-ID: <1507026521-19230-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1507026521-19230-1-git-send-email-pbonzini@redhat.com>
From: Eduardo Habkost <ehabkost@redhat.com>
Currently, iothread_stop_all() makes all iothread objects unsafe
to be destroyed, because qemu_thread_join() ends up being called
twice.
To fix this, make iothread_stop() idempotent by checking
thread->stopped.
Fixes the following crash:
qemu-system-x86_64 -object iothread,id=iothread0 -monitor stdio -display none
QEMU 2.10.50 monitor - type 'help' for more information
(qemu) quit
qemu: qemu_thread_join: No such process
Aborted (core dumped)
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170926130028.12471-1-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
iothread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iothread.c b/iothread.c
index 44c8944..59d0850 100644
--- a/iothread.c
+++ b/iothread.c
@@ -85,7 +85,7 @@ static int iothread_stop(Object *object, void *opaque)
IOThread *iothread;
iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
- if (!iothread || !iothread->ctx) {
+ if (!iothread || !iothread->ctx || iothread->stopping) {
return 0;
}
iothread->stopping = true;
--
1.8.3.1
next prev parent reply other threads:[~2017-10-03 10:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 10:28 [Qemu-devel] [PULL 0/6] Misc patches for 2017-10-03 Paolo Bonzini
2017-10-03 10:28 ` [Qemu-devel] [PULL 1/6] scsi: Ignore executable for in-tree builds Paolo Bonzini
2017-10-03 10:28 ` Paolo Bonzini [this message]
2017-10-03 10:28 ` [Qemu-devel] [PULL 3/6] linux-headers: sync against v4.14-rc1 Paolo Bonzini
2017-10-03 10:28 ` [Qemu-devel] [PULL 4/6] kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension() Paolo Bonzini
2017-10-03 10:28 ` [Qemu-devel] [PULL 5/6] kvm: check KVM_CAP_NR_VCPUS " Paolo Bonzini
2017-10-03 10:28 ` [Qemu-devel] [PULL 6/6] kvmclock: use the updated system_timer_msr Paolo Bonzini
2017-10-03 16:42 ` [Qemu-devel] [PULL 0/6] Misc patches for 2017-10-03 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=1507026521-19230-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.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).