From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v8 21/21] libxl: add support for migrating HVM guests without a device model Date: Wed, 11 Nov 2015 17:14:49 +0000 Message-ID: <56437789.40905@citrix.com> References: <1446825955-11842-1-git-send-email-roger.pau@citrix.com> <1446825955-11842-22-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZwYyz-0001me-QV for xen-devel@lists.xenproject.org; Wed, 11 Nov 2015 17:14:53 +0000 In-Reply-To: <1446825955-11842-22-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne , xen-devel@lists.xenproject.org Cc: Ian Jackson , Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org On 06/11/15 16:05, Roger Pau Monne wrote: > diff --git a/tools/libxl/libxl_stream_write.c b/tools/libxl/libxl_stream_write.c > index 52a60d7..0a6eaf9 100644 > --- a/tools/libxl/libxl_stream_write.c > +++ b/tools/libxl/libxl_stream_write.c > @@ -232,6 +232,9 @@ void libxl__stream_write_start(libxl__egc *egc, > stream->emu_sub_hdr.id = EMULATOR_QEMU_UPSTREAM; > break; > > + case LIBXL_DEVICE_MODEL_VERSION_NONE: > + break; > + This (in principle) leaves stream->emu_sub_hdr.id uninitialised (although its value will be zero because of libxl__stream_write_init()). I would be tempted to (ab)use EMULATOR_UNKNOWN here and have setup_emulator_write() assert id != UNKNOWN, to catch calls which slip through the cracks. > default: > rc = ERROR_FAIL; > LOG(ERROR, "Unknown emulator for HVM domain"); > @@ -359,6 +362,12 @@ static void write_emulator_xenstore_record(libxl__egc *egc, > char *buf = NULL; > uint32_t len = 0; > > + if (libxl__device_model_version_running(gc, dss->domid) == > + LIBXL_DEVICE_MODEL_VERSION_NONE) { > + emulator_xenstore_record_done(egc, stream); > + return; > + } > + libxl__device_model_version_running() performs a xenstore action, which is a steep overhead for constant information. It would be better to introduce a new field in libxl__stream_write_state and cache libxl__device_model_version_running() once in libxl__stream_write_start(). You can then also use that for an assertion in setup_emulator_write() ~Andrew