From patchwork Thu Sep 14 15:04:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 813881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xtMPn0hqGz9sP1 for ; Fri, 15 Sep 2017 01:09:17 +1000 (AEST) Received: from localhost ([::1]:48327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsVlT-0001cY-4A for incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 11:09:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsViI-0007Px-6h for qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:05:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsViH-00032Z-3k for qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:05:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dsViG-000311-Rc for qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:05:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB3B8329E; Thu, 14 Sep 2017 15:05:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EB3B8329E Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58B9117DFF; Thu, 14 Sep 2017 15:05:51 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, lvivier@redhat.com, cohuck@redhat.com, vadim.galitsyn@profitbricks.com Date: Thu, 14 Sep 2017 16:04:47 +0100 Message-Id: <20170914150447.19352-8-dgilbert@redhat.com> In-Reply-To: <20170914150447.19352-1-dgilbert@redhat.com> References: <20170914150447.19352-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 14 Sep 2017 15:05:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 7/7] hmp: introduce 'info memory_size_summary' command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, thuth@redhat.com, groug@kaod.org, peterx@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vadim Galitsyn Add 'info memory_size_summary' command which is a sibling of QMP command query-memory-size-summary. It provides the following memory information in bytes: * base-memory - size of "base" memory specified with command line option -m. * plugged-memory - amount of memory that was hot-plugged. If target does not have CONFIG_MEM_HOTPLUG enabled, no value is reported. Signed-off-by: Vasilis Liaskovitis Signed-off-by: Mohammed Gamal Signed-off-by: Eduardo Otubo Signed-off-by: Vadim Galitsyn Reviewed-by: Eugene Crosser Cc: Dr. David Alan Gilbert Cc: Markus Armbruster Cc: Igor Mammedov Cc: Eric Blake Cc: qemu-devel@nongnu.org Message-Id: <20170829153022.27004-4-vadim.galitsyn@profitbricks.com> Reviewed-by: Igor Mammedov Signed-off-by: Dr. David Alan Gilbert Fixed up comments from Igor's review --- hmp-commands-info.hx | 16 ++++++++++++++++ hmp.c | 18 ++++++++++++++++++ hmp.h | 1 + 3 files changed, 35 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 4ab7fcee98..1c6772597d 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -851,6 +851,22 @@ ETEXI }, STEXI +@item info memory_size_summary +@findex memory_size_summary +Display the amount of initially allocated and present hotpluggable (if +enabled) memory in bytes. +ETEXI + + { + .name = "memory_size_summary", + .args_type = "", + .params = "", + .help = "show the amount of initially allocated and " + "present hotpluggable (if enabled) memory in bytes.", + .cmd = hmp_info_memory_size_summary, + }, + +STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index cd046c6d71..0fb2bc7043 100644 --- a/hmp.c +++ b/hmp.c @@ -2862,3 +2862,21 @@ void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); qapi_free_GuidInfo(info); } + +void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + MemoryInfo *info = qmp_query_memory_size_summary(&err); + if (info) { + monitor_printf(mon, "base memory: %" PRIu64 "\n", + info->base_memory); + + if (info->has_plugged_memory) { + monitor_printf(mon, "plugged memory: %" PRIu64 "\n", + info->plugged_memory); + } + + qapi_free_MemoryInfo(info); + } + hmp_handle_error(mon, &err); +} diff --git a/hmp.h b/hmp.h index 1ff455295e..3605003e4c 100644 --- a/hmp.h +++ b/hmp.h @@ -145,5 +145,6 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict); void hmp_info_ramblock(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); +void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); #endif