From nobody Tue Nov 4 11:53:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504020904906689.4877475559144; Tue, 29 Aug 2017 08:35:04 -0700 (PDT) Received: from localhost ([::1]:45526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmiXd-0004pf-Ht for importer@patchew.org; Tue, 29 Aug 2017 11:35:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmiTU-0001g2-TT for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmiTT-0003mD-0a for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:44 -0400 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:37789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmiTS-0003hs-Nk for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:42 -0400 Received: by mail-wr0-x22a.google.com with SMTP id n37so11244166wrf.4 for ; Tue, 29 Aug 2017 08:30:40 -0700 (PDT) Received: from debian-jessie.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id x7sm1702459wme.34.2017.08.29.08.30.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 08:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gDSaq6VthRxgyooHv+SkE26EeahPcIvdVsc7wE42GpI=; b=dhqqLT74KYDt7O01oQKnkFgdg/3qbIeQ24a3+Z6nbBBZ2xkaCd/VOFmR5oexLNgsqj MRVG1brLVznQ8jb0RHeaE0czXWQbeKhMvGrU0+BC/wTU4X9+3/e6osra5DcFFxjtvQWy nmdgg8zuyaeQhbpMURU8LQLuo1g/jCvwtO34ZjP3/NomOk3bwK8e1y/GsUGtBEX8LxKQ q/CsWyumKjwMFfWwEGq1kv1tsTOgyEJg81id7R89q5f1ZW2oxUI8D09sYIrhKbq7nuCn /xrQYv8Nf4O3ZKFKb1QBJVY68Fkcp4JacD5pO6cC8/r+tt/RORGgQlKHX2KYPFUkaZxJ 6w+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gDSaq6VthRxgyooHv+SkE26EeahPcIvdVsc7wE42GpI=; b=lq3bb6ZEhrMQsgVnC0ZxypvkuKEYJGMittTX8IUd7U+SqrmnP59sXBW3RdDbpsGuq7 9K2S5qyepmyNGqi3X8CzogEZ+Ke71ySF/mPyQsgIamWcfsS5ypcflUOsyavci6mVIwIM ngYJ0yaoo1pKz3U05o3A6jxgt/SXXlpT6PiOJS9NphM7DsRsbevDNr+WXS4ZyYtMPeED hcSRFw2FCGj59XX7S48J3SHvgGrSbfI1z4i3HeSxPa44bJCZAojB4x6v+hyc2bR7Amc3 nRQwcv/dB5aM9f7vjz7PMemZ/M0foZOdNY/0K/iEDuWZ3ntuv5GyvD4OwrmIrW8OKubH unag== X-Gm-Message-State: AHYfb5jiob9c3ityDcIuDljsf2ppp1ZyuLrQkf1O/Casjfqh7uQgshJ6 PZfc3Tl7rQqqS2MK X-Received: by 10.223.145.2 with SMTP id j2mr431837wrj.227.1504020640034; Tue, 29 Aug 2017 08:30:40 -0700 (PDT) From: Vadim Galitsyn To: Eduardo Habkost , David Hildenbrand , "Dr . David Alan Gilbert" , Markus Armbruster , Igor Mammedov , Eric Blake , qemu-devel@nongnu.org Date: Tue, 29 Aug 2017 17:30:20 +0200 Message-Id: <20170829153022.27004-2-vadim.galitsyn@profitbricks.com> X-Mailer: git-send-email 2.13.1.394.g41dd433 In-Reply-To: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> References: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22a Subject: [Qemu-devel] [PATCH v7 1/3] hmp: extend "info numa" with hotplugged memory information 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: Vadim Galitsyn Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Report amount of hotplugged memory in addition to total amount per NUMA node. Signed-off-by: Vadim Galitsyn Cc: Eduardo Habkost Cc: David Hildenbrand Cc: qemu-devel@nongnu.org Reviewed-by: Igor Mammedov --- include/qemu/typedefs.h | 1 + include/sysemu/numa.h | 7 ++++++- monitor.c | 9 ++++++--- numa.c | 18 +++++++++++++----- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 39bc8351a3..163550214c 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -58,6 +58,7 @@ typedef struct MSIMessage MSIMessage; typedef struct NetClientState NetClientState; typedef struct NetFilterState NetFilterState; typedef struct NICInfo NICInfo; +typedef struct NumaNodeMem NumaNodeMem; typedef struct PcGuestInfo PcGuestInfo; typedef struct PCIBridge PCIBridge; typedef struct PCIBus PCIBus; diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index 610eece211..5c6df2820b 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -24,9 +24,14 @@ struct node_info { uint8_t distance[MAX_NODES]; }; =20 +struct NumaNodeMem { + uint64_t node_mem; + uint64_t node_plugged_mem; +}; + extern NodeInfo numa_info[MAX_NODES]; void parse_numa_opts(MachineState *ms); -void query_numa_node_mem(uint64_t node_mem[]); +void query_numa_node_mem(NumaNodeMem node_mem[]); extern QemuOptsList qemu_numa_opts; void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); void numa_unset_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node); diff --git a/monitor.c b/monitor.c index e0f880107f..6c9d183caf 100644 --- a/monitor.c +++ b/monitor.c @@ -1710,11 +1710,12 @@ static void hmp_info_mtree(Monitor *mon, const QDic= t *qdict) static void hmp_info_numa(Monitor *mon, const QDict *qdict) { int i; - uint64_t *node_mem; + NumaNodeMem *node_mem; CpuInfoList *cpu_list, *cpu; =20 cpu_list =3D qmp_query_cpus(&error_abort); - node_mem =3D g_new0(uint64_t, nb_numa_nodes); + node_mem =3D g_new0(NumaNodeMem, nb_numa_nodes); + query_numa_node_mem(node_mem); monitor_printf(mon, "%d nodes\n", nb_numa_nodes); for (i =3D 0; i < nb_numa_nodes; i++) { @@ -1727,7 +1728,9 @@ static void hmp_info_numa(Monitor *mon, const QDict *= qdict) } monitor_printf(mon, "\n"); monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i, - node_mem[i] >> 20); + node_mem[i].node_mem >> 20); + monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i, + node_mem[i].node_plugged_mem >> 20); } qapi_free_CpuInfoList(cpu_list); g_free(node_mem); diff --git a/numa.c b/numa.c index e32af04cd2..fe066ad2f8 100644 --- a/numa.c +++ b/numa.c @@ -591,11 +591,12 @@ void memory_region_allocate_system_memory(MemoryRegio= n *mr, Object *owner, } } =20 -static void numa_stat_memory_devices(uint64_t node_mem[]) +static void numa_stat_memory_devices(NumaNodeMem node_mem[]) { MemoryDeviceInfoList *info_list =3D NULL; MemoryDeviceInfoList **prev =3D &info_list; MemoryDeviceInfoList *info; + PCDIMMDeviceInfo *pcdimm_info; =20 qmp_pc_dimm_device_list(qdev_get_machine(), &prev); for (info =3D info_list; info; info =3D info->next) { @@ -603,9 +604,16 @@ static void numa_stat_memory_devices(uint64_t node_mem= []) =20 if (value) { switch (value->type) { - case MEMORY_DEVICE_INFO_KIND_DIMM: - node_mem[value->u.dimm.data->node] +=3D value->u.dimm.data= ->size; + case MEMORY_DEVICE_INFO_KIND_DIMM: { + pcdimm_info =3D value->u.dimm.data; + node_mem[pcdimm_info->node].node_mem +=3D pcdimm_info->siz= e; + if (pcdimm_info->hotpluggable && pcdimm_info->hotplugged) { + node_mem[pcdimm_info->node].node_plugged_mem +=3D + pcdimm_info->size; + } break; + } + default: break; } @@ -614,7 +622,7 @@ static void numa_stat_memory_devices(uint64_t node_mem[= ]) qapi_free_MemoryDeviceInfoList(info_list); } =20 -void query_numa_node_mem(uint64_t node_mem[]) +void query_numa_node_mem(NumaNodeMem node_mem[]) { int i; =20 @@ -624,7 +632,7 @@ void query_numa_node_mem(uint64_t node_mem[]) =20 numa_stat_memory_devices(node_mem); for (i =3D 0; i < nb_numa_nodes; i++) { - node_mem[i] +=3D numa_info[i].node_mem; + node_mem[i].node_mem +=3D numa_info[i].node_mem; } } =20 --=20 2.13.1.394.g41dd433 From nobody Tue Nov 4 11:53:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504021118300286.7414701070138; Tue, 29 Aug 2017 08:38:38 -0700 (PDT) Received: from localhost ([::1]:45551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmib6-00082b-7L for importer@patchew.org; Tue, 29 Aug 2017 11:38:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmiTU-0001g1-Sl for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmiTS-0003ls-Te for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:44 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:34544) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmiTS-0003jo-6C for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:42 -0400 Received: by mail-wm0-x22e.google.com with SMTP id f13so20764685wme.1 for ; Tue, 29 Aug 2017 08:30:42 -0700 (PDT) Received: from debian-jessie.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id x7sm1702459wme.34.2017.08.29.08.30.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 08:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rmup1Ba50jVanzfChDI7GeLqywjrNvgF0h9KyJ+eny8=; b=hWT2q8QSju3Q5v4H6fxrqk8633HPxEQ+H2AoXXdkGqeMpfmT7V8xRqn8ZLDRrd/WEL RwdruET8BclZQWy6ZZ2CXz99qOJhhZghuN0TYvh0r+P3mVEi3xHBPFmMiTjl7bHWO1Md H7FmXuqDyJval2LUoiUDRTXIG8wJSd6KGAh+QlL1XdfjGAfrMr0LNGq3hnQV7J62wb4F b9qheboPL3DBdbegfn7rDAcVldjG3cdiFe2pEzsELELQIGu62GYsxVc8NKVVC9FboqSd tPnlI9ZSxI91LENjLkdkIqmrZDTMoNHnfKtzMNOWcyV4PVhuM+OMoQXAjSH0rV3FQU3V DxDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rmup1Ba50jVanzfChDI7GeLqywjrNvgF0h9KyJ+eny8=; b=OWrzOBpQW7HPF0YkFdfP/pK2aWA0INuAl0bxZW8arCKwPNRMjuQNbNqbb7B6HYWwWj p3gOuEvoqrGzYZFTM/Zlyy+D/fyz2CVEfNHBKynsCPzYYCUxtfUIAVdYvrki8Fzw8YsW wPDKcXlNyOItdYlzg4ruZwrSK0yqOadYgcq+6tfV8XCc81XGkzU+nm2aHD8GOS6CSIJa MZhUNm+QE+CkR4toC6NcAcLaHyJMhIAk9/k2augP5CSMbZJcAA9QF8sSEX6yNHLzCdXJ KaR7ik6nuTYBj2QNesPpMp2X0k/VtLrCgHwcruFRXe13J1CxmArXEnv7+Q6fwxbpq6Sg 6A6A== X-Gm-Message-State: AHYfb5gdp/wbPsCU2oDOqy8SGZnPb55ttfk/OlMANiR9z/uBn0TzMpKn kia2N6xsSMkA+g6W X-Received: by 10.28.5.135 with SMTP id 129mr69299wmf.110.1504020641136; Tue, 29 Aug 2017 08:30:41 -0700 (PDT) From: Vadim Galitsyn To: Eduardo Habkost , David Hildenbrand , "Dr . David Alan Gilbert" , Markus Armbruster , Igor Mammedov , Eric Blake , qemu-devel@nongnu.org Date: Tue, 29 Aug 2017 17:30:21 +0200 Message-Id: <20170829153022.27004-3-vadim.galitsyn@profitbricks.com> X-Mailer: git-send-email 2.13.1.394.g41dd433 In-Reply-To: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> References: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22e Subject: [Qemu-devel] [PATCH v7 2/3] qmp: introduce query-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: Vasilis Liaskovitis , Mohammed Gamal , Eduardo Otubo , Vadim Galitsyn Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a new query-memory-size-summary command which 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 Reviewed-by: Igor Mammedov --- qapi-schema.json | 32 ++++++++++++++++++= ++++ include/hw/mem/pc-dimm.h | 1 + hw/mem/pc-dimm.c | 5 ++++ qmp.c | 13 +++++++++ stubs/{qmp_pc_dimm_device_list.c =3D> qmp_pc_dimm.c} | 5 ++++ stubs/Makefile.objs | 2 +- 6 files changed, 57 insertions(+), 1 deletion(-) rename stubs/{qmp_pc_dimm_device_list.c =3D> qmp_pc_dimm.c} (68%) diff --git a/qapi-schema.json b/qapi-schema.json index 802ea53d00..9402ac3b3a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4407,6 +4407,38 @@ 'data': { 'name': 'str', '*migration-safe': 'bool', 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str' } } =20 +## +# @MemoryInfo: +# +# Actual memory information in bytes. +# +# @base-memory: size of "base" memory specified with command line +# option -m. +# +# @plugged-memory: size memory that can be hot-unplugged. This field +# is omitted if target does support memory hotplug +# (i.e. CONFIG_MEM_HOTPLUG not defined on build time). +# +# Since: 2.11.0 +## +{ 'struct': 'MemoryInfo', + 'data' : { 'base-memory': 'size', '*plugged-memory': 'size' } } + +## +# @query-memory-size-summary: +# +# Return the amount of initially allocated and hot-plugged (if +# enabled) memory in bytes. +# +# Example: +# +# -> { "execute": "query-memory-size-summary" } +# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } } +# +# Since: 2.11.0 +## +{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' } + ## # @query-cpu-definitions: # diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index 6f8c3eb1b3..d83b957829 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -95,6 +95,7 @@ int pc_dimm_get_free_slot(const int *hint, int max_slots,= Error **errp); =20 int qmp_pc_dimm_device_list(Object *obj, void *opaque); uint64_t pc_existing_dimms_capacity(Error **errp); +uint64_t get_plugged_memory_size(void); void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms, MemoryRegion *mr, uint64_t align, Error **errp); void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms, diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index bdf6649083..66eace5a5c 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -159,6 +159,11 @@ uint64_t pc_existing_dimms_capacity(Error **errp) return cap.size; } =20 +uint64_t get_plugged_memory_size(void) +{ + return pc_existing_dimms_capacity(&error_abort); +} + int qmp_pc_dimm_device_list(Object *obj, void *opaque) { MemoryDeviceInfoList ***prev =3D opaque; diff --git a/qmp.c b/qmp.c index b86201e349..e8c303116a 100644 --- a/qmp.c +++ b/qmp.c @@ -709,3 +709,16 @@ ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **er= rp) =20 return head; } + +MemoryInfo *qmp_query_memory_size_summary(Error **errp) +{ + MemoryInfo *mem_info =3D g_malloc0(sizeof(MemoryInfo)); + + mem_info->base_memory =3D ram_size; + + mem_info->plugged_memory =3D get_plugged_memory_size(); + mem_info->has_plugged_memory =3D + mem_info->plugged_memory !=3D (uint64_t)-1; + + return mem_info; +} diff --git a/stubs/qmp_pc_dimm_device_list.c b/stubs/qmp_pc_dimm.c similarity index 68% rename from stubs/qmp_pc_dimm_device_list.c rename to stubs/qmp_pc_dimm.c index def211564d..9ddc4f619a 100644 --- a/stubs/qmp_pc_dimm_device_list.c +++ b/stubs/qmp_pc_dimm.c @@ -6,3 +6,8 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) { return 0; } + +uint64_t get_plugged_memory_size(void) +{ + return (uint64_t)-1; +} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index e69c217aff..f5f139f310 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -33,7 +33,7 @@ stub-obj-y +=3D uuid.o stub-obj-y +=3D vm-stop.o stub-obj-y +=3D vmstate.o stub-obj-$(CONFIG_WIN32) +=3D fd-register.o -stub-obj-y +=3D qmp_pc_dimm_device_list.o +stub-obj-y +=3D qmp_pc_dimm.o stub-obj-y +=3D target-monitor-defs.o stub-obj-y +=3D target-get-monitor-def.o stub-obj-y +=3D pc_madt_cpu_entry.o --=20 2.13.1.394.g41dd433 From nobody Tue Nov 4 11:53:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504020740813145.30202870365906; Tue, 29 Aug 2017 08:32:20 -0700 (PDT) Received: from localhost ([::1]:45515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmiV0-0002nD-PS for importer@patchew.org; Tue, 29 Aug 2017 11:32:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmiTV-0001gJ-7u for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmiTT-0003nS-N8 for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:45 -0400 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:35373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmiTT-0003m0-Ga for qemu-devel@nongnu.org; Tue, 29 Aug 2017 11:30:43 -0400 Received: by mail-wr0-x22a.google.com with SMTP id j29so10400608wre.2 for ; Tue, 29 Aug 2017 08:30:43 -0700 (PDT) Received: from debian-jessie.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id x7sm1702459wme.34.2017.08.29.08.30.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 08:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RELzZxvu+LBQSggUH+W4jKAIiwQ0nsyo62XUGJR3xvI=; b=qMZHsm3dM1vBsklEK44iBgkqOZRXkeDNCIokRlBIjWDANZntb1xKRaeQUb1ovrApKx 0VPzCWTTbFjb8Rr1mox7vh1FoQXyOamKo2XWKSBKW7eIue4AXpsHU90IvbJlOawr9ZuL KIICrZ14dr6xJaSkht4/MR7JRbFZf9irPt2x+gagawFWgeoNBal0X49TxKPYsJXdgo4s hS0tf23wxD1nwTdaPKz5zqNgu8nwT7/0S/SAJsGD8MF/u915UJvffK1C2dP7fwmr9pfQ d9Bt8DPXW10POWpPelGgsUDOZVtXReH+qNTWeOxr8hQzxwaHG4v+2m3qP/H0VhdFCM+r jYSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RELzZxvu+LBQSggUH+W4jKAIiwQ0nsyo62XUGJR3xvI=; b=UHGIYZDBG02Nv4veRU+JbITxRSd5yzaSr1On7bB7k2H+Q2F1cLnVYcCc++mi4yCoQU WAzbDHE+aaNBiSg020JydJi4UHSv/skKrJ0rRbkWSIaChWF7iuwZm41BWRDdS4giFkCp vTvVfcwLaeMfBPTUatTrFhSqCkiFDA9cmLe3qf22obHKyImdG3ubkYr0g8KmBK+TYE/d qKLQUok7MvQavF5Z7vo2Nf50FqTNs8M0pqLKyrJZ7pDmxAxFUyXayXh7Bf5eNHQ5IK9d 6DQl2mZUSarSQPy05PgNZx+zzv6kdiAMwLdfzuKtniMxHB7H5cO3bGxYgJ6wTPIBDve8 Bk9A== X-Gm-Message-State: AHYfb5i9loua/cG7xxiZ74fx/OeOprdDW6rccTUIVXfdlcjz7XTmm1fR zCBFERGqEyk5Mmfs X-Received: by 10.223.160.3 with SMTP id k3mr448719wrk.198.1504020642492; Tue, 29 Aug 2017 08:30:42 -0700 (PDT) From: Vadim Galitsyn To: Eduardo Habkost , David Hildenbrand , "Dr . David Alan Gilbert" , Markus Armbruster , Igor Mammedov , Eric Blake , qemu-devel@nongnu.org Date: Tue, 29 Aug 2017 17:30:22 +0200 Message-Id: <20170829153022.27004-4-vadim.galitsyn@profitbricks.com> X-Mailer: git-send-email 2.13.1.394.g41dd433 In-Reply-To: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> References: <20170829153022.27004-1-vadim.galitsyn@profitbricks.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22a Subject: [Qemu-devel] [PATCH v7 3/3] 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: Vasilis Liaskovitis , Mohammed Gamal , Eduardo Otubo , Vadim Galitsyn Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Igor Mammedov --- hmp.h | 1 + hmp.c | 18 ++++++++++++++++++ hmp-commands-info.hx | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) 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); =20 #endif diff --git a/hmp.c b/hmp.c index fd80dce758..b718dab4df 100644 --- a/hmp.c +++ b/hmp.c @@ -2868,3 +2868,21 @@ void hmp_info_vm_generation_id(Monitor *mon, const Q= Dict *qdict) hmp_handle_error(mon, &err); qapi_free_GuidInfo(info); } + +void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + MemoryInfo *info =3D 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-commands-info.hx b/hmp-commands-info.hx index d9df238a5f..04c9db81f6 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -849,6 +849,22 @@ ETEXI .cmd =3D hmp_info_vm_generation_id, }, =20 +STEXI +@item info memory_size_summary +@findex memory_size_summary +Display the amount of initially allocated and hot-plugged (if +enabled) memory in bytes. +ETEXI + + { + .name =3D "memory_size_summary", + .args_type =3D "", + .params =3D "", + .help =3D "show the amount of initially allocated and " + "hot-plugged (if enabled) memory in bytes.", + .cmd =3D hmp_info_memory_size_summary, + }, + STEXI @end table ETEXI --=20 2.13.1.394.g41dd433