Accepting request 55632 from Virtualization

Accepted submit request 55632 from user charlesa

OBS-URL: https://build.opensuse.org/request/show/55632
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xen?expand=0&rev=110
This commit is contained in:
Marcus Rückert 2010-12-13 11:56:46 +00:00 committed by Git OBS Bridge
commit 352e788a92
12 changed files with 369 additions and 136 deletions

26
blktap2.patch Normal file
View File

@ -0,0 +1,26 @@
Calling function doesn't handle an "Exception" but only VmError, thus cleanup work won't been done if using Exception.
Change it to VmError.
Signed-off-by ChunyanLiu <cyliu@novell.com>
Index: xen-4.0.1-testing/tools/python/xen/xend/server/BlktapController.py
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/xend/server/BlktapController.py
+++ xen-4.0.1-testing/tools/python/xen/xend/server/BlktapController.py
@@ -4,6 +4,7 @@ import string, re
from xen.xend.server.blkif import BlkifController
from xen.xend.XendLogging import log
from xen.util.xpopen import xPopen3
+from xen.xend.XendError import VmError
phantomDev = 0;
phantomId = 0;
@@ -209,7 +210,7 @@ class Blktap2Controller(BlktapController
out = stdout.read();
stdout.close();
stderr.close();
- raise Exception, 'Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file);
+ raise VmError('Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file));
minor, device, control = parseDeviceString(stdout.readline())
stdout.close();

View File

@ -0,0 +1,32 @@
Subject: hotplug: allow hardlinked files for block device images
tools/hotplug/Linux/block change for this losetup -a output:
inode 12 is listed twice due to hardlinks
/dev/loop0: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop1: [0809]:139266 (/abuild/vdisk-sles11_1-disk1)
/dev/loop3: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop5: [0809]:139273 (/abuild/vdisk-sles11_5-disk1)
/dev/loop8: [0809]:12 (/abuild/bootiso-xenpaging-sles11_5.iso)
/dev/loop10: [0809]:12 (/abuild/bootiso-xenpaging-sles11_4.iso)
/dev/loop11: [0809]:139271 (/abuild/vdisk-sles11_4-disk0)
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/hotplug/Linux/block | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- xen-4.0.1-testing.orig/tools/hotplug/Linux/block
+++ xen-4.0.1-testing/tools/hotplug/Linux/block
@@ -279,8 +279,8 @@ mount it read-write in a guest domain."
fatal "Unable to lookup $file: dev: $dev inode: $inode"
fi
- shared_list=$(losetup -a | grep ' \[0*'${dev}'\]:'${inode} |
- cut -d : -f 1)
+ shared_list=$(losetup -a |
+ sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](${file})\)@\1@p" )
for dev in "$shared_list"
do
if [ -n "$dev" ]

View File

@ -1,3 +1,41 @@
-------------------------------------------------------------------
Tue Dec 7 15:38:58 CET 2010 - ohering@suse.de
- make stubdom build optional
-------------------------------------------------------------------
Tue Dec 7 15:14:12 CET 2010 - ohering@suse.de
- pass -j N to stubdom build
-------------------------------------------------------------------
Tue Dec 7 14:56:31 CET 2010 - ohering@suse.de
- add xenalzye from http://xenbits.xensource.com/ext/xenalyze.hg
-------------------------------------------------------------------
Tue Dec 7 14:25:54 CET 2010 - ohering@suse.de
- hotplug-block-losetup-a.patch
allow hardlinked blockdevices
- fate#310510 - fix xenpaging
xenpaging.paging_prep_enomem.patch
- retry page-in if guest is temporary out-of-memory
xenpaging.print-arguments.patch
- print arguments passed to xenpaging
xenpaging.machine_to_phys_mapping.patch
- invalidate array during page deallocation
xenpaging.autostart_delay.patch
- fold xenpaging.enabled.patch into this patch
- set xenpaging_delay to 0.0 to start xenpaging right away
-------------------------------------------------------------------
Fri Dec 3 16:50:01 CST 2010 - cyliu@novell.com
- blktap2 patch - fix problem that blktap2 device info not cleared
when block-attach fail.
blktap2.patch
-------------------------------------------------------------------
Tue Nov 30 13:44:35 MST 2010 - carnold@novell.com

133
xen.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package xen (Version 4.0.1_01)
# spec file for package xen (Version 4.0.1_02)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -25,35 +25,36 @@ ExclusiveArch: %ix86 x86_64
%define changeset 21326
%define xen_build_dir xen-4.0.1-testing
%define with_kmp 1
BuildRequires: LibVNCServer-devel
BuildRequires: SDL-devel
BuildRequires: automake
BuildRequires: bin86
BuildRequires: curl-devel
BuildRequires: dev86
BuildRequires: graphviz
BuildRequires: latex2html
BuildRequires: libjpeg-devel
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: pciutils-devel
BuildRequires: python-devel
BuildRequires: texinfo
BuildRequires: transfig
%define with_stubdom 1
BuildRequires: LibVNCServer-devel
BuildRequires: SDL-devel
BuildRequires: automake
BuildRequires: bin86
BuildRequires: curl-devel
BuildRequires: dev86
BuildRequires: graphviz
BuildRequires: latex2html
BuildRequires: libjpeg-devel
BuildRequires: libxml2-devel
BuildRequires: ncurses-devel
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: pciutils-devel
BuildRequires: python-devel
BuildRequires: texinfo
BuildRequires: transfig
%if %suse_version <= 1110
BuildRequires: pmtools
BuildRequires: pmtools
%else
BuildRequires: acpica
BuildRequires: acpica
%endif
%if %suse_version >= 1030
BuildRequires: texlive
BuildRequires: texlive-latex
BuildRequires: texlive
BuildRequires: texlive-latex
%else
BuildRequires: te_ams
BuildRequires: te_latex
BuildRequires: tetex
BuildRequires: te_ams
BuildRequires: te_latex
BuildRequires: tetex
%endif
%ifarch x86_64
BuildRequires: glibc-32bit glibc-devel-32bit
@ -69,7 +70,7 @@ BuildRequires: glibc-devel
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
%endif
Version: 4.0.1_01
Version: 4.0.1_02
Release: 5
License: GPLv2+
Group: System/Kernel
@ -106,6 +107,8 @@ Source23: etc_pam.d_xen-api
Source24: xenapiusers
# sysconfig hook script for Xen
Source25: xen-updown.sh
# http://xenbits.xensource.com/ext/xenalyze.hg
Source20000: xenalyze.hg.tar.bz2
# Upstream patches
Patch0: 21089-x86-startup-irq-from-setup-gsi.patch
Patch1: 21235-crashkernel-advanced.patch
@ -252,6 +255,7 @@ Patch437: xenfb_32bpp.patch
Patch438: stdvga-cache.patch
Patch439: minios-fixups.patch
Patch440: bdrv_default_rwflag.patch
Patch441: blktap2.patch
# Jim's domain lock patch
Patch450: xend-domain-lock.patch
# Hypervisor and PV driver Patches
@ -280,32 +284,36 @@ Patch704: hv_apic.patch
# Build patch
Patch999: tmp_build.patch
# FATE 310510
Patch10001: xenpaging.tools_xenpaging_cleanup.patch
Patch10002: xenpaging.pageout_policy.patch
Patch10003: xenpaging.xs_daemon_close.patch
Patch10004: xenpaging.get_paged_frame.patch
Patch10005: xenpaging.makefile.patch
Patch10010: xenpaging.policy_linear.patch
Patch10011: xenpaging.pagefile.patch
Patch10012: xenpaging.xenpaging_init.patch
Patch10013: xenpaging.mem_paging_tool_qemu_flush_cache.patch
Patch10014: xenpaging.machine_to_phys_mapping.patch
Patch10015: xenpaging.populate_only_if_paged.patch
Patch10017: xenpaging.autostart.patch
Patch10018: xenpaging.signal_handling.patch
Patch10019: xenpaging.MRU_SIZE.patch
Patch10020: xenpaging.guest_remove_page.patch
Patch10021: xenpaging.mem_event_check_ring-free_requests.patch
Patch10022: xenpaging.blacklist.patch
Patch10023: xenpaging.autostart_delay.patch
Patch10024: xenpaging.page_already_populated.patch
Patch10025: xenpaging.notify_policy_only_once.patch
Patch10026: xenpaging.num_pages_equal_max_pages.patch
Patch10027: xenpaging.p2m_mem_paging_populate_if_p2m_ram_paged.patch
Patch10028: xenpaging.HVMCOPY_gfn_paged_out.patch
Patch10029: xenpaging.optimize_p2m_mem_paging_populate.patch
Patch10030: xenpaging.enabled.patch
Patch10040: xenpaging.doc.patch
Patch902: hotplug-block-losetup-a.patch
Patch10001: xenpaging.tools_xenpaging_cleanup.patch
Patch10002: xenpaging.pageout_policy.patch
Patch10003: xenpaging.xs_daemon_close.patch
Patch10004: xenpaging.get_paged_frame.patch
Patch10005: xenpaging.makefile.patch
Patch10010: xenpaging.policy_linear.patch
Patch10011: xenpaging.pagefile.patch
Patch10012: xenpaging.xenpaging_init.patch
Patch10013: xenpaging.mem_paging_tool_qemu_flush_cache.patch
Patch10014: xenpaging.machine_to_phys_mapping.patch
Patch10015: xenpaging.populate_only_if_paged.patch
Patch10017: xenpaging.autostart.patch
Patch10018: xenpaging.signal_handling.patch
Patch10019: xenpaging.MRU_SIZE.patch
Patch10020: xenpaging.guest_remove_page.patch
Patch10021: xenpaging.mem_event_check_ring-free_requests.patch
Patch10022: xenpaging.blacklist.patch
Patch10023: xenpaging.autostart_delay.patch
Patch10024: xenpaging.page_already_populated.patch
Patch10025: xenpaging.notify_policy_only_once.patch
Patch10026: xenpaging.num_pages_equal_max_pages.patch
Patch10027: xenpaging.p2m_mem_paging_populate_if_p2m_ram_paged.patch
Patch10028: xenpaging.HVMCOPY_gfn_paged_out.patch
Patch10029: xenpaging.optimize_p2m_mem_paging_populate.patch
Patch10030: xenpaging.paging_prep_enomem.patch
Patch10031: xenpaging.print-arguments.patch
Patch10040: xenpaging.doc.patch
# xenalyze
Patch20000: xenalyze.64bit.patch
Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()")
@ -637,7 +645,7 @@ Authors:
Ian Pratt <ian.pratt@cl.cam.ac.uk>
%prep
%setup -q -n %xen_build_dir -a 1
%setup -q -n %xen_build_dir -a 1 -a 20000
tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch0 -p1
%patch1 -p1
@ -779,6 +787,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch438 -p1
%patch439 -p1
%patch440 -p1
%patch441 -p1
%patch450 -p1
%patch500 -p1
%patch501 -p1
@ -802,6 +811,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch703 -p1
%patch704 -p1
%patch999 -p1
%patch902 -p1
%patch10001 -p1
%patch10002 -p1
%patch10003 -p1
@ -827,7 +837,11 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools
%patch10028 -p1
%patch10029 -p1
%patch10030 -p1
%patch10031 -p1
%patch10040 -p1
#
%patch20000 -p1
%build
XEN_EXTRAVERSION=%version-%release
@ -837,6 +851,7 @@ sed -i "s/XEN_CHANGESET[\t ]*=.*\$/XEN_CHANGESET = %{changeset}/" xen/Makefi
RPM_OPT_FLAGS=${RPM_OPT_FLAGS//-fstack-protector/}
export CFLAGS="${RPM_OPT_FLAGS}"
export RPM_OPT_FLAGS
make -C xenalyze.hg CC="gcc -I../xen/include" %{?jobs:-j%{jobs}}
make -C tools/include/xen-foreign %{?jobs:-j%{jobs}}
make tools docs %{?jobs:-j%{jobs}}
cd tools/debugger/gdb
@ -905,6 +920,8 @@ make -C tools/misc/serial-split install \
mkdir -p $RPM_BUILD_ROOT/${_libdir}/xen/bin/
ln -s /usr/lib/xen/bin/qemu-dm $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm
%endif
cp -avL xenalyze.hg/dump-raw $RPM_BUILD_ROOT/%{_bindir}/xenalyze.dump-raw
cp -avL xenalyze.hg/xenalyze $RPM_BUILD_ROOT/%{_bindir}
%if %{?with_kmp}0
# pv driver modules
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
@ -916,8 +933,9 @@ done
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 %SOURCE20 $RPM_BUILD_ROOT/etc/modprobe.d/xen_pvdrivers.conf
%endif
%if %{?with_stubdom}0
# stubdom
make stubdom
make stubdom %{?jobs:-j%{jobs}}
make -C stubdom install \
DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} \
DOCDIR=%{_defaultdocdir}/xen INCDIR=%{_includedir}
@ -927,6 +945,7 @@ ln -s /usr/lib/xen/boot/pv-grub-x86_32.gz $RPM_BUILD_ROOT/usr/lib/xen/boot/pv-gr
ln -s /usr/lib/xen/bin/stubdom-dm $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdom-dm
ln -s /usr/lib/xen/bin/stubdompath.sh $RPM_BUILD_ROOT/usr/lib64/xen/bin/stubdompath.sh
%endif
%endif
# docs
make -C docs install \
DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} \
@ -1042,6 +1061,8 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
%files tools
%defattr(-,root,root)
#/usr/bin/lomount
/usr/bin/xenalyze
/usr/bin/xenalyze.dump-raw
/usr/bin/xencons
/usr/bin/xenstore*
/usr/bin/xentrace*
@ -1150,12 +1171,14 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
%{_datadir}/xen/qemu/*
%{_datadir}/xen/man/man1/*
%{_datadir}/xen/man/man8/*
%if %{?with_stubdom}0
/usr/lib/xen/bin/stubdom-dm
/usr/lib/xen/bin/stubdompath.sh
%ifarch x86_64
%{_libdir}/xen/bin/stubdom-dm
%{_libdir}/xen/bin/stubdompath.sh
%endif
%endif
%{_libdir}/xen/bin/qemu-dm
%ifarch x86_64
/usr/lib/xen/bin/qemu-dm
@ -1171,11 +1194,13 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/debug
%{_libdir}/python%{pyver}/site-packages/grub/*
#%pysite/fsimage.so
%{_libdir}/python%{pyver}/site-packages/fsimage.so
%if %{?with_stubdom}0
/usr/lib/xen/boot/ioemu-stubdom.gz
/usr/lib/xen/boot/pv-grub-x86_32.gz
%ifarch x86_64
/usr/lib/xen/boot/pv-grub-x86_64.gz
%endif
%endif
%files tools-domU
%defattr(-,root,root)

28
xenalyze.64bit.patch Normal file
View File

@ -0,0 +1,28 @@
Are these unsigned long lines really unsigned int, u32?
grep -En 'unsigned[[:blank:]]+long' xenalyze.hg/xenalyze.c | \
grep -Ev 'unsigned[[:blank:]]+long[[:blank:]]+long'
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
xenalyze.hg/xenalyze.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- xen-4.0.1-testing.orig/xenalyze.hg/xenalyze.c
+++ xen-4.0.1-testing/xenalyze.hg/xenalyze.c
@@ -3588,12 +3588,12 @@ void hvm_mmio_assist_process(struct reco
if(mevt.x64) {
e->gpa = r->x64.gpa;
e->data = r->x64.data;
- if(ri->extra_words*(sizeof(unsigned long))==sizeof(r->x64))
+ if(ri->extra_words*(sizeof(unsigned))==sizeof(r->x64))
e->mmio_data_valid=1;
} else {
e->gpa = r->x32.gpa;
e->data = r->x32.data;
- if(ri->extra_words*(sizeof(unsigned long))==sizeof(r->x32))
+ if(ri->extra_words*(sizeof(unsigned))==sizeof(r->x32))
e->mmio_data_valid=1;
}

3
xenalyze.hg.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3afdfed61f88250bf84f0fe89576cfb54110fa2c4a78652a1aa7a2964b10273
size 117804

View File

@ -11,31 +11,32 @@ TODO: find the correct place to remove the xenstore directory when the guest is
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/python/xen/xend/image.py | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
tools/python/xen/xend/image.py | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
--- xen-4.0.1-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.0.1-testing/tools/python/xen/xend/image.py
@@ -123,6 +123,18 @@ class ImageHandler:
@@ -123,6 +123,19 @@ class ImageHandler:
self.device_model = vmConfig['platform'].get('device_model')
self.xenpaging = vmConfig['platform'].get('xenpaging')
+ self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])
+ if self.xenpaging_delay == None:
+ log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '7.0'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0'))
+ self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']))
+ self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label']))
+ self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label']))
+ self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label']))
+ if self.xenpaging:
+ self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])
+ if self.xenpaging_delay == None:
+ log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '0.0'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0'))
+ self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']))
+ self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label']))
+ self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label']))
+ self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label']))
self.display = vmConfig['platform'].get('display')
self.xauthority = vmConfig['platform'].get('xauthority')
@@ -401,6 +413,17 @@ class ImageHandler:
@@ -401,6 +414,17 @@ class ImageHandler:
return
if self.xenpaging_pid:
return
@ -53,7 +54,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
xenpaging_bin = auxbin.pathTo("xenpaging")
args = [xenpaging_bin]
args = args + ([ "%d" % self.vm.getDomid()])
@@ -434,6 +457,9 @@ class ImageHandler:
@@ -434,6 +458,9 @@ class ImageHandler:
except:
log.warn("chdir %s failed" % xenpaging_dir)
try:
@ -63,7 +64,7 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
log.info("starting %s" % args)
os.execve(xenpaging_bin, args, env)
except Exception, e:
@@ -449,10 +475,16 @@ class ImageHandler:
@@ -449,10 +476,16 @@ class ImageHandler:
self.xenpaging_pid = xenpaging_pid
os.close(null)
os.close(logfd)

View File

@ -1,36 +0,0 @@
Index: xen-4.0.1-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-4.0.1-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.0.1-testing/tools/python/xen/xend/image.py
@@ -123,18 +123,19 @@ class ImageHandler:
self.device_model = vmConfig['platform'].get('device_model')
self.xenpaging = vmConfig['platform'].get('xenpaging')
- self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])
- if self.xenpaging_delay == None:
- log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
- xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '7.0'))
- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1'))
- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5'))
- xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0'))
- self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']))
- self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label']))
- self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label']))
- self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label']))
+ if self.xenpaging:
+ self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])
+ if self.xenpaging_delay == None:
+ log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Mkdir("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay', '7.0'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_inc', '0.1'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_use', '5'))
+ xstransact.Store("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'], ('xenpaging_delay_used', '0'))
+ self.xenpaging_delay = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label']))
+ self.xenpaging_delay_inc = float(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_inc" % self.vm.info['name_label']))
+ self.xenpaging_delay_use = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_use" % self.vm.info['name_label']))
+ self.xenpaging_delay_used = int(xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay_used" % self.vm.info['name_label']))
self.display = vmConfig['platform'].get('display')
self.xauthority = vmConfig['platform'].get('xauthority')

View File

@ -65,7 +65,7 @@ v2:
}
set_p2m_entry(d, gfn, _mfn(INVALID_MFN), page_order, p2m_invalid);
}
@@ -2533,6 +2536,35 @@ int p2m_mem_paging_evict(struct domain *
@@ -2532,6 +2535,35 @@ int p2m_mem_paging_evict(struct domain *
return 0;
}
@ -101,13 +101,13 @@ v2:
void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
{
struct vcpu *v = current;
@@ -2597,17 +2629,20 @@ void p2m_mem_paging_resume(struct domain
@@ -2596,17 +2628,20 @@ void p2m_mem_paging_resume(struct domain
/* Pull the response off the ring */
mem_event_get_response(d, &rsp);
- /* Fix p2m entry */
- mfn = gfn_to_mfn(d, rsp.gfn, &p2mt);
- if (mfn_valid(mfn))
- if ( mfn_valid(mfn) )
+ if ( !( rsp.flags & MEM_EVENT_FLAG_DROP_PAGE ) )
{
- p2m_lock(d->arch.p2m);
@ -119,7 +119,7 @@ v2:
- mfn_x(mfn), rsp.gfn, p2mt, (unsigned long)rsp.flags);
+ /* Fix p2m entry */
+ mfn = gfn_to_mfn(d, rsp.gfn, &p2mt);
+ if (mfn_valid(mfn))
+ if ( mfn_valid(mfn) )
+ {
+ p2m_lock(d->arch.p2m);
+ set_p2m_entry(d, rsp.gfn, mfn, 0, p2m_ram_rw);

View File

@ -1,22 +1,24 @@
Subject: xenpaging: update machine_to_phys_mapping during page-in and page-out
Subject: xenpaging: update machine_to_phys_mapping during page-in and page deallocation
The machine_to_phys_mapping array needs updating during page-out.
If a page is gone, a call to get_gpfn_from_mfn will still return the old
gfn for an already paged-out page. This happens when the entire guest
ram is paged-out before xen_vga_populate_vram() runs. Then
XENMEM_populate_physmap is called with gfn 0xff000. A new page is
allocated with alloc_domheap_pages. This new page does not have a gfn
yet. However, in guest_physmap_add_entry() the passed mfn maps still to
an old gfn. This old gfn is paged-out and has no mfn anymore. As a
result, the ASSERT() triggers because p2m_is_ram() is true for
p2m_ram_paging* types.
The machine_to_phys_mapping array needs updating during page-in, and
during page deallocation. If a page is gone, a call to
get_gpfn_from_mfn will still return the old gfn for an already paged-out
page. This happens when the entire guest ram is paged-out before
xen_vga_populate_vram() runs. Then XENMEM_populate_physmap is called
with gfn 0xff000. A new page is allocated with alloc_domheap_pages.
This new page does not have a gfn yet. However, in
guest_physmap_add_entry() the passed mfn maps still to an old gfn
(perhaps from another old guest). This old gfn is in paged-out state in
this guests context and has no mfn anymore. As a result, the ASSERT()
triggers because p2m_is_ram() is true for p2m_ram_paging* types.
If the machine_to_phys_mapping array is updated properly, both loops in
guest_physmap_add_entry() turn into no-ops for the new page and the
mfn/gfn mapping will be done at the end of the function.
The same thing needs to happen dring a page-in, the current gfn must be
written for the page.
The same thing needs to happen dring a page-in.
If XENMEM_add_to_physmap is used with XENMAPSPACE_gmfn,
get_gpfn_from_mfn() will return an appearently valid gfn. As a result,
guest_physmap_remove_page() is called. The ASSERT in p2m_remove_page
@ -26,29 +28,25 @@ passed gfn.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
v3:
invalidate machine_to_phys_mapping[] during page deallocation
v2:
call set_gpfn_from_mfn only if mfn is valid
xen/arch/x86/mm/p2m.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
xen/arch/x86/mm/p2m.c | 13 ++++++++++---
xen/common/page_alloc.c | 9 +++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
--- xen-4.0.1-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.0.1-testing/xen/arch/x86/mm/p2m.c
@@ -2524,6 +2524,7 @@ int p2m_mem_paging_evict(struct domain *
/* Remove mapping from p2m table */
p2m_lock(d->arch.p2m);
set_p2m_entry(d, gfn, _mfn(PAGING_MFN), 0, p2m_ram_paged);
+ set_gpfn_from_mfn(mfn_x(mfn), INVALID_M2P_ENTRY);
p2m_unlock(d->arch.p2m);
/* Put the page back so it gets freed */
@@ -2598,9 +2599,16 @@ void p2m_mem_paging_resume(struct domain
@@ -2598,9 +2598,16 @@ void p2m_mem_paging_resume(struct domain
/* Fix p2m entry */
mfn = gfn_to_mfn(d, rsp.gfn, &p2mt);
- p2m_lock(d->arch.p2m);
- set_p2m_entry(d, rsp.gfn, mfn, 0, p2m_ram_rw);
- p2m_unlock(d->arch.p2m);
+ if (mfn_valid(mfn))
+ if ( mfn_valid(mfn) )
+ {
+ p2m_lock(d->arch.p2m);
+ set_p2m_entry(d, rsp.gfn, mfn, 0, p2m_ram_rw);
@ -61,3 +59,24 @@ v2:
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
--- xen-4.0.1-testing.orig/xen/common/page_alloc.c
+++ xen-4.0.1-testing/xen/common/page_alloc.c
@@ -1178,9 +1178,18 @@ void free_domheap_pages(struct page_info
{
int i, drop_dom_ref;
struct domain *d = page_get_owner(pg);
+ unsigned long mfn;
ASSERT(!in_irq());
+ /* this page is not a gfn anymore */
+ mfn = page_to_mfn(pg);
+ if ( mfn_valid(mfn) )
+ {
+ for ( i = 0; i < (1 << order); i++ )
+ set_gpfn_from_mfn(mfn + i, INVALID_M2P_ENTRY);
+ }
+
if ( unlikely(is_xen_heap_page(pg)) )
{
/* NB. May recursively lock from relinquish_memory(). */

View File

@ -0,0 +1,75 @@
Subject: xenpaging: handle temporary out-of-memory conditions during page-in
p2m_mem_paging_prep() should return -ENOMEM if a new page could not be
allocated. This can be handled in xenpaging to retry the page-in. Right
now such condition would stall the guest because the requested page will
not come back, xenpaging simply exits. So xenpaging could very well
retry the allocation forever to rescue the guest.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/xenpaging/xenpaging.c | 27 ++++++++++++++++++++-------
xen/arch/x86/mm/p2m.c | 2 +-
2 files changed, 21 insertions(+), 8 deletions(-)
--- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c
@@ -23,6 +23,7 @@
#include <inttypes.h>
#include <stdlib.h>
#include <signal.h>
+#include <unistd.h>
#include <xc_private.h>
#include <xen/mem_event.h>
@@ -409,19 +410,31 @@ static int xenpaging_populate_page(
unsigned long _gfn;
void *page;
int ret;
+ unsigned char oom = 0;
- /* Tell Xen to allocate a page for the domain */
- ret = xc_mem_paging_prep(paging->xc_handle, paging->mem_event.domain_id,
- *gfn);
- if ( ret != 0 )
+ _gfn = *gfn;
+ do
{
- ERROR("Error preparing for page in");
- goto out_map;
+ /* Tell Xen to allocate a page for the domain */
+ ret = xc_mem_paging_prep(paging->xc_handle, paging->mem_event.domain_id,
+ _gfn);
+ if ( ret != 0 )
+ {
+ if ( errno == ENOMEM )
+ {
+ if ( oom++ == 0 )
+ DPRINTF("ENOMEM while preparing gfn %lx\n", _gfn);
+ sleep(1);
+ continue;
+ }
+ ERROR("Error preparing for page in");
+ goto out_map;
+ }
}
+ while ( ret && !interrupted );
/* Map page */
ret = -EFAULT;
- _gfn = *gfn;
page = xc_map_foreign_pages(paging->xc_handle, paging->mem_event.domain_id,
PROT_READ | PROT_WRITE, &_gfn, 1);
*gfn = _gfn;
--- xen-4.0.1-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.0.1-testing/xen/arch/x86/mm/p2m.c
@@ -2614,7 +2614,7 @@ int p2m_mem_paging_prep(struct domain *d
/* Get a free page */
page = alloc_domheap_page(d, 0);
if ( unlikely(page == NULL) )
- return -EINVAL;
+ return -ENOMEM;
/* Fix p2m mapping */
p2m_lock(d->arch.p2m);

View File

@ -0,0 +1,22 @@
Subject: xenpaging: print xenpaging cmdline options
Print xenpaging arguments to simplify domain_id mapping from xenpaging
logfile to other logfiles and Xen console output.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/xenpaging/xenpaging.c | 2 ++
1 file changed, 2 insertions(+)
--- xen-4.0.1-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.1-testing/tools/xenpaging/xenpaging.c
@@ -538,6 +538,8 @@ int main(int argc, char *argv[])
return 1;
}
+ DPRINTF("starting %s %u %d\n", argv[0], domain_id, num_pages);
+
/* Open file */
sprintf(filename, "page_cache_%d", domain_id);
fd = open(filename, open_flags, open_mode);