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

Re: [Xen-devel] [PATCH v6 02/11] libxl_qmp: Separate QMP message generation from qmp_send_prepare



Anthony PERARD writes ("Re: [PATCH v6 02/11] libxl_qmp: Separate QMP message 
generation from qmp_send_prepare"):
> On Mon, Nov 12, 2018 at 05:20:53PM +0000, Ian Jackson wrote:
> > Previously this function returned memory allocated from malloc, and
> > this was not documented.  I think it should be, for both this and for
> > qmp_prepare_cmd.  See the big libxl.h comment on "memory allocation".
> 
> The memory allocated from malloc is new, before that it was allocated in
> `gc` (aside from the `yajl_gen hand` which needs to be freed before the
> function returns).

Right.  I was asking for this to be documented in a comment, as
required by the libxl error handling model.

> I've make the change to return a NOGC buffers because I don't know how
> to have an allocation survive an `egc`.

Indeed, an egc's allocation would be too short.

> Do you think I could call qmp_send_prepare with an `ao_gc` ? Not in this
> patch, but later, in the context of libxl__ev_qmp which I think
> shouldn't survive an AO.

Ah yes, I keep thinking that you could cache a libxl__ev_qmp in the
libxl_ctx but because qemu will only talk on one at once, you are
right.  So yes a libxl__ev_qmp should have a reference to an ao.

Then you can use the ao gc.

> > 1 is wanted because 2 demands it.
> 
> I'll try to improve the patch description and awnser all those things.

Thanks.

> > 4 ???  The existing code uses strlen.  JSON can't contain nul bytes.
> > Why should the new caller not do similarly ?  If the use of strlen is
> > wrong why not change the old caller ?  (Maybe it is going away, in
> > which case that needs to be mentioned.)
> 
> I guess I can recalculate the lenght at the time when it will be needed
> in a later patch.

Or something.  I just noticed that this was done differently in
different places.  It's probably more convenient to recalculate it
than it is to carry it about.

But I don't mind if you want to carry it about - but in that case I
think you should switch all the callers to using the length returned
by qmp_prepare_cmd.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.