[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 02/17] qdev: unplug blocker for devices
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v9 02/17] qdev: unplug blocker for devices |
Date: |
Wed, 04 May 2022 13:13:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Jagannathan Raman <jag.raman@oracle.com> writes:
> Add blocker to prevent hot-unplug of devices
>
> TYPE_VFIO_USER_SERVER, which is introduced shortly, attaches itself to a
> PCIDevice on which it depends. If the attached PCIDevice gets removed
> while the server in use, it could cause it crash. To prevent this,
> TYPE_VFIO_USER_SERVER adds an unplug blocker for the PCIDevice.
Appreciate the explanation :)
>
> Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
> Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> include/hw/qdev-core.h | 29 +++++++++++++++++++++++++++++
> hw/core/qdev.c | 24 ++++++++++++++++++++++++
> softmmu/qdev-monitor.c | 4 ++++
> 3 files changed, 57 insertions(+)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 92c3d65208..1b9fa25e5c 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -193,6 +193,7 @@ struct DeviceState {
> int instance_id_alias;
> int alias_required_for_version;
> ResettableState reset;
> + GSList *unplug_blockers;
> };
>
> struct DeviceListener {
> @@ -419,6 +420,34 @@ void qdev_simple_device_unplug_cb(HotplugHandler
> *hotplug_dev,
> void qdev_machine_creation_done(void);
> bool qdev_machine_modified(void);
>
> +/*
Use /** here like we do in the other function comments nearby.
In case you're curious: it's GTK-Doc format. It's intended for
generating documentation from doc comments. Which we don't do, and
perhaps never will. But let's be locally consistent.
> + * qdev_add_unplug_blocker: Adds an unplug blocker to a device
Recommend imperative mood for function comments: "Add an unplug
blocker to a device".
More of the same below.
[...]
- [PATCH v9 00/17] vfio-user server in QEMU, Jagannathan Raman, 2022/05/03
- [PATCH v9 01/17] tests/avocado: Specify target VM argument to helper routines, Jagannathan Raman, 2022/05/03
- [PATCH v9 02/17] qdev: unplug blocker for devices, Jagannathan Raman, 2022/05/03
- Re: [PATCH v9 02/17] qdev: unplug blocker for devices,
Markus Armbruster <=
- [PATCH v9 03/17] remote/machine: add HotplugHandler for remote machine, Jagannathan Raman, 2022/05/03
- [PATCH v9 04/17] remote/machine: add vfio-user property, Jagannathan Raman, 2022/05/03
- [PATCH v9 05/17] configure: require cmake 3.19 or newer, Jagannathan Raman, 2022/05/03
- [PATCH v9 07/17] vfio-user: define vfio-user-server object, Jagannathan Raman, 2022/05/03