From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: vsementsov@virtuozzo.com, guangrong.xiao@linux.intel.com,
mst@redhat.com, armbru@redhat.com, lcapitulino@redhat.com,
stefanha@redhat.com, imammedo@redhat.com,
cornelia.huck@de.ibm.com, den@openvz.org
Subject: [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size()
Date: Fri, 5 Feb 2016 11:19:00 +0300 [thread overview]
Message-ID: <1454660341-45244-5-git-send-email-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <1454660341-45244-1-git-send-email-vsementsov@virtuozzo.com>
Use pc_dimm_built_list() instead of qmp_pc_dimm_device_list()
Actually, Qapi is not related to this internal helper.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
hw/virtio/virtio-balloon.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 6a4c4d2..b9c1964 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -296,26 +296,15 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)
static ram_addr_t get_current_ram_size(void)
{
- MemoryDeviceInfoList *info_list = NULL;
- MemoryDeviceInfoList **prev = &info_list;
- MemoryDeviceInfoList *info;
+ GSList *list = NULL, *item;
ram_addr_t size = ram_size;
- qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
- for (info = info_list; info; info = info->next) {
- MemoryDeviceInfo *value = info->value;
-
- if (value) {
- switch (value->type) {
- case MEMORY_DEVICE_INFO_KIND_DIMM:
- size += value->u.dimm->size;
- break;
- default:
- break;
- }
- }
+ pc_dimm_build_list(qdev_get_machine(), &list);
+ for (item = list; item; item = g_slist_next(item)) {
+ PCDIMMDevice *dimm = item->data;
+ size += object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, NULL);
}
- qapi_free_MemoryDeviceInfoList(info_list);
+ g_slist_free(list);
return size;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-02-05 8:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 8:18 [Qemu-devel] [PATCH 0/5] don't use NVDIMM for balooning Vladimir Sementsov-Ogievskiy
2016-02-05 8:18 ` [Qemu-devel] [PATCH 1/5] move get_current_ram_size to virtio-balloon.c Vladimir Sementsov-Ogievskiy
2016-02-05 8:18 ` [Qemu-devel] [PATCH 2/5] pc-dimm: rename pc_dimm_built_list() Vladimir Sementsov-Ogievskiy
2016-02-05 12:50 ` Igor Mammedov
2016-02-05 8:18 ` [Qemu-devel] [PATCH 3/5] pc-dimm: add pc_dimm_build_list() Vladimir Sementsov-Ogievskiy
2016-02-05 12:51 ` Igor Mammedov
2016-02-05 14:08 ` Vladimir Sementsov-Ogievskiy
2016-02-05 8:19 ` Vladimir Sementsov-Ogievskiy [this message]
2016-02-05 12:57 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Igor Mammedov
2016-02-05 14:12 ` Vladimir Sementsov-Ogievskiy
2016-02-05 14:53 ` Igor Mammedov
2016-02-05 8:19 ` [Qemu-devel] [PATCH 5/5] balloon: Use only 'pc-dimm' type dimm for ballooning Vladimir Sementsov-Ogievskiy
2016-02-05 12:58 ` Igor Mammedov
2016-02-05 14:09 ` Vladimir Sementsov-Ogievskiy
2016-02-05 14:55 ` Igor Mammedov
2016-02-05 16:22 ` Vladimir Sementsov-Ogievskiy
2016-02-05 8:21 ` [Qemu-devel] [PATCH v6 0/5] don't use NVDIMM for balooning Vladimir Sementsov-Ogievskiy
-- strict thread matches above, loose matches on Subject: below --
2016-02-10 8:49 [Qemu-devel] [PATCH v7 " Vladimir Sementsov-Ogievskiy
2016-02-10 8:49 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Vladimir Sementsov-Ogievskiy
2016-02-04 11:37 [Qemu-devel] [PATCH v5 0/5] don't use NVDIMM for balooning Vladimir Sementsov-Ogievskiy
2016-02-04 11:37 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Vladimir Sementsov-Ogievskiy
2016-02-04 12:23 ` Cornelia Huck
2016-02-04 12:36 ` Vladimir Sementsov-Ogievskiy
2016-02-04 12:59 ` Cornelia Huck
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=1454660341-45244-5-git-send-email-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=den@openvz.org \
--cc=guangrong.xiao@linux.intel.com \
--cc=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).