xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: John Nemeth <jnemeth@cue.bc.ca>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>
Subject: Re: Xen 4.6 script calling conventions
Date: Sat, 2 Jul 2016 12:40:43 +0100	[thread overview]
Message-ID: <20160702114043.GF32594@citrix.com> (raw)
In-Reply-To: <201606290100.u5T10nu8013384@server.cornerstoneservice.ca>

On Tue, Jun 28, 2016 at 06:00:49PM -0700, John Nemeth wrote:
>      I'm trying to package Xen 4.6 (specifically Xen 4.6.3) for
> use with NetBSD.  I have it mostly done; however, when I try to
> create a domU, libxl goes into an infinite loop calling the scripts.
> If I try to create a domU with no network or disk, it works fine
> (albeit of rather limited use).  Have there been changes between
> Xen 4.5 and Xen 4.6 in the calling convention for the scripts?  Is
> there documentation on what is expected somewhere?  Please CC me on
> any responses.  Here is my domU config file:

Can you give this patch a try? I don't have netbsd system at hand to
test it.

I suspect netbsd doesn't support stubdom because that pile of code is a
bit Linux centric, but it wouldn't hurt to prepare for it.

---8<---
From 3c64a22f4a5dcf76244c2acff7a26717402ea33c Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@citrix.com>
Date: Sat, 2 Jul 2016 12:35:30 +0100
Subject: [PATCH] libxl/netbsd: check num_exec in hotplug function

This basically replicates the same logic in libxl_linux.c. Without this
libxl will loop indefinitely trying to execute hotplug script.

Reported-by: John Nemeth <jnemeth@cue.bc.ca>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_netbsd.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
index 096c057..92d3c89 100644
--- a/tools/libxl/libxl_netbsd.c
+++ b/tools/libxl/libxl_netbsd.c
@@ -68,7 +68,25 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
 
     switch (dev->backend_kind) {
     case LIBXL__DEVICE_KIND_VBD:
+        if (num_exec != 0) {
+            LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+            rc = 0;
+            goto out;
+        }
+        rc = libxl__hotplug(gc, dev, args, action);
+        if (!rc) rc = 1;
+        break;
     case LIBXL__DEVICE_KIND_VIF:
+        /*
+         * If domain has a stubdom we don't have to execute hotplug scripts
+         * for emulated interfaces
+         */
+        if ((num_exec > 1) ||
+            (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
+            LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+            rc = 0;
+            goto out;
+        }
         rc = libxl__hotplug(gc, dev, args, action);
         if (!rc) rc = 1;
         break;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-02 11:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29  1:00 Xen 4.6 script calling conventions John Nemeth
2016-06-29 15:46 ` Dario Faggioli
2016-07-02 11:40 ` Wei Liu [this message]
2016-07-04  8:07   ` John Nemeth
2016-07-04 11:18     ` Wei Liu
2016-07-04 11:45     ` Roger Pau Monné
2016-07-04 11:57   ` Roger Pau Monné
2016-07-04 12:04     ` Wei Liu

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=20160702114043.GF32594@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=jnemeth@cue.bc.ca \
    --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 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).