[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler |
Date: |
Wed, 3 Oct 2018 16:29:49 +1000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, Sep 26, 2018 at 11:42:13AM +0200, David Hildenbrand wrote:
> The unplug and unplug_request handlers are special: They are not
> executed when unrealizing a device, but rather trigger the removal of a
> device from device_del() via object_unparent() - to effectively
> unrealize a device.
>
> If such a device has a child bus and another device attached to
> that bus (e.g. how virtio devices are created with their proxy device),
> we will not get a call to the unplug handler. As we want to support
> hotplug handlers (and especially also some unplug logic to undo resource
> assignment) for such devices, we cannot simply call the unplug handler
> when unrealizing - it has a different semantic ("trigger removal").
>
> To handle this scenario, we need a do_unplug handler, that will be
> executed for all devices with a hotplug handler.
>
> While at it, introduce hotplug_fn_nofail and fix a spelling mistake in
> a comment.
>
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
> hw/core/hotplug.c | 10 ++++++++++
> hw/core/qdev.c | 6 ++++++
> include/hw/hotplug.h | 26 ++++++++++++++++++++++++--
> 3 files changed, 40 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/hotplug.c b/hw/core/hotplug.c
> index 2253072d0e..e7a68d5160 100644
> --- a/hw/core/hotplug.c
> +++ b/hw/core/hotplug.c
> @@ -45,6 +45,16 @@ void hotplug_handler_post_plug(HotplugHandler
> *plug_handler,
> }
> }
>
> +void hotplug_handler_do_unplug(HotplugHandler *plug_handler,
> + DeviceState *plugged_dev)
Hrm. I really dislike things named "do_X". The "do" rarely adds any
useful meaning. And when there's also something called just plain
"X", it's *always* unclear how they relate to each other.
That's doubly true when it's a general interface like this, rather
than just some local functions.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, (continued)
- Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/10/08
- Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, Igor Mammedov, 2018/10/08
- Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/10/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, Igor Mammedov, 2018/10/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/10/11
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, Igor Mammedov, 2018/10/12
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/10/12
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, Igor Mammedov, 2018/10/12
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/10/15
Re: [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler,
David Gibson <=