From: Eric Blake <eblake@redhat.com>
To: "Marc Marí" <marc.mari.barcelo@gmail.com>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [RFC] qapi: New command query-mtree
Date: Wed, 20 Aug 2014 14:12:24 -0600 [thread overview]
Message-ID: <53F50128.1030400@redhat.com> (raw)
In-Reply-To: <53F4F260.8030600@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2525 bytes --]
On 08/20/2014 01:09 PM, Eric Blake wrote:
> On 08/20/2014 11:46 AM, Marc Marí wrote:
>> Add command query-mtree to get the memory tree of the guest.
>>
>> As we were looking for a flexible solution on accessing the guest memory from
>> qtests, Stefan came with the idea to implement this new qmp command.
>>
>> This way, the result can be parsed, and the RAM direction extracted, so only
>> a generic qtest malloc is necessary and not one per machine, as it is
>> implemented at the moment (malloc-pc uses fw_cfg).
>>
>> The actual output is this: http://pastebin.com/nHAH9Jie
>> Which corresponds to this info mtree: http://pastebin.com/B5vw8DDf
>
>
>> +##
>> +{ 'command': 'query-mtree', 'returns': 'MemTree' }
>
> I was expecting ['MemTree'] (an array of structs), but you gave
> 'MemTreee' (a struct of parallel arrays). Am I guaranteed that
> returns.spaces and returns.aliases are arrays of the same length? If
> not, what's the difference between 'spaces' and 'aliases' (that is, why
> do I need two arrays)? Should the designation of 'space' vs. 'alias' be
> part of the 'AddrSpace' struct, rather than having to be learned
> indirectly by which of the two arrays it appeared in?
>
Looking at your pastebin, I'm seeing some repetition. For example:
return.spaces[0].mem.submr[0] is (line 11 in the pastebin):
{
u'name': u'ram-below-4g',
u'prio': 0,
u'read': True,
u'ram': False,
u'write': True,
u'alias': u'pc.ram',
u'base': 0,
u'size': 536870911
},
Later, return.aliases[0] is (line 858):
u'mem': {
u'name': u'pc.ram',
u'prio': 0,
u'read': True,
u'ram': True,
u'write': True,
u'base': 0,
u'size': 536870911
},
u'name': u'pc.ram'
Isn't that two descriptions of the same region? Would it be better if
one of the references in the JSON was just a name, and make the caller
look up that name in the other location, instead of inlining the full
struct at both locations? On the other hand, the 'ram' field for that
memory region appears to be different depending on whether you access it
via the subregion of system vs. via the pc.ram alias. Okay, maybe that
much complexity really is necessary.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-08-20 20:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 17:46 [Qemu-devel] [RFC] qapi: New command query-mtree Marc Marí
2014-08-20 19:09 ` Eric Blake
2014-08-20 20:08 ` Marc Marí
2014-08-20 20:12 ` Eric Blake [this message]
2014-08-21 9:06 ` Paolo Bonzini
2014-08-21 9:18 ` Marc Marí
2014-08-21 9:47 ` Paolo Bonzini
2014-08-21 9:56 ` Paolo Bonzini
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=53F50128.1030400@redhat.com \
--to=eblake@redhat.com \
--cc=afaerber@suse.de \
--cc=marc.mari.barcelo@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).