Skip to contentSkip to conversation

tools/hotplug fixes for xen-unstable

PATCH In review Olaf Hering 2 participants 6 messages Nov 25, 2011 – Dec 8, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/hotplug fixes for xen-unstable

Update xencommons to avoid error messages in non-Xen environment, and load required kernel drivers.

Olaf

 tools/hotplug/Linux/init.d/xencommons |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/1 xencommons: run script only when needed

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1322228282 -3600
# Node ID bed3a6489d9a2ee2fdfc12a35f8544c7148dfe1a # Parent 1027e7d13d02143048c7d48d7960967c5b1657a8
xencommons: run script only when needed

Currently xencommons prints an error that /proc/xen/capabilities does not exist when started on a non-xen kernel.

Update the xencommons script to run only when needed:
- do not run if /proc/xen does not exist
- check if /proc/xen/capabilities exists before doing the grep for dom0

tools/hotplug/Linux/init.d/xencommons +11 -2
diff -r 1027e7d13d02 -r bed3a6489d9a tools/hotplug/Linux/init.d/xencommons
@@ -29,15 +29,24 @@ test -f $xencommons_config/xencommons &&
 XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
 shopt -s extglob
 
+# not running in Xen dom0 or domU
+if ! test -d /proc/xen ; then
+	exit 0
+fi
+
+# mount xenfs in dom0 or domU with a pv_ops kernel
 if test "x$1" = xstart && \
-     test -d /proc/xen && \
    ! test -f /proc/xen/capabilities && \
    ! grep '^xenfs ' /proc/mounts >/dev/null;
 then
 	mount -t xenfs xenfs /proc/xen
 fi
 
-if ! grep -q "control_d" /proc/xen/capabilities ; then
+# run this script only in dom0:
+# no capabilities file in xenlinux domU kernel
+# empty capabilities file in pv_ops domU kernel
+if test -f /proc/xen/capabilities && \
+   ! grep -q "control_d" /proc/xen/capabilities ; then
 	exit 0
 fi
#2 lore raw

PATCH 1/1 xencommons: load evtchn and gntdev modules

In reply to Olaf Hering

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1322228288 -3600
# Node ID 666c76daa1e74cb7f6d237fe34434d262fc91f6a # Parent bed3a6489d9a2ee2fdfc12a35f8544c7148dfe1a
xencommons: load evtchn and gntdev modules

There is currently no code in the kernel to trigger autoload of the evtchn or gntdev drivers. Load them manually during xencommons start. Handle both pvops and xenlinux module names.

tools/hotplug/Linux/init.d/xencommons +5 -0
diff -r bed3a6489d9a -r 666c76daa1e7 tools/hotplug/Linux/init.d/xencommons
@@ -54,6 +54,11 @@ do_start () {
         local time=0
 	local timeout=30
 
+	modprobe xen-evtchn 2>/dev/null
+	modprobe xen-gntdev 2>/dev/null
+	modprobe evtchn 2>/dev/null
+	modprobe gntdev 2>/dev/null
+
 	if ! `xenstore-read -s / >/dev/null 2>&1`
 	then
 		test -z "$XENSTORED_ROOTDIR" || XENSTORED_ROOTDIR="/var/lib/xenstored"
#4 lore raw
Quoted 8 lines · Ian Jackson

Olaf Hering writes ("[Xen-devel] [PATCH 0 of 2] tools/hotplug fixes for xen-unstable"):

Quoted 2 lines

Update xencommons to avoid error messages in non-Xen environment, and load required kernel drivers.

Great, thanks.

Ian,

could the modprobe change be backported to 4.1 and maybe even 4.0?

Olaf

#5 lore raw

Olaf Hering writes ("Re: [Xen-devel] [PATCH 0 of 2] tools/hotplug fixes for xen-unstable"):

Quoted 1 line

could the modprobe change be backported to 4.1 and maybe even 4.0?

Yes, I think it has been in unstable long enough. I have cherry picked it into to 4.1, whose xencommons is identical to unstable's.

As regards 4.0: the xencommons script there is substantially different, as the toolstack startup arrangements don't match 4.1/unstable. If someone wants to provide a (tested!) backport then we'll consider it.

Thanks,
Ian.