[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 19/28] Add configure --with-linux-backend-modules="mod1 mod2"



This replaces config/Linux.modules with a configure option. As a result
of this change only a single xencomons.in is required, instead of a
xencomons.in.in and sed hackery.

After this change blktap2 and blktap will be loaded at the same time.
This is already done in out-of-tree xencommons scripts, and systemd will
load both modules as well. No harm is expected by loading both modules.

Please rerun autogen.sh after applying this patch.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 README                                             | 12 --------
 config/Linux.modules                               | 20 ------------
 config/Tools.mk.in                                 |  2 ++
 tools/configure.ac                                 | 34 +++++++++++++++++++-
 tools/hotplug/Linux/Makefile                       | 14 +++------
 .../init.d/{xencommons.in.in => xencommons.in}     |  5 ++-
 tools/hotplug/Linux/systemd/Makefile               | 34 ++++----------------
 tools/hotplug/Linux/update-modules.sh              | 36 ----------------------
 8 files changed, 49 insertions(+), 108 deletions(-)

diff --git a/README b/README
index 78c5db2..e860644 100644
--- a/README
+++ b/README
@@ -235,15 +235,3 @@ There are optional targets as part of Xen's top-level 
makefile that will
 download and build tboot: install-tboot, build-tboot, dist-tboot, clean-tboot.
 These will download the latest tar file from the SourceForge site using wget,
 then build/install/dist according to Xen's settings.
-
-Required Kernel modules
-======================
-
-Xen has a set of Kernel modules which the init scripts ensure to load before
-before starting Xen guests. The list of modules are maintained in one place:
-
-  * config/$(XEN_OS).modules
-
-For more details refer to:
-
-http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
diff --git a/config/Linux.modules b/config/Linux.modules
deleted file mode 100644
index 8a764df..0000000
--- a/config/Linux.modules
+++ /dev/null
@@ -1,20 +0,0 @@
-# The file supports a simple language, comments are ignored, and if you there
-# are module replacements this can be listed by using a pipe to show preference
-# for the first module, followed by the older module.
-
-xen-evtchn
-xen-gntdev
-xen-gntalloc
-xen-blkback
-xen-netback
-xen-pciback
-evtchn
-gntdev
-netbk
-blkbk
-xen-scsibk
-usbbk
-pciback
-xen-acpi-processor
-# Prefer to load blktap2 if found, otherwise load blktap
-blktap2|blktap
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 7183c32..bf437f6 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -74,6 +74,8 @@ SYSTEMD_LIBS        := @SYSTEMD_LIBS@
 XEN_SYSTEMD_DIR     := @SYSTEMD_DIR@
 XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@
 
+LINUX_BACKEND_MODULES := @LINUX_BACKEND_MODULES@
+
 #System options
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
diff --git a/tools/configure.ac b/tools/configure.ac
index b9a1f6e..a882948 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_FILES([
 hotplug/FreeBSD/rc.d/xencommons
 hotplug/Linux/init.d/sysconfig.xencommons
 hotplug/Linux/init.d/xen-watchdog
-hotplug/Linux/init.d/xencommons.in
+hotplug/Linux/init.d/xencommons
 hotplug/Linux/init.d/xendomains
 hotplug/Linux/systemd/proc-xen.mount
 hotplug/Linux/systemd/var-lib-xenstored.mount
@@ -90,6 +90,38 @@ AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
 
+AC_ARG_WITH([linux-backend-modules],
+    AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"],
+    [List of Linux backend module or modalias names to be autoloaded on 
startup.]),
+    [LINUX_BACKEND_MODULES="$withval"],
+    [case "$host_os" in
+*linux*)
+LINUX_BACKEND_MODULES="
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap
+"
+;;
+*)
+LINUX_BACKEND_MODULES=
+;;
+esac])
+LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
+AC_SUBST(LINUX_BACKEND_MODULES)
+
 dnl Enable blktap2 on Linux only.
 AC_ARG_ENABLE([blktap2],
     AS_HELP_STRING([--enable-blktap2],
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 184f56d..8cdaa9a 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -37,23 +37,17 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all: $(XENCOMMONS_INITD) subdirs-all
-
-$(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules 
$(XENCOMMONS_INITD).in
-       $(XEN_ROOT)/tools/hotplug/Linux/update-modules.sh \
-               $(XEN_ROOT) \
-               $(XEN_OS) \
-               $(XENCOMMONS_INITD) > $@
+all: subdirs-all
 
 .PHONY: build
-build: all
+build:
 
 .PHONY: install
 install: all install-initd install-scripts install-udev subdirs-install
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
-install-initd: all
+install-initd:
        [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
        [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) 
$(DESTDIR)$(SYSCONFIG_DIR)
        [ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) 
$(DESTDIR)$(LIBEXEC_BIN)
@@ -65,7 +59,7 @@ install-initd: all
        $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
 
 .PHONY: install-scripts
-install-scripts: all
+install-scripts:
        [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
                $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
        set -e; for i in $(XEN_SCRIPTS); \
diff --git a/tools/hotplug/Linux/init.d/xencommons.in.in 
b/tools/hotplug/Linux/init.d/xencommons.in
similarity index 96%
rename from tools/hotplug/Linux/init.d/xencommons.in.in
rename to tools/hotplug/Linux/init.d/xencommons.in
index 590f745..10edf29 100644
--- a/tools/hotplug/Linux/init.d/xencommons.in.in
+++ b/tools/hotplug/Linux/init.d/xencommons.in
@@ -19,6 +19,7 @@
 ### END INIT INFO
 
 XENSTORED=@XENSTORED@
+BACKEND_MODULES="@LINUX_BACKEND_MODULES@"
 
 . @XEN_SCRIPT_DIR@/hotplugpath.sh
 
@@ -58,8 +59,10 @@ fi
 do_start () {
         local time=0
        local timeout=30
+       local mod
+
+       for mod in $BACKEND_MODULES ; do modprobe "$mod" &>/dev/null ; done
 
-       @LOAD_MODULES@
        mkdir -p ${XEN_RUN_DIR}
        mkdir -p ${XEN_LOCK_DIR}
 
diff --git a/tools/hotplug/Linux/systemd/Makefile 
b/tools/hotplug/Linux/systemd/Makefile
index 90ba16e..6950d24 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -38,31 +38,9 @@ install: $(ALL_XEN_SYSTEMD)
        $(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
        $(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
 
-$(XEN_SYSTEMD_MODULES): $(XEN_ROOT)/config/$(XEN_OS).modules
-       @set -e ;                                                       \
-       IFS=''                                                          ;\
-       cat  $(XEN_ROOT)/config/$(XEN_OS).modules       | (             \
-               while read l ; do                                       \
-                       if echo $${l} | egrep -q "^#" ; then            \
-                               continue                                ;\
-                       fi                                              ;\
-                       if echo "$${l}" | egrep -q "\|" ; then          \
-                               m1=$${l%%|*}                            ;\
-                               m2=$${l#*|}                             ;\
-                               # Systemd modules-load.d lacks support  ;\
-                               # for module replacement options, we    ;\
-                               # need to add that support upstream but ;\
-                               # its best instead to ensure this file  ;\
-                               # is no longer needed. Some folks       ;\
-                               # however have reported issues with     ;\
-                               # some modules automatically loading    ;\
-                               # so we just load all necessary xen     ;\
-                               # modules and for replacements we load  ;\
-                               # the latest module                     ;\
-                               echo "$$m1" ;\
-                               echo "$$m2" ;\
-                       else                                            \
-                               echo "$$l"                              ;\
-                       fi                                              ;\
-               done                                                    \
-       ) > $@
+$(XEN_SYSTEMD_MODULES):
+       rm -f $@.tmp
+       for mod in $(LINUX_BACKEND_MODULES) ; do \
+               echo $$mod ; \
+               done > $@.tmp
+       $(call move-if-changed,$@.tmp,$@)
diff --git a/tools/hotplug/Linux/update-modules.sh 
b/tools/hotplug/Linux/update-modules.sh
deleted file mode 100755
index 692d220..0000000
--- a/tools/hotplug/Linux/update-modules.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-IFS=''
-
-XEN_ROOT=$1
-XEN_OS=$2
-XENCOMMONS_INITD=$3
-
-cat  $XEN_ROOT/config/${XEN_OS}.modules        | (
-       while read l ; do
-               if echo $l | egrep -q "^#" ; then
-                       continue
-               fi
-               if echo "$l" | egrep -q "\|" ; then
-                       m1=${l%%|*}
-                       m2=${l#*|}
-                       echo "        modprobe $m1 2>/dev/null || modprobe $m2 
2>/dev/null"
-               else
-                       echo "        modprobe $l 2>/dev/null"
-               fi
-       done
-) > ${XENCOMMONS_INITD}.modules
-
-cat  ${XENCOMMONS_INITD}.in    | (
-       while read l ; do
-               if echo "$l" | egrep -q "@LOAD_MODULES@" ; then
-                       cat ${XENCOMMONS_INITD}.modules
-               else
-                       echo $l
-               fi
-       done
-)
-
-rm -f ${XENCOMMONS_INITD}.modules

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.