qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] qapi: New command query-mtree


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC] qapi: New command query-mtree
Date: Wed, 20 Aug 2014 14:12:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]