From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Damien Hedde <damien.hedde@greensocs.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, berrange@redhat.com,
ehabkost@redhat.com,
Richard Henderson <richard.henderson@linaro.org>,
cohuck@redhat.com, mark.burton@greensocs.com,
qemu-s390x@nongnu.org, edgari@xilinx.com, pbonzini@redhat.com,
david@gibson.dropbear.id.au
Subject: Re: [PATCH v7 02/11] hw/core/qdev: add trace events to help with resettable transition
Date: Thu, 16 Jan 2020 03:04:32 +0100 [thread overview]
Message-ID: <f507aa1b-6410-bb89-df28-3302b5cc47a1@redhat.com> (raw)
In-Reply-To: <20200115123620.250132-3-damien.hedde@greensocs.com>
On 1/15/20 1:36 PM, Damien Hedde wrote:
> Adds trace events to reset procedure and when updating the parent
> bus of a device.
>
> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/core/qdev.c | 29 ++++++++++++++++++++++++++---
> hw/core/trace-events | 9 +++++++++
> 2 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 8c0c8284c8..5cb03136b5 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -38,6 +38,7 @@
> #include "hw/boards.h"
> #include "hw/sysbus.h"
> #include "migration/vmstate.h"
> +#include "trace.h"
>
> bool qdev_hotplug = false;
> static bool qdev_hot_added = false;
> @@ -98,7 +99,11 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
> bool replugging = dev->parent_bus != NULL;
>
> if (replugging) {
> - /* Keep a reference to the device while it's not plugged into
> + trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
> + dev->parent_bus, object_get_typename(OBJECT(dev->parent_bus)),
> + OBJECT(bus), object_get_typename(OBJECT(bus)));
> + /*
> + * Keep a reference to the device while it's not plugged into
> * any bus, to avoid it potentially evaporating when it is
> * dereffed in bus_remove_child().
> */
> @@ -296,6 +301,18 @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
> return hotplug_ctrl;
> }
>
> +static int qdev_prereset(DeviceState *dev, void *opaque)
> +{
> + trace_qdev_reset_tree(dev, object_get_typename(OBJECT(dev)));
> + return 0;
> +}
> +
> +static int qbus_prereset(BusState *bus, void *opaque)
> +{
> + trace_qbus_reset_tree(bus, object_get_typename(OBJECT(bus)));
> + return 0;
> +}
> +
> static int qdev_reset_one(DeviceState *dev, void *opaque)
> {
> device_legacy_reset(dev);
> @@ -306,6 +323,7 @@ static int qdev_reset_one(DeviceState *dev, void *opaque)
> static int qbus_reset_one(BusState *bus, void *opaque)
> {
> BusClass *bc = BUS_GET_CLASS(bus);
> + trace_qbus_reset(bus, object_get_typename(OBJECT(bus)));
> if (bc->reset) {
> bc->reset(bus);
> }
> @@ -314,7 +332,9 @@ static int qbus_reset_one(BusState *bus, void *opaque)
>
> void qdev_reset_all(DeviceState *dev)
> {
> - qdev_walk_children(dev, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
> + trace_qdev_reset_all(dev, object_get_typename(OBJECT(dev)));
> + qdev_walk_children(dev, qdev_prereset, qbus_prereset,
> + qdev_reset_one, qbus_reset_one, NULL);
> }
>
> void qdev_reset_all_fn(void *opaque)
> @@ -324,7 +344,9 @@ void qdev_reset_all_fn(void *opaque)
>
> void qbus_reset_all(BusState *bus)
> {
> - qbus_walk_children(bus, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
> + trace_qbus_reset_all(bus, object_get_typename(OBJECT(bus)));
> + qbus_walk_children(bus, qdev_prereset, qbus_prereset,
> + qdev_reset_one, qbus_reset_one, NULL);
> }
>
> void qbus_reset_all_fn(void *opaque)
> @@ -1131,6 +1153,7 @@ void device_legacy_reset(DeviceState *dev)
> {
> DeviceClass *klass = DEVICE_GET_CLASS(dev);
>
> + trace_qdev_reset(dev, object_get_typename(OBJECT(dev)));
> if (klass->reset) {
> klass->reset(dev);
> }
> diff --git a/hw/core/trace-events b/hw/core/trace-events
> index fe47a9c8cb..a375aa88a4 100644
> --- a/hw/core/trace-events
> +++ b/hw/core/trace-events
> @@ -1,2 +1,11 @@
> # loader.c
> loader_write_rom(const char *name, uint64_t gpa, uint64_t size, bool isrom) "%s: @0x%"PRIx64" size=0x%"PRIx64" ROM=%d"
> +
> +# qdev.c
> +qdev_reset(void *obj, const char *objtype) "obj=%p(%s)"
> +qdev_reset_all(void *obj, const char *objtype) "obj=%p(%s)"
> +qdev_reset_tree(void *obj, const char *objtype) "obj=%p(%s)"
> +qbus_reset(void *obj, const char *objtype) "obj=%p(%s)"
> +qbus_reset_all(void *obj, const char *objtype) "obj=%p(%s)"
> +qbus_reset_tree(void *obj, const char *objtype) "obj=%p(%s)"
> +qdev_update_parent_bus(void *obj, const char *objtype, void *oldp, const char *oldptype, void *newp, const char *newptype) "obj=%p(%s) old_parent=%p(%s) new_parent=%p(%s)"
>
next prev parent reply other threads:[~2020-01-16 2:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 12:36 [PATCH v7 00/11] Multi-phase reset mechanism Damien Hedde
2020-01-15 12:36 ` [PATCH v7 01/11] add device_legacy_reset function to prepare for reset api change Damien Hedde
2020-01-18 6:48 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 02/11] hw/core/qdev: add trace events to help with resettable transition Damien Hedde
2020-01-16 2:04 ` Philippe Mathieu-Daudé [this message]
2020-01-15 12:36 ` [PATCH v7 03/11] hw/core: create Resettable QOM interface Damien Hedde
2020-01-16 1:59 ` Philippe Mathieu-Daudé
2020-01-16 2:12 ` Philippe Mathieu-Daudé
2020-01-16 8:53 ` Damien Hedde
2020-01-16 8:57 ` Philippe Mathieu-Daudé
2020-01-18 6:35 ` Philippe Mathieu-Daudé
2020-01-20 8:50 ` Damien Hedde
2020-01-18 6:42 ` Philippe Mathieu-Daudé
2020-01-20 9:08 ` Damien Hedde
2020-01-20 9:18 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 04/11] hw/core: add Resettable support to BusClass and DeviceClass Damien Hedde
2020-01-16 2:02 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 05/11] hw/core/resettable: add support for changing parent Damien Hedde
2020-01-18 6:45 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 06/11] hw/core/qdev: handle parent bus change regarding resettable Damien Hedde
2020-01-16 2:05 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 07/11] hw/core/qdev: update hotplug reset " Damien Hedde
2020-01-18 6:47 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 08/11] hw/core: deprecate old reset functions and introduce new ones Damien Hedde
2020-01-18 6:47 ` Philippe Mathieu-Daudé
2020-01-15 12:36 ` [PATCH v7 09/11] docs/devel/reset.rst: add doc about Resettable interface Damien Hedde
2020-01-15 12:36 ` [PATCH v7 10/11] vl: replace deprecated qbus_reset_all registration Damien Hedde
2020-01-15 23:44 ` Philippe Mathieu-Daudé
2020-01-16 8:57 ` Damien Hedde
2020-01-15 12:36 ` [PATCH v7 11/11] hw/s390x/ipl: replace deprecated qdev_reset_all registration Damien Hedde
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=f507aa1b-6410-bb89-df28-3302b5cc47a1@redhat.com \
--to=philmd@redhat.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=damien.hedde@greensocs.com \
--cc=david@gibson.dropbear.id.au \
--cc=edgari@xilinx.com \
--cc=ehabkost@redhat.com \
--cc=mark.burton@greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.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).