From patchwork Fri Mar 27 09:20:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Guihua X-Patchwork-Id: 455338 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 05EFD14008F for ; Fri, 27 Mar 2015 20:23:27 +1100 (AEDT) Received: from localhost ([::1]:49040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQU9-00059u-4D for incoming@patchwork.ozlabs.org; Fri, 27 Mar 2015 05:23:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQTg-0004Ir-3A for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:22:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbQTb-0006JD-8Y for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:22:56 -0400 Received: from [59.151.112.132] (port=45087 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQTa-0006Iz-TS for qemu-devel@nongnu.org; Fri, 27 Mar 2015 05:22:51 -0400 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="89766529" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 27 Mar 2015 17:18:56 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t2R9Lbak017828; Fri, 27 Mar 2015 17:21:37 +0800 Received: from G08FNSTD140041.g08.fujitsu.local (10.167.226.252) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 27 Mar 2015 17:22:40 +0800 From: Zhu Guihua To: , , Date: Fri, 27 Mar 2015 17:20:40 +0800 Message-ID: X-Mailer: git-send-email 1.9.3 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.252] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: guz.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, Zhu Guihua , tangchen@cn.fujitsu.com Subject: [Qemu-devel] [PATCH v5 7/7] qmp-event: add event notification for memory hot unplug error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When memory hot unplug fails, this patch adds support to send QMP event to notify mgmt about this failure. 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(-) 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" } } +MEM_HOT_UNPLUG_ERROR +-------------------- +Emitted when memory hot unplug occurs error. + +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" + }, + "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } + NIC_RX_FILTER_CHANGED --------------------- 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, hwaddr addr, uint64_t data, ACPIOSTInfo *info; DeviceState *dev = NULL; HotplugHandler *hotplug_ctrl = NULL; + Error *local_err = NULL; if (!mem_st->dev_count) { return; @@ -148,7 +149,12 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data, dev = DEVICE(mdev->dimm); hotplug_ctrl = 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(local_err), + &error_abort); + } } break; default: diff --git a/monitor.c b/monitor.c index 68873ec..d52ab87 100644 --- a/monitor.c +++ b/monitor.c @@ -587,6 +587,7 @@ static void monitor_qapi_event_init(void) monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_REPORT_BAD, 1000); monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_FAILURE, 1000); monitor_qapi_event_throttle(QAPI_EVENT_VSERPORT_CHANGE, 1000); + monitor_qapi_event_throttle(QAPI_EVENT_MEM_UNPLUG_ERROR, 1000); qmp_event_set_func_emit(monitor_qapi_event_queue); } diff --git a/qapi/event.json b/qapi/event.json index c51dc49..862df67 100644 --- a/qapi/event.json +++ 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. +# +# @device: device name +# +# @msg: Informative message +# +# Since: 2.3 +## +{ 'event': 'MEM_UNPLUG_ERROR', + 'data': { 'device': 'str', 'msg': 'str' } }