From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Cc: avi@redhat.com, anthony@codemonkey.ws, gleb@redhat.com, imammedo@redhat.com, kevin@koconnor.net, wency@cn.fujitsu.com, Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Subject: [RFC PATCH v2 19/21] Implement "info memtotal" and "query-memtotal" Date: Wed, 11 Jul 2012 12:32:04 +0200 [thread overview] Message-ID: <1342002726-18258-20-git-send-email-vasilis.liaskovitis@profitbricks.com> (raw) In-Reply-To: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Returns total memory of guest in bytes, including hotplugged memory. Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> --- hmp-commands.hx | 2 ++ hmp.c | 7 +++++++ hmp.h | 1 + hw/dimm.c | 15 +++++++++++++++ monitor.c | 7 +++++++ qapi-schema.json | 12 ++++++++++++ qmp-commands.hx | 20 ++++++++++++++++++++ 7 files changed, 64 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 3172cde..016062e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1461,6 +1461,8 @@ show qdev device model list show roms @item info memhp show memhp +@item info memtotal +show memtotal @end table ETEXI diff --git a/hmp.c b/hmp.c index ec25d9a..8f89c7d 100644 --- a/hmp.c +++ b/hmp.c @@ -1017,3 +1017,10 @@ void hmp_info_memhp(Monitor *mon) qapi_free_MemHpInfoList(info); } + +void hmp_info_memtotal(Monitor *mon) +{ + uint64_t ram_total; + ram_total = (uint64_t)qmp_query_memtotal(NULL); + monitor_printf(mon, "MemTotal: %lu \n", ram_total); +} diff --git a/hmp.h b/hmp.h index 971e7c4..d6e715e 100644 --- a/hmp.h +++ b/hmp.h @@ -65,5 +65,6 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict); void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); void hmp_info_memhp(Monitor *mon); +void hmp_info_memtotal(Monitor *mon); #endif diff --git a/hw/dimm.c b/hw/dimm.c index 6e324d3..b544173 100644 --- a/hw/dimm.c +++ b/hw/dimm.c @@ -28,6 +28,7 @@ static dimm_hotplug_fn dimm_hotplug; static dimm_hotplug_fn dimm_revert; static QTAILQ_HEAD(Dimmlist, DimmState) dimmlist; static QTAILQ_HEAD(dimm_hp_result_head, dimm_hp_result) dimm_hp_result_queue; +extern ram_addr_t ram_size; static Property dimm_properties[] = { DEFINE_PROP_END_OF_LIST() @@ -292,6 +293,20 @@ MemHpInfoList *qmp_query_memhp(Error **errp) return head; } + +int64_t qmp_query_memtotal(Error **errp) +{ + DimmState *slot; + uint64_t info = ram_size; + + QTAILQ_FOREACH(slot, &dimmlist, nextdimm) { + if (slot->populated) { + info += slot->size; + } + } + return (int64_t)info; +} + static int dimm_init(SysBusDevice *s) { DimmState *slot; diff --git a/monitor.c b/monitor.c index 4a14e26..1dd646c 100644 --- a/monitor.c +++ b/monitor.c @@ -2739,6 +2739,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.info = hmp_info_memhp, }, { + .name = "memtotal", + .args_type = "", + .params = "", + .help = "show total memory size", + .mhandler.info = hmp_info_memtotal, + }, + { .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 049f6f9..5bbf2c0 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1888,3 +1888,15 @@ # Since: 1.1.3 ## { 'command': 'query-memhp', 'returns': ['MemHpInfo'] } + +## +# @query-memtotal: +# +# Returns total memory in bytes, including hotplugged dimms +# +# Returns: a l +# +# Since: 1.2 +## +{ 'command': 'query-memtotal', 'returns': 'int' } + diff --git a/qmp-commands.hx b/qmp-commands.hx index cd1d5f0..6c71696 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2286,3 +2286,23 @@ Example: } EQMP + + { + .name = "query-memtotal", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_query_memtotal + }, +SQMP +query-memtotal +---------- + +Return total memory in bytes, including hotplugged dimms + +Example: + +-> { "execute": "query-memtotal" } +<- { + "return": 1073741824 + } + +EQMP -- 1.7.9
WARNING: multiple messages have this Message-ID (diff)
From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Cc: gleb@redhat.com, Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com Subject: [Qemu-devel] [RFC PATCH v2 19/21] Implement "info memtotal" and "query-memtotal" Date: Wed, 11 Jul 2012 12:32:04 +0200 [thread overview] Message-ID: <1342002726-18258-20-git-send-email-vasilis.liaskovitis@profitbricks.com> (raw) In-Reply-To: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Returns total memory of guest in bytes, including hotplugged memory. Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> --- hmp-commands.hx | 2 ++ hmp.c | 7 +++++++ hmp.h | 1 + hw/dimm.c | 15 +++++++++++++++ monitor.c | 7 +++++++ qapi-schema.json | 12 ++++++++++++ qmp-commands.hx | 20 ++++++++++++++++++++ 7 files changed, 64 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 3172cde..016062e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1461,6 +1461,8 @@ show qdev device model list show roms @item info memhp show memhp +@item info memtotal +show memtotal @end table ETEXI diff --git a/hmp.c b/hmp.c index ec25d9a..8f89c7d 100644 --- a/hmp.c +++ b/hmp.c @@ -1017,3 +1017,10 @@ void hmp_info_memhp(Monitor *mon) qapi_free_MemHpInfoList(info); } + +void hmp_info_memtotal(Monitor *mon) +{ + uint64_t ram_total; + ram_total = (uint64_t)qmp_query_memtotal(NULL); + monitor_printf(mon, "MemTotal: %lu \n", ram_total); +} diff --git a/hmp.h b/hmp.h index 971e7c4..d6e715e 100644 --- a/hmp.h +++ b/hmp.h @@ -65,5 +65,6 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict); void hmp_netdev_add(Monitor *mon, const QDict *qdict); void hmp_netdev_del(Monitor *mon, const QDict *qdict); void hmp_info_memhp(Monitor *mon); +void hmp_info_memtotal(Monitor *mon); #endif diff --git a/hw/dimm.c b/hw/dimm.c index 6e324d3..b544173 100644 --- a/hw/dimm.c +++ b/hw/dimm.c @@ -28,6 +28,7 @@ static dimm_hotplug_fn dimm_hotplug; static dimm_hotplug_fn dimm_revert; static QTAILQ_HEAD(Dimmlist, DimmState) dimmlist; static QTAILQ_HEAD(dimm_hp_result_head, dimm_hp_result) dimm_hp_result_queue; +extern ram_addr_t ram_size; static Property dimm_properties[] = { DEFINE_PROP_END_OF_LIST() @@ -292,6 +293,20 @@ MemHpInfoList *qmp_query_memhp(Error **errp) return head; } + +int64_t qmp_query_memtotal(Error **errp) +{ + DimmState *slot; + uint64_t info = ram_size; + + QTAILQ_FOREACH(slot, &dimmlist, nextdimm) { + if (slot->populated) { + info += slot->size; + } + } + return (int64_t)info; +} + static int dimm_init(SysBusDevice *s) { DimmState *slot; diff --git a/monitor.c b/monitor.c index 4a14e26..1dd646c 100644 --- a/monitor.c +++ b/monitor.c @@ -2739,6 +2739,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.info = hmp_info_memhp, }, { + .name = "memtotal", + .args_type = "", + .params = "", + .help = "show total memory size", + .mhandler.info = hmp_info_memtotal, + }, + { .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 049f6f9..5bbf2c0 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1888,3 +1888,15 @@ # Since: 1.1.3 ## { 'command': 'query-memhp', 'returns': ['MemHpInfo'] } + +## +# @query-memtotal: +# +# Returns total memory in bytes, including hotplugged dimms +# +# Returns: a l +# +# Since: 1.2 +## +{ 'command': 'query-memtotal', 'returns': 'int' } + diff --git a/qmp-commands.hx b/qmp-commands.hx index cd1d5f0..6c71696 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2286,3 +2286,23 @@ Example: } EQMP + + { + .name = "query-memtotal", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_query_memtotal + }, +SQMP +query-memtotal +---------- + +Return total memory in bytes, including hotplugged dimms + +Example: + +-> { "execute": "query-memtotal" } +<- { + "return": 1073741824 + } + +EQMP -- 1.7.9
next prev parent reply other threads:[~2012-07-11 10:32 UTC|newest] Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-11 10:31 [RFC PATCH v2 00/21] ACPI memory hotplug Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 01/21][SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 02/21][SeaBIOS] Add SSDT memory device support Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 03/21][SeaBIOS] acpi-dsdt: Implement functions for memory hotplug Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-17 7:23 ` Wen Congyang 2012-07-17 7:23 ` [Qemu-devel] " Wen Congyang 2012-07-20 8:48 ` Vasilis Liaskovitis 2012-07-20 8:48 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 04/21][SeaBIOS] acpi: generate hotplug memory devices Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:48 ` Wen Congyang 2012-07-11 10:48 ` [Qemu-devel] " Wen Congyang 2012-07-11 16:39 ` Vasilis Liaskovitis 2012-07-11 16:39 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 05/21][SeaBIOS] pciinit: Fix pcimem_start value Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 11:56 ` Gerd Hoffmann 2012-07-11 11:56 ` [Qemu-devel] " Gerd Hoffmann 2012-07-11 16:45 ` Vasilis Liaskovitis 2012-07-11 16:45 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-12 7:22 ` Gerd Hoffmann 2012-07-12 7:22 ` [Qemu-devel] " Gerd Hoffmann 2012-07-12 9:09 ` Vasilis Liaskovitis 2012-07-12 9:09 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 06/21] dimm: Implement memory device abstraction Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-12 19:55 ` Blue Swirl 2012-07-12 19:55 ` [Qemu-devel] " Blue Swirl 2012-07-13 17:39 ` Vasilis Liaskovitis 2012-07-13 17:39 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 07/21] acpi_piix4: Implement memory device hotplug registers Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 08/21] pc: calculate dimm physical addresses and adjust memory map Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 09/21] pc: Add dimm paravirt SRAT info Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-12 19:48 ` Blue Swirl 2012-07-12 19:48 ` [Qemu-devel] " Blue Swirl 2012-07-13 17:40 ` Vasilis Liaskovitis 2012-07-13 17:40 ` Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 10/21] Implement "-dimm" command line option Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 11/21] Implement dimm_add and dimm_del hmp/qmp commands Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 12/21] fix live-migration when "populated=on" is missing Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 13/21] Implement memory hotplug notification lists Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 14:59 ` Eric Blake 2012-07-11 14:59 ` Eric Blake 2012-07-11 16:47 ` Vasilis Liaskovitis 2012-07-11 16:47 ` Vasilis Liaskovitis 2012-07-11 10:31 ` [RFC PATCH v2 14/21][SeaBIOS] acpi_dsdt: Support _OST dimm method Vasilis Liaskovitis 2012-07-11 10:31 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 15/21] acpi_piix4: _OST dimm support Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 16/21] acpi_piix4: Update dimm state on VM reboot Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 17/21][SeaBIOS] acpi_dsdt: Revert internal dimm state on _OST failure Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 18/21] acpi_piix4: Update dimm bitmap state on hot-remove fail Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` Vasilis Liaskovitis [this message] 2012-07-11 10:32 ` [Qemu-devel] [RFC PATCH v2 19/21] Implement "info memtotal" and "query-memtotal" Vasilis Liaskovitis 2012-07-11 15:14 ` Eric Blake 2012-07-11 15:14 ` [Qemu-devel] " Eric Blake 2012-07-11 16:55 ` Vasilis Liaskovitis 2012-07-11 16:55 ` Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 20/21] Implement -dimms, -dimmspop command line options Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 14:55 ` Avi Kivity 2012-07-11 14:55 ` [Qemu-devel] " Avi Kivity 2012-07-11 16:57 ` Vasilis Liaskovitis 2012-07-11 16:57 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-11 10:32 ` [RFC PATCH v2 21/21] Implement mem_increase, mem_decrease hmp/qmp commands Vasilis Liaskovitis 2012-07-11 10:32 ` [Qemu-devel] " Vasilis Liaskovitis 2012-07-12 20:04 ` [Qemu-devel] [RFC PATCH v2 00/21] ACPI memory hotplug Blue Swirl 2012-07-12 20:04 ` Blue Swirl 2012-07-13 17:49 ` Vasilis Liaskovitis 2012-07-13 17:49 ` Vasilis Liaskovitis 2012-07-14 9:08 ` Blue Swirl 2012-07-14 9:08 ` [Qemu-devel] " Blue Swirl
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1342002726-18258-20-git-send-email-vasilis.liaskovitis@profitbricks.com \ --to=vasilis.liaskovitis@profitbricks.com \ --cc=anthony@codemonkey.ws \ --cc=avi@redhat.com \ --cc=gleb@redhat.com \ --cc=imammedo@redhat.com \ --cc=kevin@koconnor.net \ --cc=kvm@vger.kernel.org \ --cc=qemu-devel@nongnu.org \ --cc=seabios@seabios.org \ --cc=wency@cn.fujitsu.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.