From: Anthony PERARD <anthony.perard@citrix.com>
To: Ian Jackson <ian.jackson@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH v6 02/11] libxl_qmp: Separate QMP message generation from qmp_send_prepare
Date: Tue, 13 Nov 2018 10:59:42 +0000 [thread overview]
Message-ID: <20181113105942.GI1302@perard.uk.xensource.com> (raw)
In-Reply-To: <23529.46709.254200.357650@mariner.uk.xensource.com>
On Mon, Nov 12, 2018 at 05:20:53PM +0000, Ian Jackson wrote:
> Thanks for the repost. I feel I am going to make some comments which
> could perhaps have been made earlier, so sorry for that:
>
> Anthony PERARD writes ("[PATCH v6 02/11] libxl_qmp: Separate QMP message generation from qmp_send_prepare"):
> > -static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp,
> > - const char *cmd, libxl__json_object *args,
> > - qmp_callback_t callback, void *opaque,
> > - qmp_request_context *context)
>
> 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).
I've make the change to return a NOGC buffers because I don't know how
to have an allocation survive an `egc`.
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.
> This patch seems to be a mixture of four things:
>
> 1. Changing the return value convention of qmp_send_prepare
> to expect the caller to free it.
>
> 2. Changing qmp_send_prepare to include the \r\n
>
> 3. Splitting qmp_prepare_cmd out from qmp_send_prepare
>
> 4. Changing qmp_send_prepare to tell the caller the length
>
> Overall I think there is supposed to be no functional change ?
> This should be mentioned in the commit message.
>
> I appreciate that these four things are small, perhaps too small to
> split out, but they should all be mentioned in the commit message.
>
> And then, the reasons for these changes are unstated. AFAICT:
>
> 3 is wanted because we are going to have a new caller which wants to
> handle the sending itself. Fine.
>
> 2 is wanted because every caller will want this, so it should be done
> in the common function.
>
> 1 is wanted because 2 demands it.
I'll try to improve the patch description and awnser all those things.
> 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.
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-11-13 10:59 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 16:49 [PATCH v6 00/11] libxl: Enable save/restore/migration of a restricted QEMU + libxl__ev_qmp_* Anthony PERARD
2018-11-12 16:49 ` [PATCH v6 01/11] libxl: Enhance libxl__sendmsg_fds to deal with EINTR and EWOULDBLOCK Anthony PERARD
2018-11-12 16:58 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 02/11] libxl_qmp: Separate QMP message generation from qmp_send_prepare Anthony PERARD
2018-11-12 17:20 ` Ian Jackson
2018-11-13 10:59 ` Anthony PERARD [this message]
2018-11-13 12:04 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 03/11] libxl_qmp: Change qmp_qemu_check_version to compare version Anthony PERARD
2018-11-12 17:22 ` Ian Jackson
2018-11-22 12:24 ` Anthony PERARD
2018-11-22 12:27 ` Anthony PERARD
2018-11-12 16:49 ` [PATCH v6 04/11] libxl: Design of an async API to issue QMP commands to QEMU Anthony PERARD
2018-11-12 17:29 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 05/11] libxl_qmp: Implementation of libxl__ev_qmp_* Anthony PERARD
2018-11-13 11:33 ` Ian Jackson
2018-11-22 19:04 ` Marek Marczykowski-Górecki
2018-11-23 11:09 ` Anthony PERARD
2018-11-12 16:49 ` [PATCH v6 06/11] libxl_exec: Add libxl__spawn_initiate_failure Anthony PERARD
2018-11-12 17:34 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 07/11] libxl_dm: Pre-open QMP socket for QEMU Anthony PERARD
2018-11-16 11:52 ` Ian Jackson
2018-11-21 17:14 ` Anthony PERARD
2018-11-12 16:49 ` [PATCH v6 08/11] libxl: QEMU startup sync based on QMP Anthony PERARD
2018-11-16 12:14 ` Ian Jackson
2018-11-21 16:49 ` Anthony PERARD
2018-11-22 14:37 ` Anthony PERARD
2018-11-22 15:48 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 09/11] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp Anthony PERARD
2018-11-16 12:17 ` Ian Jackson
2018-11-12 16:49 ` [PATCH v6 10/11] libxl: Change libxl__domain_suspend_device_model() to be async Anthony PERARD
2018-11-12 16:49 ` [PATCH v6 11/11] libxl: Re-implement domain_suspend_device_model using libxl__ev_qmp Anthony PERARD
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=20181113105942.GI1302@perard.uk.xensource.com \
--to=anthony.perard@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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.