Skip to contentSkip to conversation

Tools backports for 4.5

DISCUSSION Ian Jackson 4 participants 10 messages May 12, 2015 – Jun 26, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Thanks. I have noted these. Depending on what Jan says, I think these can wait for 4.5.2.

Ian.

#2 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 12.05.15 at 16:56, <[email protected]> wrote:

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 8 lines
Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Thanks. I have noted these. Depending on what Jan says, I think these can wait for 4.5.2.

For the last one, maybe put it in for 4.5.1-rc2?

Jan

#3 lore raw
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 12.05.15 at 16:56, <[email protected]> wrote:

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Thanks. I have noted these. Depending on what Jan says, I think these can wait for 4.5.2.

For the last one, maybe put it in for 4.5.1-rc2?

If any, the penultimate one is more of an issue. It prevents any systemd-based distro from rebooting dom0.

~Andrew

#4 lore raw
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 12.05.15 at 17:22, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 12.05.15 at 16:56, <[email protected]> wrote:

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

Thanks. I have noted these. Depending on what Jan says, I think these can wait for 4.5.2.

For the last one, maybe put it in for 4.5.1-rc2?

If any, the penultimate one is more of an issue. It prevents any systemd-based distro from rebooting dom0.

Makes sense (I shouldn't have stopped reading after "hotplug").

Jan

#10 lore raw
In reply to Ian Jackson
Quoted 15 lines · Ian Jackson

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 2 lines
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 6 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Quoted 3 lines

Thanks. I have noted these. Depending on what Jan says, I think these can wait for 4.5.2.

Hi Ian,

I responded to Jan's "preparing for 4.5.1" mail with backport requests that I currently don't see in staging-4.5

http://lists.xen.org/archives/html/xen-devel/2015-04/msg00168.html

Regards,
Jim

#5 lore raw

Re: Tools backports for 4.5 [and 1 more messages]

In reply to Jan Beulich

Jan Beulich writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

I have just pushed these to staging-4.5.

Jim Fehlig writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 4 lines

I responded to Jan's "preparing for 4.5.1" mail with backport requests that I currently don't see in staging-4.5

http://lists.xen.org/archives/html/xen-devel/2015-04/msg00168.html

Thanks, I have pushed those three to staging-4.5 too.

The above backports (771f857e..9d5b2b01) need to go to 4.4 and earlier as applicable. I will look at that soon (probably tomorrow).

I have also picked up the fix to XSA-133 into all the qemu-trad trees back to 4.2 inclusive. (4.1 is no longer receiving even security fixes and has had no commits since 2013.)

I think that's all the outstanding tools backports for the 4.5 branch.

Ian.

#6 lore raw

Re: Tools backports for 4.5 [and 1 more messages]

Quoted 19 lines · Ian Jackson

Jan Beulich writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Andrew Cooper writes ("Tools backports for 4.5"):

Quoted 1 line
Quoted 1 line

From the XenServer patch queue,

(Andrew forgot to CC xen-devel, doing that now:)

Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

I have just pushed these to staging-4.5.

Jim Fehlig writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 4 lines

I responded to Jan's "preparing for 4.5.1" mail with backport requests that I currently don't see in staging-4.5

http://lists.xen.org/archives/html/xen-devel/2015-04/msg00168.html

Thanks, I have pushed those three to staging-4.5 too.

Quoted 8 lines

The above backports (771f857e..9d5b2b01) need to go to 4.4 and earlier as applicable. I will look at that soon (probably tomorrow).

I have also picked up the fix to XSA-133 into all the qemu-trad trees back to 4.2 inclusive. (4.1 is no longer receiving even security fixes and has had no commits since 2013.)

I think that's all the outstanding tools backports for the 4.5 branch.

There is still a build fix from XSA-125 which as still even not been accepted into staging. This has been outstanding for 6 weeks now.

<[email protected]>

~Andrew

#7 lore raw

Re: Tools backports for 4.5 [and 1 more messages]

In reply to Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] Tools backports for 4.5 [and 1 more messages]"):

Quoted 6 lines

Jan Beulich writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

...

Quoted 2 lines

The above backports (771f857e..9d5b2b01) need to go to 4.4 and earlier as applicable. I will look at that soon (probably tomorrow).

These:

libxl: Domain destroy: unlock userdata earlier
libxl: Domain destroy: fork
tools/hotplug: systemd: Don't ever kill xenstored
libxl: In libxl_set_vcpuonline check for maximum number of VCPUs against the cpumap

Did not apply cleanly to 4.4.

Ian.

#8 lore raw

Re: Tools backports for 4.5 [and 1 more messages]

Quoted 10 lines · Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] Tools backports for 4.5 [and 1 more messages]"):

Quoted 6 lines

Jan Beulich writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

...

Quoted 2 lines

The above backports (771f857e..9d5b2b01) need to go to 4.4 and earlier as applicable. I will look at that soon (probably tomorrow).

Quoted 8 lines

These:

libxl: Domain destroy: unlock userdata earlier
libxl: Domain destroy: fork
tools/hotplug: systemd: Don't ever kill xenstored
libxl: In libxl_set_vcpuonline check for maximum number of VCPUs against the cpumap

Did not apply cleanly to 4.4.

Sorry if I asked for these in 4.4. My request was meant for 4.5 only.

Regards,
Jim

Reviewed-by Wei Liu Reviewed-by Tested-by Acked-by Ian Campbell
#9 lore raw

Re: Tools backports for 4.5 [and 1 more messages]

Quoted 8 lines · Jim Fehlig
Quoted 7 lines · Ian Jackson

Ian Jackson writes ("Re: [Xen-devel] Tools backports for 4.5 [and 1 more messages]"):

Quoted 6 lines

Jan Beulich writes ("Re: [Xen-devel] Tools backports for 4.5"):

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

3380f5b6270e ocaml/xenctrl: Check return values from hypercalls c8945d516134 ocaml/xenctrl: Make failwith_xc() thread safe 1a010ca99e9b ocaml/xenctrl: Fix stub_xc_readconsolering() 96e0ee8386cf tools/hotplug: systemd: Don't ever kill xenstored 588df84c0d70 tools/xenconsoled: Increase file descriptor limit

Quoted 6 lines
Quoted 6 lines

...

Quoted 2 lines

The above backports (771f857e..9d5b2b01) need to go to 4.4 and earlier as applicable. I will look at that soon (probably tomorrow).

These:

libxl: Domain destroy: unlock userdata earlier

4.4 doesn't have lock/unlock functions for the userdata store, so not sure why this one is needed.

Quoted 2 lines
Quoted 2 lines

libxl: Domain destroy: fork

Attached is my stab at backporting this one, which helps the libvirt libxl driver quite a bit.

Quoted 3 lines
Quoted 3 lines

tools/hotplug: systemd: Don't ever kill xenstored
libxl: In libxl_set_vcpuonline check for maximum number of VCPUs against
the cpumap

I didn't request these, and they don't fix any particular headache for me, so I didn't look further.

Regards,
Jim

Quoted 1 line

From 0e447fed880e302e053f486180b1f6c22f515403 Mon Sep 17 00:00:00 2001

From: Ian Jackson <[email protected]>
Date: Thu, 5 Mar 2015 16:28:04 +0000
Subject: [PATCH] libxl: Domain destroy: fork

Call xc_domain_destroy in a subprocess. That allows us to do so asynchronously, rather than blocking the whole process calling libxl.

The changes in detail:

* Provide an libxl__ev_child in libxl__domain_destroy_state, and initialise it in libxl__domain_destroy. There is no possibility to `clean up' a libxl__ev_child, but there need to clean it up, as the control flow ensures that we only continue after the child has exited.

* Call libxl__ev_child_fork at the right point and put the call to xc_domain_destroy and associated logging in the child. (The child opens a new xenctrl handle because we mustn't use the parent's.)

* Consequently, the success return path from domain_destroy_domid_cb no longer calls dis->callback. Instead it simply returns.

* We plumb the errorno value through the child's exit status, if it fits. This means we normally do the logging only in the parent.

* Incidentally, we fix the bug that we were treating the return value from xc_domain_destroy as an errno value when in fact it is a return value from do_domctl (in this case, 0 or -1 setting errno).

Conflicts:
tools/libxl/libxl.c

---
 tools/libxl/libxl.c          | 57 ++++++++++++++++++++++++++++++++++++++++----
 tools/libxl/libxl_internal.h |  1 +
 2 files changed, 53 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +52 -5
index 59e3292..d91a178 100644
@@ -1367,6 +1367,10 @@ static void devices_destroy_cb(libxl__egc *egc,
                                libxl__devices_remove_state *drs,
                                int rc);
 
+static void domain_destroy_domid_cb(libxl__egc *egc,
+                                    libxl__ev_child *destroyer,
+                                    pid_t pid, int status);
+
 void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
 {
     STATE_AO_GC(dis->ao);
@@ -1376,6 +1380,8 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
     char *pid;
     int rc, dm_present;
 
+    libxl__ev_child_init(&dis->destroyer);
+
     rc = libxl_domain_info(ctx, NULL, domid);
     switch(rc) {
     case 0:
@@ -1472,17 +1478,58 @@ static void devices_destroy_cb(libxl__egc *egc,
 
     libxl__userdata_destroyall(gc, domid);
 
-    rc = xc_domain_destroy(ctx->xch, domid);
-    if (rc < 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_domain_destroy failed for %d", domid);
+    rc = libxl__ev_child_fork(gc, &dis->destroyer, domain_destroy_domid_cb);
+    if (rc < 0) goto out;
+    if (!rc) { /* child */
+        ctx->xch = xc_interface_open(ctx->lg,0,0);
+        if (!ctx->xch) goto badchild;
+
+        rc = xc_domain_destroy(ctx->xch, domid);
+        if (rc < 0) goto badchild;
+        _exit(0);
+
+    badchild:
+        if (errno > 0  && errno < 126) {
+            _exit(errno);
+        } else {
+            LOGE(ERROR,
+ "xc_domain_destroy failed for %d (with difficult errno value %d)",
+                 domid, errno);
+            _exit(-1);
+        }
+    }
+    LOG(INFO, "forked pid %ld for destroy of domain %d", (long)rc, domid);
+
+    return;
+
+out:
+    dis->callback(egc, dis, rc);
+    return;
+}
+
+static void domain_destroy_domid_cb(libxl__egc *egc,
+                                    libxl__ev_child *destroyer,
+                                    pid_t pid, int status)
+{
+    libxl__destroy_domid_state *dis = CONTAINER_OF(destroyer, *dis, destroyer);
+    STATE_AO_GC(dis->ao);
+    int rc;
+
+    if (status) {
+        if (WIFEXITED(status) && WEXITSTATUS(status)<126) {
+            LOGEV(ERROR, WEXITSTATUS(status),
+                  "xc_domain_destroy failed for %"PRIu32"", dis->domid);
+        } else {
+            libxl_report_child_exitstatus(CTX, XTL_ERROR,
+                                          "async domain destroy", pid, status);
+        }
         rc = ERROR_FAIL;
         goto out;
     }
     rc = 0;
 
-out:
+ out:
     dis->callback(egc, dis, rc);
-    return;
 }
 
 int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num,
tools/libxl/libxl_internal.h +1 -0
index 9d17586..df63757 100644
@@ -2466,6 +2466,7 @@ struct libxl__destroy_domid_state {
     libxl__domid_destroy_cb *callback;
     /* private to implementation */
     libxl__devices_remove_state drs;
+    libxl__ev_child destroyer;
 };
 
 struct libxl__domain_destroy_state {
Signature · 1 line
2.1.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel