From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
xen-devel@lists.xenproject.org, dave@treblig.org, mst@redhat.com,
imammedo@redhat.com, anisinha@redhat.com, philmd@mailo.com,
aurelien@aurel32.net, mjrosato@linux.ibm.com,
alifm@linux.ibm.com, farman@linux.ibm.com,
richard.henderson@linaro.org, iii@linux.ibm.com,
david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com,
cohuck@redhat.com, alex@shazbot.org, clg@redhat.com,
akrowiak@linux.ibm.com, jjherne@linux.ibm.com,
sstabellini@kernel.org, anthony@xenproject.org,
edgar.iglesias@gmail.com, pbonzini@redhat.com, eblake@redhat.com,
armbru@redhat.com, joe.jin@oracle.com
Subject: Re: [PATCH 3/8] qdev: Support forced device_del in QMP and HMP
Date: Mon, 24 Aug 2026 15:42:20 +0100 [thread overview]
Message-ID: <aoxYTO8UkzzXvKOc@redhat.com> (raw)
In-Reply-To: <20260824011420.752806-4-dongli.zhang@oracle.com>
On Sun, Aug 23, 2026 at 06:13:33PM -0700, Dongli Zhang wrote:
> Add an optional force argument to the QMP device_del command and expose it
> in HMP as "device_del -f".
>
> When force is requested, qdev_unplug() bypasses the pending deletion guard
> and asks the selected hotplug controller to complete removal through its
> force_unplug callback. Controllers that do not implement the callback
> reject the operation.
>
> Forced removal bypasses guest cooperation.
This sentence is rather missing the punchline....
Force removal bypasses guest cooperation and may result in guest
errors, I/O failures, or guest panics. The guest OS cannot be
trusted after force removal until a full power cycle has been
performed.
I'm rather on the fence as to whether it is a good idea to enable
this feature or not. If it is used by a cloud admin without knowledge
of the guest owner, its use is liable to lead to hard-to-debug/diagnose
problems in the guest OS.
If a guest OS is not honouring an unplug request and the host owner needs
to force reclaim a resource, power off is always there as the failsafe.
> diff --git a/qapi/qdev.json b/qapi/qdev.json
> index 974cf9c583..cb5b5ad1db 100644
> --- a/qapi/qdev.json
> +++ b/qapi/qdev.json
> @@ -90,6 +90,11 @@
> #
> # @id: the device's ID or QOM path
> #
> +# @force: if true, remove the device without waiting for guest
> +# cooperation. The guest may still be using the device. This can
> +# cause guest-visible errors, I/O failures, or guest crashes.
I'd want to be warning in a stronger way.
This is a dangerous operation that can cause guest-visible errors,
I/O failures, or guest crashes. The guest OS state should not be
trusted after a forced device removal, until a full power cycle has
been performed.
> +# (since 11.2)
> +#
> # Errors:
> # - If @id is not a valid device, DeviceNotFound
> #
> @@ -101,7 +106,9 @@
> # will automatically complete removal for all devices. If a
> # guest-side error in the hot removal process is detected, the
> # device will not be removed and a `DEVICE_UNPLUG_GUEST_ERROR`
> -# event is sent. Some errors cannot be detected.
> +# event is sent. Some errors cannot be detected. If @force is
> +# true, guest cooperation is bypassed, but backend cleanup is still
> +# performed through the device's normal unrealize path.
> #
> # Since: 0.14
> #
> @@ -117,7 +124,7 @@
> # "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
> # <- { "return": {} }
> ##
> -{ 'command': 'device_del', 'data': {'id': 'str'} }
> +{ 'command': 'device_del', 'data': {'id': 'str', '*force': 'bool'} }
>
> ##
> # @DEVICE_DELETED:
> diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
> index fa3cae246b..ca10a25c46 100644
> --- a/system/qdev-monitor.c
> +++ b/system/qdev-monitor.c
> @@ -956,11 +956,13 @@ void qdev_unplug(DeviceState *dev, bool force, Error **errp)
> error_propagate(errp, local_err);
> }
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-08-24 14:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 1:13 [PATCH 0/8] Force detach PCI devices for ACPI-based and PCIe native hot-unplug Dongli Zhang
2026-08-24 1:13 ` [PATCH 1/8] qdev: Add force argument to qdev_unplug Dongli Zhang
2026-08-24 13:51 ` Jason J. Herne
2026-08-24 1:13 ` [PATCH 2/8] qdev: hotplug: Add force_unplug handler callback Dongli Zhang
2026-08-24 1:13 ` [PATCH 3/8] qdev: Support forced device_del in QMP and HMP Dongli Zhang
2026-08-24 14:42 ` Daniel P. Berrangé [this message]
2026-08-26 15:53 ` Dongli Zhang
2026-08-24 1:13 ` [PATCH 4/8] hw/acpi/pcihp: Add forced slot unplug helper Dongli Zhang
2026-08-24 1:13 ` [PATCH 5/8] hw/acpi/piix4: Support forced PCI unplug Dongli Zhang
2026-08-24 1:13 ` [PATCH 6/8] hw/acpi/ich9: " Dongli Zhang
2026-08-24 1:13 ` [PATCH 7/8] hw/acpi/ged: " Dongli Zhang
2026-08-24 1:13 ` [PATCH 8/8] hw/pci/pcie: Support forced PCIe native unplug Dongli Zhang
2026-08-24 14:44 ` [PATCH 0/8] Force detach PCI devices for ACPI-based and PCIe native hot-unplug Daniel P. Berrangé
2026-08-26 16:15 ` Dongli Zhang
2026-09-03 15:28 ` Igor Mammedov
2026-09-03 20:17 ` Michael S. Tsirkin
2026-09-04 11:07 ` Igor Mammedov
2026-09-04 11:22 ` Michael S. Tsirkin
2026-09-04 12:08 ` Igor Mammedov
2026-09-07 8:28 ` Dongli Zhang
2026-09-07 8:26 ` Dongli Zhang
2026-09-07 8:55 ` Michael S. Tsirkin
2026-09-07 21:06 ` Dongli Zhang
2026-09-07 21:16 ` Michael S. Tsirkin
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=aoxYTO8UkzzXvKOc@redhat.com \
--to=berrange@redhat.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=alifm@linux.ibm.com \
--cc=anisinha@redhat.com \
--cc=anthony@xenproject.org \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=borntraeger@linux.ibm.com \
--cc=clg@redhat.com \
--cc=cohuck@redhat.com \
--cc=dave@treblig.org \
--cc=david@kernel.org \
--cc=dongli.zhang@oracle.com \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=imammedo@redhat.com \
--cc=jjherne@linux.ibm.com \
--cc=joe.jin@oracle.com \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.