aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Config.mk3
-rw-r--r--buildconfigs/mk.linux-2.6-xen15
-rw-r--r--buildconfigs/src.hg-clone14
-rw-r--r--buildconfigs/src.tarball4
-rw-r--r--config/FreeBSD.mk1
-rw-r--r--config/x86_32.mk8
-rw-r--r--tools/examples/blktap57
-rw-r--r--tools/examples/block42
-rw-r--r--tools/examples/block-common.sh43
-rw-r--r--tools/python/xen/xend/XendCheckpoint.py3
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py5
-rw-r--r--xen/Makefile2
12 files changed, 131 insertions, 66 deletions
diff --git a/Config.mk b/Config.mk
index 529d9f0e21..16d6360cef 100644
--- a/Config.mk
+++ b/Config.mk
@@ -20,6 +20,9 @@ SHELL ?= /bin/sh
HOSTCC = gcc
HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCFLAGS += -fno-strict-aliasing
+HOSTCFLAGS_x86_32 = -m32
+HOSTCFLAGS_x86_64 = -m64
+HOSTCFLAGS += $(HOSTCFLAGS_$(XEN_COMPILE_ARCH))
DISTDIR ?= $(XEN_ROOT)/dist
DESTDIR ?= /
diff --git a/buildconfigs/mk.linux-2.6-xen b/buildconfigs/mk.linux-2.6-xen
index 4fd195b397..25d258de4e 100644
--- a/buildconfigs/mk.linux-2.6-xen
+++ b/buildconfigs/mk.linux-2.6-xen
@@ -7,6 +7,16 @@ EXTRAVERSION ?= -xen
# repositories.
LINUX_SRC_PATH ?= .:..
+# The source directory is not automatically updated to avoid blowing
+# away developer's changes. If you want to automatically pull a new
+# version of the Linux tree then add `XEN_LINUX_UPDATE=y' to your make
+# command line.
+ifeq ($(XEN_LINUX_UPDATE),y)
+__XEN_LINUX_UPDATE = $(LINUX_SRCDIR)/.force-update
+else
+__XEN_LINUX_UPDATE =
+endif
+
XEN_LINUX_SOURCE ?= hg-clone
# Let XEN_TARGET_ARCH override ARCH.
@@ -115,6 +125,7 @@ endif
echo " \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT) \$$@"; \
) > $(LINUX_DIR)/Makefile ; \
fi
+ $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) prepare
.PHONY: prep
prep: $(LINUX_DIR)/include/linux/autoconf.h
@@ -137,3 +148,7 @@ delete:
mrproper:
rm -rf $(LINUX_SRCDIR)
rm -f linux-$(LINUX_VER).tar.bz2
+
+.PHONY: $(LINUX_SRCDIR)/.force-update
+$(LINUX_SRCDIR)/.force-update:
+ @ :
diff --git a/buildconfigs/src.hg-clone b/buildconfigs/src.hg-clone
index e1d7913c61..fa7f247e7e 100644
--- a/buildconfigs/src.hg-clone
+++ b/buildconfigs/src.hg-clone
@@ -6,16 +6,6 @@ LINUX_SRCDIR ?= linux-$(LINUX_VER)-xen.hg
# Repository to clone.
XEN_LINUX_HGREPO ?= $$(sh buildconfigs/select-repository $(LINUX_SRCDIR) $(LINUX_SRC_PATH))
-# The source directory is not automatically updated to avoid blowing
-# away developer's changes. If you want to automatically pull a new
-# version of the Linux tree then add `XEN_LINUX_UPDATE=y' to your make
-# command line.
-ifeq ($(XEN_LINUX_UPDATE),y)
-__XEN_LINUX_UPDATE = $(LINUX_SRCDIR)/.force-update
-else
-__XEN_LINUX_UPDATE =
-endif
-
# Set XEN_LINUX_HGREV to update to a particlar revision.
XEN_LINUX_HGREV ?= tip
@@ -40,7 +30,3 @@ $(LINUX_SRCDIR)/.valid-src: $(__XEN_LINUX_UPDATE)
( cd $(LINUX_SRCDIR) && $(HG) update $(XEN_LINUX_HGREV) ); \
fi
touch $@
-
-.PHONY: $(LINUX_SRCDIR)/.force-update
-$(LINUX_SRCDIR)/.force-update:
- @ :
diff --git a/buildconfigs/src.tarball b/buildconfigs/src.tarball
index 1a52c39410..176e6cc4f7 100644
--- a/buildconfigs/src.tarball
+++ b/buildconfigs/src.tarball
@@ -18,11 +18,11 @@ linux-%.tar.bz2:
# XXX create a pristine tree for diff -Nurp convenience
ifeq ($(XEN_LINUX_TARBALL_KETCHUP),y)
-%/.valid-src:
+%/.valid-src: $(__XEN_LINUX_UPDATE)
$(KETCHUP) -d $(@D) $(LINUX_VER)
touch $@ # update timestamp to avoid rebuild
else
-%/.valid-src: %.tar.bz2
+%/.valid-src: $(__XEN_LINUX_UPDATE) %.tar.bz2
rm -rf tmp-linux-$* $(@D)
mkdir -p tmp-linux-$*
tar -C tmp-linux-$* -jxf $<
diff --git a/config/FreeBSD.mk b/config/FreeBSD.mk
new file mode 100644
index 0000000000..b421a1c840
--- /dev/null
+++ b/config/FreeBSD.mk
@@ -0,0 +1 @@
+include $(XEN_ROOT)/config/StdGNU.mk
diff --git a/config/x86_32.mk b/config/x86_32.mk
index ce0bb67ba1..9b8cee85b5 100644
--- a/config/x86_32.mk
+++ b/config/x86_32.mk
@@ -11,8 +11,6 @@ CFLAGS += -m32 -march=i686
LIBDIR := lib
# Use only if calling $(LD) directly.
-ifeq ($(XEN_OS),OpenBSD)
-LDFLAGS_DIRECT += -melf_i386_obsd
-else
-LDFLAGS_DIRECT += -melf_i386
-endif
+LDFLAGS_DIRECT_OpenBSD = _obsd
+LDFLAGS_DIRECT_FreeBSD = _fbsd
+LDFLAGS_DIRECT += -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
diff --git a/tools/examples/blktap b/tools/examples/blktap
index 5a7ee3236b..e4ac40b331 100644
--- a/tools/examples/blktap
+++ b/tools/examples/blktap
@@ -8,6 +8,57 @@ dir=$(dirname "$0")
findCommand "$@"
+##
+# check_blktap_sharing file mode
+#
+# Perform the sharing check for the given blktap and mode.
+#
+check_blktap_sharing()
+{
+ local file="$1"
+ local mode="$2"
+
+ local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE"
+ for dom in $(xenstore-list "$base_path")
+ do
+ for dev in $(xenstore-list "$base_path/$dom")
+ do
+ params=$(xenstore_read "$base_path/$dom/$dev/params" | cut -d: -f2)
+ if [ "$file" = "$params" ]
+ then
+
+ if [ "$mode" = 'w' ]
+ then
+ if ! same_vm "$dom"
+ then
+ echo 'guest'
+ return
+ fi
+ else
+ local m=$(xenstore_read "$base_path/$dom/$dev/mode")
+ m=$(canonicalise_mode "$m")
+
+ if [ "$m" = 'w' ]
+ then
+ if ! same_vm "$dom"
+ then
+ echo 'guest'
+ return
+ fi
+ fi
+ fi
+ fi
+ done
+ done
+
+ echo 'ok'
+}
+
+FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id")
+FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm")
+mode=$(xenstore_read "$XENBUS_PATH/mode")
+mode=$(canonicalise_mode "$mode")
+
t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING')
if [ -n "$t" ]
then
@@ -20,6 +71,12 @@ then
fi
file=$(readlink -f "$p") || ebusy "$p does not exist."
+if [ "$mode" != '!' ]
+then
+ result=$(check_blktap_sharing "$file" "$mode")
+ [ "$result" = 'ok' ] || ebusy "$file already in use by other domain"
+fi
+
if [ "$command" = 'add' ]
then
[ -e "$file" ] || { ebusy $file does not exist; }
diff --git a/tools/examples/block b/tools/examples/block
index 2b6b991125..1cf6fb8fc8 100644
--- a/tools/examples/block
+++ b/tools/examples/block
@@ -18,32 +18,6 @@ expand_dev() {
##
-# canonicalise_mode mode
-#
-# Takes the given mode, which may be r, w, ro, rw, w!, or rw!, or variations
-# thereof, and canonicalises them to one of
-#
-# 'r': perform checks for a new read-only mount;
-# 'w': perform checks for a read-write mount; or
-# '!': perform no checks at all.
-#
-canonicalise_mode()
-{
- local mode="$1"
-
- if ! expr index "$mode" 'w' >/dev/null
- then
- echo 'r'
- elif ! expr index "$mode" '!' >/dev/null
- then
- echo 'w'
- else
- echo '!'
- fi
-}
-
-
-##
# check_sharing device mode
#
# Check whether the device requested is already in use. To use the device in
@@ -126,22 +100,6 @@ check_sharing()
}
-same_vm()
-{
- local otherdom="$1"
- # Note that othervm can be MISSING here, because Xend will be racing with
- # the hotplug scripts -- the entries in /local/domain can be removed by
- # Xend before the hotplug scripts have removed the entry in
- # /local/domain/0/backend/. In this case, we want to pretend that the
- # VM is the same as FRONTEND_UUID, because that way the 'sharing' will be
- # allowed.
- local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm" \
- "$FRONTEND_UUID")
-
- [ "$FRONTEND_UUID" = "$othervm" ]
-}
-
-
##
# check_device_sharing dev mode
#
diff --git a/tools/examples/block-common.sh b/tools/examples/block-common.sh
index 000b52724f..a0ebc9b12a 100644
--- a/tools/examples/block-common.sh
+++ b/tools/examples/block-common.sh
@@ -71,3 +71,46 @@ write_dev() {
success
}
+
+
+##
+# canonicalise_mode mode
+#
+# Takes the given mode, which may be r, w, ro, rw, w!, or rw!, or variations
+# thereof, and canonicalises them to one of
+#
+# 'r': perform checks for a new read-only mount;
+# 'w': perform checks for a read-write mount; or
+# '!': perform no checks at all.
+#
+canonicalise_mode()
+{
+ local mode="$1"
+
+ if ! expr index "$mode" 'w' >/dev/null
+ then
+ echo 'r'
+ elif ! expr index "$mode" '!' >/dev/null
+ then
+ echo 'w'
+ else
+ echo '!'
+ fi
+}
+
+
+same_vm()
+{
+ local otherdom="$1"
+ # Note that othervm can be MISSING here, because Xend will be racing with
+ # the hotplug scripts -- the entries in /local/domain can be removed by
+ # Xend before the hotplug scripts have removed the entry in
+ # /local/domain/0/backend/. In this case, we want to pretend that the
+ # VM is the same as FRONTEND_UUID, because that way the 'sharing' will be
+ # allowed.
+ local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm" \
+ "$FRONTEND_UUID")
+
+ [ "$FRONTEND_UUID" = "$othervm" ]
+}
+
diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py
index f88d8a8788..6e6bb1afdd 100644
--- a/tools/python/xen/xend/XendCheckpoint.py
+++ b/tools/python/xen/xend/XendCheckpoint.py
@@ -181,7 +181,8 @@ def restore(xd, fd, dominfo = None, paused = False):
assert store_port
assert console_port
- nr_pfns = (dominfo.getMemoryTarget() + 3) / 4
+ page_size_kib = xc.pages_to_kib(1)
+ nr_pfns = (dominfo.getMemoryTarget() + page_size_kib - 1) / page_size_kib
# if hvm, pass mem size to calculate the store_mfn
image_cfg = dominfo.info.get('image', {})
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 3ca3f506d0..aad08718fc 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -607,6 +607,9 @@ class XendDomainInfo:
_, dev_info = sxprs[dev]
else: # 'vbd' or 'tap'
dev_info = self.getDeviceInfo_vbd(dev)
+ # To remove the UUID of the device from refs,
+ # deviceClass must be always 'vbd'.
+ deviceClass = 'vbd'
if dev_info is None:
return rc
@@ -981,7 +984,7 @@ class XendDomainInfo:
changed = True
# Check if the rtc offset has changes
- if vm_details.get("rtc/timeoffset", 0) != self.info["platform"].get("rtc_timeoffset", 0):
+ if vm_details.get("rtc/timeoffset", "0") != self.info["platform"].get("rtc_timeoffset", "0"):
self.info["platform"]["rtc_timeoffset"] = vm_details.get("rtc/timeoffset", 0)
changed = True
diff --git a/xen/Makefile b/xen/Makefile
index 1c701060d9..b0a9ac311c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -1,7 +1,7 @@
# This is the correct place to edit the build version.
# All other places this is stored (eg. compile.h) should be autogenerated.
export XEN_VERSION = 3
-export XEN_SUBVERSION = 0
+export XEN_SUBVERSION = 2
export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
-include xen-version