[PATCH 1/2] hw/acpi: Remove the deprecated QAPI MEM_UNPLUG_ERROR event

Philippe Mathieu-Daudé posted 2 patches 5 months, 4 weeks ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Mads Ynddal <mads@ynddal.dk>
[PATCH 1/2] hw/acpi: Remove the deprecated QAPI MEM_UNPLUG_ERROR event
Posted by Philippe Mathieu-Daudé 5 months, 4 weeks ago
The MEM_UNPLUG_ERROR event is deprecated since commit d43f1670c7
("qapi/qdev.json: add DEVICE_UNPLUG_GUEST_ERROR QAPI event"),
time to remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 docs/about/deprecated.rst       |  5 -----
 docs/about/removed-features.rst |  9 +++++++++
 qapi/machine.json               | 28 ----------------------------
 hw/acpi/memory_hotplug.c        |  8 --------
 hw/ppc/spapr.c                  | 11 +----------
 5 files changed, 10 insertions(+), 51 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 40585ca7d5..4a61894db6 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -151,11 +151,6 @@ property types.
 QEMU Machine Protocol (QMP) events
 ----------------------------------
 
-``MEM_UNPLUG_ERROR`` (since 6.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead.
-
 ``vcpu`` trace events (since 8.1)
 '''''''''''''''''''''''''''''''''
 
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index fba0cfb0b0..f1e70263e2 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -671,6 +671,15 @@ Use ``multifd-channels`` instead.
 
 Use ``multifd-compression`` instead.
 
+QEMU Machine Protocol (QMP) events
+----------------------------------
+
+``MEM_UNPLUG_ERROR`` (removed in 9.1)
+'''''''''''''''''''''''''''''''''''''
+
+MEM_UNPLUG_ERROR has been replaced by the more generic ``DEVICE_UNPLUG_GUEST_ERROR`` event.
+
+
 Human Monitor Protocol (HMP) commands
 -------------------------------------
 
diff --git a/qapi/machine.json b/qapi/machine.json
index bce6e1bbc4..453feb9347 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1607,34 +1607,6 @@
 { 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
   'data': { '*id': 'str', 'size': 'size', 'qom-path' : 'str'} }
 
-##
-# @MEM_UNPLUG_ERROR:
-#
-# Emitted when memory hot unplug error occurs.
-#
-# @device: device name
-#
-# @msg: Informative message
-#
-# Features:
-#
-# @deprecated: This event is deprecated.  Use
-#     @DEVICE_UNPLUG_GUEST_ERROR instead.
-#
-# Since: 2.4
-#
-# Example:
-#
-#     <- { "event": "MEM_UNPLUG_ERROR",
-#          "data": { "device": "dimm1",
-#                    "msg": "acpi: device unplug for unsupported device"
-#          },
-#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
-##
-{ 'event': 'MEM_UNPLUG_ERROR',
-  'data': { 'device': 'str', 'msg': 'str' },
-  'features': ['deprecated'] }
-
 ##
 # @BootConfiguration:
 #
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index de6f974ebb..9b974b7274 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -178,14 +178,6 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
             hotplug_handler_unplug(hotplug_ctrl, dev, &local_err);
             if (local_err) {
                 trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector);
-
-                /*
-                 * Send both MEM_UNPLUG_ERROR and DEVICE_UNPLUG_GUEST_ERROR
-                 * while the deprecation of MEM_UNPLUG_ERROR is
-                 * pending.
-                 */
-                qapi_event_send_mem_unplug_error(dev->id ? : "",
-                                                 error_get_pretty(local_err));
                 qapi_event_send_device_unplug_guest_error(dev->id,
                                                           dev->canonical_path);
                 error_free(local_err);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 4345764bce..81a187f126 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3786,7 +3786,6 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev)
     SpaprDrc *drc;
     uint32_t nr_lmbs;
     uint64_t size, addr_start, addr;
-    g_autofree char *qapi_error = NULL;
     int i;
 
     if (!dev) {
@@ -3823,16 +3822,8 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev)
 
     /*
      * Tell QAPI that something happened and the memory
-     * hotunplug wasn't successful. Keep sending
-     * MEM_UNPLUG_ERROR even while sending
-     * DEVICE_UNPLUG_GUEST_ERROR until the deprecation of
-     * MEM_UNPLUG_ERROR is due.
+     * hotunplug wasn't successful.
      */
-    qapi_error = g_strdup_printf("Memory hotunplug rejected by the guest "
-                                 "for device %s", dev->id);
-
-    qapi_event_send_mem_unplug_error(dev->id ? : "", qapi_error);
-
     qapi_event_send_device_unplug_guest_error(dev->id,
                                               dev->canonical_path);
 }
-- 
2.41.0


Re: [PATCH 1/2] hw/acpi: Remove the deprecated QAPI MEM_UNPLUG_ERROR event
Posted by Harsh Prateek Bora 5 months, 4 weeks ago

On 5/30/24 12:45, Philippe Mathieu-Daudé wrote:
> The MEM_UNPLUG_ERROR event is deprecated since commit d43f1670c7
> ("qapi/qdev.json: add DEVICE_UNPLUG_GUEST_ERROR QAPI event"),
> time to remove it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   docs/about/deprecated.rst       |  5 -----
>   docs/about/removed-features.rst |  9 +++++++++
>   qapi/machine.json               | 28 ----------------------------
>   hw/acpi/memory_hotplug.c        |  8 --------
>   hw/ppc/spapr.c                  | 11 +----------
>   5 files changed, 10 insertions(+), 51 deletions(-)
> 

For spapr:
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> index 40585ca7d5..4a61894db6 100644
> --- a/docs/about/deprecated.rst
> +++ b/docs/about/deprecated.rst
> @@ -151,11 +151,6 @@ property types.
>   QEMU Machine Protocol (QMP) events
>   ----------------------------------
>   
> -``MEM_UNPLUG_ERROR`` (since 6.2)
> -''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> -
> -Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead.
> -
>   ``vcpu`` trace events (since 8.1)
>   '''''''''''''''''''''''''''''''''
>   
> diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
> index fba0cfb0b0..f1e70263e2 100644
> --- a/docs/about/removed-features.rst
> +++ b/docs/about/removed-features.rst
> @@ -671,6 +671,15 @@ Use ``multifd-channels`` instead.
>   
>   Use ``multifd-compression`` instead.
>   
> +QEMU Machine Protocol (QMP) events
> +----------------------------------
> +
> +``MEM_UNPLUG_ERROR`` (removed in 9.1)
> +'''''''''''''''''''''''''''''''''''''
> +
> +MEM_UNPLUG_ERROR has been replaced by the more generic ``DEVICE_UNPLUG_GUEST_ERROR`` event.
> +
> +
>   Human Monitor Protocol (HMP) commands
>   -------------------------------------
>   
> diff --git a/qapi/machine.json b/qapi/machine.json
> index bce6e1bbc4..453feb9347 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -1607,34 +1607,6 @@
>   { 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
>     'data': { '*id': 'str', 'size': 'size', 'qom-path' : 'str'} }
>   
> -##
> -# @MEM_UNPLUG_ERROR:
> -#
> -# Emitted when memory hot unplug error occurs.
> -#
> -# @device: device name
> -#
> -# @msg: Informative message
> -#
> -# Features:
> -#
> -# @deprecated: This event is deprecated.  Use
> -#     @DEVICE_UNPLUG_GUEST_ERROR instead.
> -#
> -# Since: 2.4
> -#
> -# Example:
> -#
> -#     <- { "event": "MEM_UNPLUG_ERROR",
> -#          "data": { "device": "dimm1",
> -#                    "msg": "acpi: device unplug for unsupported device"
> -#          },
> -#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
> -##
> -{ 'event': 'MEM_UNPLUG_ERROR',
> -  'data': { 'device': 'str', 'msg': 'str' },
> -  'features': ['deprecated'] }
> -
>   ##
>   # @BootConfiguration:
>   #
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index de6f974ebb..9b974b7274 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -178,14 +178,6 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
>               hotplug_handler_unplug(hotplug_ctrl, dev, &local_err);
>               if (local_err) {
>                   trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector);
> -
> -                /*
> -                 * Send both MEM_UNPLUG_ERROR and DEVICE_UNPLUG_GUEST_ERROR
> -                 * while the deprecation of MEM_UNPLUG_ERROR is
> -                 * pending.
> -                 */
> -                qapi_event_send_mem_unplug_error(dev->id ? : "",
> -                                                 error_get_pretty(local_err));
>                   qapi_event_send_device_unplug_guest_error(dev->id,
>                                                             dev->canonical_path);
>                   error_free(local_err);
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 4345764bce..81a187f126 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3786,7 +3786,6 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev)
>       SpaprDrc *drc;
>       uint32_t nr_lmbs;
>       uint64_t size, addr_start, addr;
> -    g_autofree char *qapi_error = NULL;
>       int i;
>   
>       if (!dev) {
> @@ -3823,16 +3822,8 @@ void spapr_memory_unplug_rollback(SpaprMachineState *spapr, DeviceState *dev)
>   
>       /*
>        * Tell QAPI that something happened and the memory
> -     * hotunplug wasn't successful. Keep sending
> -     * MEM_UNPLUG_ERROR even while sending
> -     * DEVICE_UNPLUG_GUEST_ERROR until the deprecation of
> -     * MEM_UNPLUG_ERROR is due.
> +     * hotunplug wasn't successful.
>        */
> -    qapi_error = g_strdup_printf("Memory hotunplug rejected by the guest "
> -                                 "for device %s", dev->id);
> -
> -    qapi_event_send_mem_unplug_error(dev->id ? : "", qapi_error);
> -
>       qapi_event_send_device_unplug_guest_error(dev->id,
>                                                 dev->canonical_path);
>   }