From: Jens Freimann <jfrei@linux.vnet.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Graf <agraf@suse.de>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>,
Jens Freimann <jfrei@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] s390x: set missing parent for hotplug and quiesce events
Date: Thu, 1 Oct 2015 10:49:45 +0200 [thread overview]
Message-ID: <1443689387-34473-4-git-send-email-jfrei@linux.vnet.ibm.com> (raw)
In-Reply-To: <1443689387-34473-1-git-send-email-jfrei@linux.vnet.ibm.com>
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
Existing code missed to set a parent for the quiesce and hotplug event.
While this didn't matter in practise, new introspection APIs basically now
do an object_unref(object_new(T)), which loops forever.
When trying to remove the event facility bus, the code tries to
unparent all childs on the bus, so they are properly deleted and therefore removed.
As object_unparent() on these child devices doesn't work, as there is no parent,
we loop forever.
Let's fix this by adding the event facility as a parent. Also switch from
object_initialize to object_new, so the only valid reference is in fact the
parent property. This makes it more obvious when the device (state) is actually
gone (and how the reference counting works).
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
---
hw/s390x/event-facility.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index ef2a051..907b485 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -27,8 +27,6 @@ typedef struct SCLPEventsBus {
struct SCLPEventFacility {
SysBusDevice parent_obj;
SCLPEventsBus sbus;
- SCLPEvent quiesce_event;
- SCLPEvent cpu_hotplug_event;
/* guest' receive mask */
unsigned int receive_mask;
};
@@ -347,19 +345,21 @@ static void init_event_facility(Object *obj)
{
SCLPEventFacility *event_facility = EVENT_FACILITY(obj);
DeviceState *sdev = DEVICE(obj);
+ Object *new;
/* Spawn a new bus for SCLP events */
qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),
TYPE_SCLP_EVENTS_BUS, sdev, NULL);
- object_initialize(&event_facility->quiesce_event, sizeof(SCLPEvent),
- TYPE_SCLP_QUIESCE);
- qdev_set_parent_bus(DEVICE(&event_facility->quiesce_event),
- &event_facility->sbus.qbus);
- object_initialize(&event_facility->cpu_hotplug_event, sizeof(SCLPEvent),
- TYPE_SCLP_CPU_HOTPLUG);
- qdev_set_parent_bus(DEVICE(&event_facility->cpu_hotplug_event),
- &event_facility->sbus.qbus);
+ new = object_new(TYPE_SCLP_QUIESCE);
+ object_property_add_child(obj, TYPE_SCLP_QUIESCE, new, NULL);
+ object_unref(new);
+ qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
+
+ new = object_new(TYPE_SCLP_CPU_HOTPLUG);
+ object_property_add_child(obj, TYPE_SCLP_CPU_HOTPLUG, new, NULL);
+ object_unref(new);
+ qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
/* the facility will automatically realize the devices via the bus */
}
--
2.3.9
next prev parent reply other threads:[~2015-10-01 8:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 8:49 [Qemu-devel] [PATCH 0/5] s390x: misc fixes Jens Freimann
2015-10-01 8:49 ` [Qemu-devel] [PATCH 1/5] pc-bios/s390-ccw: avoid floating point operations Jens Freimann
2015-10-01 8:49 ` [Qemu-devel] [PATCH 2/5] s390x/gdb: expose virtualization specific registers Jens Freimann
2015-10-01 8:49 ` Jens Freimann [this message]
2015-10-02 11:41 ` [Qemu-devel] [PATCH 3/5] s390x: set missing parent for hotplug and quiesce events Christian Borntraeger
2015-10-01 8:49 ` [Qemu-devel] [PATCH 4/5] s390x/info registers: print vector registers properly Jens Freimann
2015-10-01 8:49 ` [Qemu-devel] [PATCH 5/5] s390x: rename io_subsystem_reset -> subsystem_reset Jens Freimann
2015-10-02 11:32 ` [Qemu-devel] [PATCH 0/5] s390x: misc fixes Christian Borntraeger
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=1443689387-34473-4-git-send-email-jfrei@linux.vnet.ibm.com \
--to=jfrei@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.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).