From: "Chun Yan Liu" <cyliu@suse.com>
To: xen-devel@lists.xen.org, Juergen Gross <JGross@suse.com>
Cc: George.Dunlap@eu.citrix.com, ian.jackson@eu.citrix.com,
wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v3 4/5] libxl: check for dynamic device model start required
Date: Thu, 24 Mar 2016 20:06:57 -0600 [thread overview]
Message-ID: <56F50DC102000066000C0EF4@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1458735847-9448-5-git-send-email-jgross@suse.com>
>>> On 3/23/2016 at 08:24 PM, in message
<1458735847-9448-5-git-send-email-jgross@suse.com>, Juergen Gross
<jgross@suse.com> wrote:
> Add a service routine checking whether a device model must be started
> after adding a device to a domain.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> tools/libxl/libxl.c | 12 ++++++++++++
> tools/libxl/libxl_dm.c | 14 ++++++++++++++
> tools/libxl/libxl_internal.h | 4 ++++
> tools/libxl/libxl_pci.c | 3 +++
> tools/libxl/libxl_pvusb.c | 6 ++++++
> 5 files changed, 39 insertions(+)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index dcd0951..2b4e36f 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -2084,6 +2084,9 @@ void libxl__device_vtpm_add(libxl__egc *egc, uint32_t
> domid,
> if (rc) goto out;
>
> DEVICE_ADD(vtpm, vtpms, domid, &vtpm_saved, COMPARE_DEVID,
> &d_config);
> +
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> }
Why is this check put inside the if (aodev->update_json) { }? I think it's a common
check, so should move outside.
- Chunyan
>
> for (;;) {
> @@ -2388,6 +2391,9 @@ static void device_disk_add(libxl__egc *egc, uint32_t
> domid,
> if (rc) goto out;
>
> DEVICE_ADD(disk, disks, domid, &disk_saved, COMPARE_DISK, &d_config);
> +
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> }
>
> for (;;) {
> @@ -2928,6 +2934,9 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid,
> libxl_device_disk *disk,
>
> DEVICE_ADD(disk, disks, domid, &disk_saved, COMPARE_DISK, &d_config);
>
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> +
> if (dm_ver == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
> rc = libxl__qmp_insert_cdrom(gc, domid, disk);
> if (rc) goto out;
> @@ -3354,6 +3363,9 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t
> domid,
> if (rc) goto out;
>
> DEVICE_ADD(nic, nics, domid, &nic_saved, COMPARE_DEVID, &d_config);
> +
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> }
>
> for (;;) {
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index bffb8f8..78c46674 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -2160,6 +2160,20 @@ int libxl__dm_active(libxl__gc *gc, uint32_t domid)
> return pid != NULL;
> }
>
> +int libxl__dm_check_start(libxl__gc *gc, libxl_domain_config *d_config,
> + uint32_t domid)
> +{
> + if (libxl__dm_active(gc, domid))
> + return 0;
> +
> + if (!libxl__need_xenpv_qemu(gc, d_config))
> + return 0;
> +
> + LOG(ERROR, "device model required but not running");
> +
> + return ERROR_FAIL;
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 2db8b1b..9708a46 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -1618,6 +1618,10 @@ _hidden const char
> *libxl__domain_device_model(libxl__gc *gc,
> const libxl_domain_build_info
> *info);
> _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
> libxl_domain_config *d_config);
> +_hidden int libxl__dm_active(libxl__gc *gc, uint32_t domid);
> +_hidden int libxl__dm_check_start(libxl__gc *gc,
> + libxl_domain_config *d_config,
> + uint32_t domid);
>
> /*
> * This function will fix reserved device memory conflict
> diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
> index dc10cb7..300fd4d 100644
> --- a/tools/libxl/libxl_pci.c
> +++ b/tools/libxl/libxl_pci.c
> @@ -169,6 +169,9 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
> uint32_t domid, libxl_d
>
> DEVICE_ADD(pci, pcidevs, domid, &pcidev_saved, COMPARE_PCI, &d_config);
>
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> +
> for (;;) {
> rc = libxl__xs_transaction_start(gc, &t);
> if (rc) goto out;
> diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
> index 7200ead..976e4c7 100644
> --- a/tools/libxl/libxl_pvusb.c
> +++ b/tools/libxl/libxl_pvusb.c
> @@ -139,6 +139,9 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc
> *gc, uint32_t domid,
>
> DEVICE_ADD(usbctrl, usbctrls, domid, &usbctrl_saved,
> COMPARE_USBCTRL, &d_config);
> +
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> }
>
> for (;;) {
> @@ -955,6 +958,9 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc
> *gc, uint32_t domid,
>
> DEVICE_ADD(usbdev, usbdevs, domid, &usbdev_saved,
> COMPARE_USB, &d_config);
> +
> + rc = libxl__dm_check_start(gc, &d_config, domid);
> + if (rc) goto out;
> }
>
> for (;;) {
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-25 2:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-23 12:24 [PATCH v3 0/5] libxl: add support for qemu base pvusb backend Juergen Gross
2016-03-23 12:24 ` [PATCH v3 1/5] libxl: make libxl__need_xenpv_qemu() operate on domain config Juergen Gross
2016-03-24 20:28 ` Wei Liu
2016-03-25 6:13 ` Juergen Gross
2016-03-23 12:24 ` [PATCH v3 2/5] libxl: add new pvusb backend "qusb" provided by qemu Juergen Gross
2016-03-25 2:23 ` Chun Yan Liu
[not found] ` <56F5119C02000066000C0F24@suse.com>
2016-03-25 6:29 ` Juergen Gross
2016-03-25 6:38 ` Chun Yan Liu
2016-03-23 12:24 ` [PATCH v3 3/5] libxl: add service function to check whether device model is running Juergen Gross
2016-03-24 20:28 ` Wei Liu
2016-03-23 12:24 ` [PATCH v3 4/5] libxl: check for dynamic device model start required Juergen Gross
2016-03-25 2:06 ` Chun Yan Liu [this message]
[not found] ` <56F50DC102000066000C0EF4@suse.com>
2016-03-25 6:25 ` Juergen Gross
2016-03-25 6:29 ` Chun Yan Liu
2016-03-23 12:24 ` [PATCH v3 5/5] libxl: add domain config parameter to force start of qemu Juergen Gross
2016-03-24 20:28 ` Wei Liu
2016-03-24 20:35 ` Wei Liu
2016-03-25 6:20 ` Juergen Gross
2016-03-25 6:16 ` Juergen Gross
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=56F50DC102000066000C0EF4@prv-mh.provo.novell.com \
--to=cyliu@suse.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JGross@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).