From: Igor Mammedov <imammedo@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: guangrong.xiao@linux.intel.com, mst@redhat.com,
qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com,
cornelia.huck@de.ibm.com, den@openvz.org, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size()
Date: Fri, 5 Feb 2016 15:53:55 +0100 [thread overview]
Message-ID: <20160205155355.0cc8b9fa@nial.brq.redhat.com> (raw)
In-Reply-To: <56B4ADE7.7050306@virtuozzo.com>
On Fri, 5 Feb 2016 17:12:55 +0300
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> wrote:
> On 05.02.2016 15:57, Igor Mammedov wrote:
> > On Fri, 5 Feb 2016 11:19:00 +0300
> > Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> wrote:
> >
> >> 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;
> > dimm is accessed via properties so you can use Object* instead of PCDIMMDevice
> >
> > Object *obj = OBJECT(item->data)
>
> ok
>
> >
> >> + size += object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, NULL);
> > maybe
> > s/NULL/error_abort/
>
> Not sure, but agree, absence of size for memory device is very strange.
it shouldn't happen ever, if error happens it's programming error
and we should fix it then but not hide it.
>
> >
> >> }
> >> - qapi_free_MemoryDeviceInfoList(info_list);
> >> + g_slist_free(list);
> >>
> >> return size;
> >> }
>
>
next prev parent reply other threads:[~2016-02-05 14:54 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 ` [Qemu-devel] [PATCH 4/5] virtio-balloon: rewrite get_current_ram_size() Vladimir Sementsov-Ogievskiy
2016-02-05 12:57 ` Igor Mammedov
2016-02-05 14:12 ` Vladimir Sementsov-Ogievskiy
2016-02-05 14:53 ` Igor Mammedov [this message]
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=20160205155355.0cc8b9fa@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=den@openvz.org \
--cc=guangrong.xiao@linux.intel.com \
--cc=lcapitulino@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).