From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH RFC 3/3] qdev: Assert no new devices get created during realization
Date: Mon, 15 Jul 2013 15:40:39 +0200 [thread overview]
Message-ID: <1373895639-21476-4-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1373895639-21476-1-git-send-email-afaerber@suse.de>
This is safe because current devices are already realized at this point
and busses are not devices.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/core/qdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index ec621cd..e86e72d 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -33,6 +33,7 @@
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
+static bool devices_realizing;
int qdev_hotplug = 0;
static bool qdev_hot_added = false;
static bool qdev_hot_removed = false;
@@ -354,7 +355,9 @@ void qdev_machine_creation_done(void)
{
Error *err = NULL;
+ devices_realizing = true;
object_child_foreach(qdev_get_machine(), object_realize_one, &err);
+ devices_realizing = false;
if (err != NULL) {
qerror_report_err(err);
error_free(err);
@@ -808,6 +811,8 @@ static void device_initfn(Object *obj)
Property *prop;
Error *err = NULL;
+ assert(!devices_realizing);
+
if (qdev_hotplug) {
dev->hotplugged = 1;
qdev_hot_added = true;
--
1.8.1.4
next prev parent reply other threads:[~2013-07-15 13:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 13:40 [Qemu-devel] [PATCH RFC 0/3] Recursive QOM realize Andreas Färber
2013-07-15 13:40 ` [Qemu-devel] [PATCH RFC 1/3] qdev: Add support for recursive realization Andreas Färber
2013-07-15 13:40 ` [Qemu-devel] [PATCH RFC 2/3] qdev: Realize on machine creation done Andreas Färber
2013-07-15 13:40 ` Andreas Färber [this message]
2013-07-15 14:43 ` [Qemu-devel] [PATCH RFC 0/3] Recursive QOM realize Paolo Bonzini
2013-07-15 15:06 ` Andreas Färber
2013-07-15 15:37 ` Paolo Bonzini
2013-07-16 12:19 ` Andreas Färber
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=1373895639-21476-4-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=pbonzini@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).