From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbVeM-0007U7-Dm for qemu-devel@nongnu.org; Fri, 27 Mar 2015 10:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbVeF-0006z2-3r for qemu-devel@nongnu.org; Fri, 27 Mar 2015 10:54:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbVeE-0006yp-TX for qemu-devel@nongnu.org; Fri, 27 Mar 2015 10:54:11 -0400 Message-ID: <55156F03.8090700@redhat.com> Date: Fri, 27 Mar 2015 08:53:55 -0600 From: Eric Blake MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i4ID8rU96eDeWhHg1CgdagdA9rLJpTbW2" Subject: Re: [Qemu-devel] [PATCH v5 7/7] qmp-event: add event notification for memory hot unplug error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua , qemu-devel@nongnu.org, imammedo@redhat.com, pbonzini@redhat.com Cc: guz.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, tangchen@cn.fujitsu.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --i4ID8rU96eDeWhHg1CgdagdA9rLJpTbW2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/27/2015 03:20 AM, Zhu Guihua wrote: > When memory hot unplug fails, this patch adds support to send > QMP event to notify mgmt about this failure. >=20 > Signed-off-by: Zhu Guihua > --- > docs/qmp/qmp-events.txt | 17 +++++++++++++++++ > hw/acpi/memory_hotplug.c | 8 +++++++- > monitor.c | 1 + > qapi/event.json | 14 ++++++++++++++ > 4 files changed, 39 insertions(+), 1 deletion(-) >=20 > diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt > index d759d19..7a05705 100644 > --- a/docs/qmp/qmp-events.txt > +++ b/docs/qmp/qmp-events.txt > @@ -226,6 +226,23 @@ Example: > { "event": "GUEST_PANICKED", > "data": { "action": "pause" } } > =20 > +MEM_HOT_UNPLUG_ERROR > +-------------------- > +Emitted when memory hot unplug occurs error. s/occurs error/error occurs/ > + > +Data: > + > +- "device": device name (json-string) > +- "msg": Informative message (e.g., reason for the error) (json-string= ) > + > +Example: > + > +{ "event": "MEM_HOT_UNPLUG_ERROR" > + "data": { "device": "dimm1", > + "msg": "acpi: device unplug for not supported device" s/not supported/unsupported/ > + }, > + "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } > + > NIC_RX_FILTER_CHANGED > --------------------- > =20 > diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c > index 2a1b866..f1cef71 100644 > --- a/hw/acpi/memory_hotplug.c > +++ b/hw/acpi/memory_hotplug.c > @@ -94,6 +94,7 @@ static void acpi_memory_hotplug_write(void *opaque, h= waddr addr, uint64_t data, > ACPIOSTInfo *info; > DeviceState *dev =3D NULL; > HotplugHandler *hotplug_ctrl =3D NULL; > + Error *local_err =3D NULL; > =20 > if (!mem_st->dev_count) { > return; > @@ -148,7 +149,12 @@ static void acpi_memory_hotplug_write(void *opaque= , hwaddr addr, uint64_t data, > dev =3D DEVICE(mdev->dimm); > hotplug_ctrl =3D qdev_get_hotplug_handler(dev); > /* call pc-dimm unplug cb */ > - hotplug_handler_unplug(hotplug_ctrl, dev, NULL); > + hotplug_handler_unplug(hotplug_ctrl, dev, &local_err); > + if (local_err) { > + qapi_event_send_mem_unplug_error(dev->id, > + error_get_pretty(loca= l_err), > + &error_abort); > + } > } Does this leak local_err? > +++ b/qapi/event.json > @@ -330,3 +330,17 @@ > ## > { 'event': 'VSERPORT_CHANGE', > 'data': { 'id': 'str', 'open': 'bool' } } > + > +## > +# @MEM_UNPLUG_ERROR > +# > +# Emitted when memory hot unplug occurs error. s/occurs error/error occurs/ > +# > +# @device: device name > +# > +# @msg: Informative message > +# > +# Since: 2.3 You're awfully late for 2.3; this may need to be 2.4. > +## > +{ 'event': 'MEM_UNPLUG_ERROR', > + 'data': { 'device': 'str', 'msg': 'str' } } >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --i4ID8rU96eDeWhHg1CgdagdA9rLJpTbW2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVFW8DAAoJEKeha0olJ0NqY44IAKKphB9o8mgsu13Djz7t5qt9 R4DPcXTcTxMsNruM9weEmpunTXNoINQZO3IZZt7KBd2FNyD56VfE+PhIH/D3a0SR 4CmeLzgfZ7qb2tu5IirJixDwWzqEwL5jICfPKGJUrY5U7b9E55vmkVsDpGPWtp3A /cCmO47Cs13SWc6+bJ5uBZd2ovgithYS/c7qaxhHWZv4ueAhEeyhn6Pum/yCft1q sYn++I3x/81tqROkkm1x807MYyX28tKgLSFlIVJo4dSnSnQLajKYC1o01jm7NnQQ trxfbHmscvjLQDnp3fTqsKj5IgwdeoJdda6+gRcZ7Y5Dz1I9jbu0jDevhnhnCac= =+PNX -----END PGP SIGNATURE----- --i4ID8rU96eDeWhHg1CgdagdA9rLJpTbW2--