All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc Marí" <marc.mari.barcelo@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [RFC] qapi: New command query-mtree
Date: Wed, 20 Aug 2014 22:08:54 +0200	[thread overview]
Message-ID: <20140820220854.4458a1ee@crunchbang> (raw)
In-Reply-To: <53F4F260.8030600@redhat.com>

El Wed, 20 Aug 2014 13:09:20 -0600
Eric Blake <eblake@redhat.com> escribió:
> 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
> 
> Alas, these pastebins will expire, even when we still read qemu.git
> many years from now.  If it weren't for the fact that 116 lines of
> mtree is exploding into 1033 lines of prettified JSON, I'd suggest
> putting it here in the commit message.  Or if you can come up with a
> simpler testcase, or summarize a sample section here, even that would
> be nicer than pointing to what will eventually be a stale URL.

In the final commit message I was thinking in dropping the "why" and the
examples. I put those just for the RFC.

> 
> > +##
> > +{ 'type': 'MemTree', 'data': {'spaces': ['AddrSpace'],
> > +                                'aliases': ['AddrSpace']} }
> 
> Whitespace doesn't matter, but consistent alignment would look better.
> 
> > +
> > +##
> > +# @query-mtree:
> > +#
> > +# Return the memory distribution of the guest
> > +#
> > +# Returns: a list of @AddrSpace
> > +#
> > +# Since: 2.x
> 
> s/2.x/2.2/
> 
> > +##
> > +{ '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?
> 

I put it this way to do it as similar as possible as "info mtree" where
there are two sections, "alias" and "the other". But this could be just
specified inside AddrSpace, and return a ['AddrSpace'] or change its
name to ['MemTree']

> > diff --git a/qmp-commands.hx b/qmp-commands.hx
> > index 4be4765..22f91b0 100644
> > --- a/qmp-commands.hx
> > +++ b/qmp-commands.hx
> > @@ -3755,3 +3755,22 @@ Example:
> >  <- { "return": {} }
> >  
> >  EQMP
> > +    {
> > +        .name       = "query-mtree",
> > +        .args_type  = "",
> > +        .mhandler.cmd_new = qmp_marshal_input_query_mtree,
> > +    },
> > +SQMP
> > +query-mtree
> > +---------
> > +
> > +Memory tree.
> > +
> > +The returned value is a json-array of the memory distribution of
> > the system.
> 
> Docs don't match your qapi schema.  Let's make sure we get the schema
> correct, and then make the docs match. 

I changed the schema after writing the docs, and I didn't update the
docs.

> > +Each address space is represented by a json-object, which has a
> > name, and a +json-array of all memory regions that contain.
> 
> that contain what?  Did you mean "that it contains"?

Yes.

Thanks for your comments
Marc

  reply	other threads:[~2014-08-20 20:09 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í [this message]
2014-08-20 20:12   ` Eric Blake
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=20140820220854.4458a1ee@crunchbang \
    --to=marc.mari.barcelo@gmail.com \
    --cc=afaerber@suse.de \
    --cc=eblake@redhat.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 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.