Hello community,
here is the log from the commit of package xen for openSUSE:Factory checked in at 2017-11-30 12:41:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xen (Old)
and /work/SRC/openSUSE:Factory/.xen.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xen"
Thu Nov 30 12:41:28 2017 rev:237 rq:545274 version:4.10.0_03
Changes:
--------
--- /work/SRC/openSUSE:Factory/xen/xen.changes 2017-11-03 16:23:00.656227202 +0100
+++ /work/SRC/openSUSE:Factory/.xen.new/xen.changes 2017-11-30 12:41:33.874266405 +0100
@@ -1,0 +2,55 @@
+Fri Nov 24 17:28:59 UTC 2017 - carnold@suse.com
+
+- Update to Xen 4.10.0-rc6 (fate#321394, fate#322686)
+ xen-4.10.0-testing-src.tar.bz2
+
+-------------------------------------------------------------------
+Fri Nov 24 13:25:07 UTC 2017 - ohering@suse.de
+
+- Since xen switched to Kconfig, building a debug hypervisor
+ was done by default. Adjust make logic to build a non-debug
+ hypervisor by default, and continue to provide one as xen-dbg.gz
+
+-------------------------------------------------------------------
+Fri Nov 24 11:26:45 UTC 2017 - ohering@suse.de
+
+- fate#316614: set migration constraints from cmdline
+ fix libxl.set-migration-constraints-from-cmdline.patch for xen-4.10
+
+-------------------------------------------------------------------
+Thu Nov 23 15:06:44 UTC 2017 - ohering@suse.de
+
+- Document the suse-diskcache-disable-flush option in
+ xl-disk-configuration(5) (bsc#879425,bsc#1067317)
+
+-------------------------------------------------------------------
+Thu Nov 23 13:47:42 UTC 2017 - rbrown@suse.com
+
+- Replace references to /var/adm/fillup-templates with new
+ %_fillupdir macro (boo#1069468)
+
+-------------------------------------------------------------------
+Thu Nov 16 08:48:07 MST 2017 - carnold@suse.com
+
+- Update to Xen 4.10.0-rc5 (fate#321394, fate#322686)
+ xen-4.10.0-testing-src.tar.bz2
+- fate#323663 - Run Xenstore in stubdomain
+ xenstore-run-in-studomain.patch
+
+-------------------------------------------------------------------
+Thu Nov 9 15:11:57 MST 2017 - carnold@suse.com
+
+- bsc#1067224 - xen-tools have hard dependency on Python 2
+ pygrub-python3-conversion.patch
+ xenmon-python3-conversion.patch
+ migration-python3-conversion.patch
+ xnloader.py
+ xen2libvirt.py
+
+-------------------------------------------------------------------
+Wed Nov 8 10:47:24 UTC 2017 - ohering@suse.de
+
+- Remove xendriverdomain.service (bsc#1065185)
+ Driver domains must be configured manually with custom .service file
+
+-------------------------------------------------------------------
@@ -24,2 +78,0 @@
-- Drop until further notice
- libxl.set-migration-constraints-from-cmdline.patch
New:
----
libxl.set-migration-constraints-from-cmdline.patch
migration-python3-conversion.patch
pygrub-python3-conversion.patch
xenmon-python3-conversion.patch
xenstore-run-in-studomain.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xen.spec ++++++
--- /var/tmp/diff_new_pack.JSV8D9/_old 2017-11-30 12:41:36.366175804 +0100
+++ /var/tmp/diff_new_pack.JSV8D9/_new 2017-11-30 12:41:36.374175513 +0100
@@ -18,6 +18,11 @@
# needssslcertforbuild
+#Compat macro for new _fillupdir macro introduced in Nov 2017
+%if ! %{defined _fillupdir}
+ %define _fillupdir /var/adm/fillup-templates
+%endif
+
Name: xen
ExclusiveArch: %ix86 x86_64 %arm aarch64
%define changeset 35349
@@ -126,7 +131,7 @@
BuildRequires: pesign-obs-integration
%endif
-Version: 4.10.0_01
+Version: 4.10.0_03
Release: 0
Summary: Xen Virtualization: Hypervisor (aka VMM aka Microkernel)
License: GPL-2.0
@@ -190,6 +195,12 @@
Patch463: libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch
Patch464: libxl.pvscsi.patch
Patch465: xen.libxl.dmmd.patch
+Patch466: libxl.set-migration-constraints-from-cmdline.patch
+Patch467: xenstore-run-in-studomain.patch
+# python3 conversion patches
+Patch500: pygrub-python3-conversion.patch
+Patch501: xenmon-python3-conversion.patch
+Patch502: migration-python3-conversion.patch
# Hypervisor and PV driver Patches
Patch601: x86-ioapic-ack-default.patch
Patch602: x86-cpufreq-report.patch
@@ -371,6 +382,12 @@
%patch463 -p1
%patch464 -p1
%patch465 -p1
+%patch466 -p1
+%patch467 -p1
+# python3 conversion patches
+%patch500 -p1
+%patch501 -p1
+%patch502 -p1
# Hypervisor and PV driver Patches
%patch601 -p1
%patch602 -p1
@@ -444,6 +461,8 @@
%if %{with xen_stubdom}
configure_flags=--enable-stubdom
%else
+# pick the default during a fresh install
+sed -i~ '/^XENSTORETYPE=domain/d' tools/hotplug/Linux/init.d/sysconfig.xencommons.in
configure_flags=--disable-stubdom
%endif
configure_flags="${configure_flags} --disable-qemu-traditional"
@@ -486,11 +505,11 @@
# tools
make \
DESTDIR=$RPM_BUILD_ROOT \
- SYSCONFIG_DIR=/var/adm/fillup-templates \
+ SYSCONFIG_DIR=%{_fillupdir} \
%{?_smp_mflags} \
install
find $RPM_BUILD_ROOT -ls
-for i in $RPM_BUILD_ROOT/var/adm/fillup-templates/*
+for i in $RPM_BUILD_ROOT%{_fillupdir}/*
do
mv -v $i ${i%/*}/sysconfig.${i##*/}
done
@@ -597,12 +616,17 @@
%if %{?with_gcc48}0
CC=gcc-4.8
%endif
+rm -fv xen/.config
%if %{with xen_debug}
-make -C xen install debug=y DEBUG_DIR=/boot DESTDIR=$RPM_BUILD_ROOT CC=$CC %{?_smp_mflags}
+echo CONFIG_DEBUG=y > xen/.config
+yes '' | make -C xen oldconfig
+make -C xen install DEBUG_DIR=/boot DESTDIR=$RPM_BUILD_ROOT CC=$CC %{?_smp_mflags}
install_xen dbg
make -C xen clean
%endif
-make -C xen install debug=n DEBUG_DIR=/boot DESTDIR=$RPM_BUILD_ROOT CC=$CC %{?_smp_mflags}
+echo CONFIG_DEBUG=n > xen/.config
+yes '' | make -C xen oldconfig
+make -C xen install DEBUG_DIR=/boot DESTDIR=$RPM_BUILD_ROOT CC=$CC %{?_smp_mflags}
install_xen
make -C xen clean
echo > xen.files.txt
@@ -702,7 +726,7 @@
echo "ExecStart=-/bin/sh -c 'modprobe $mod || :'" >> $RPM_BUILD_ROOT%{_unitdir}/${bn}
done
rm -rfv $RPM_BUILD_ROOT%{_initddir}
-install -m644 %SOURCE35 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.pciback
+install -m644 %SOURCE35 $RPM_BUILD_ROOT%{_fillupdir}/sysconfig.pciback
# Clean up unpackaged files
find $RPM_BUILD_ROOT \( \
@@ -733,6 +757,9 @@
:
fi
+# "xl devd" has to be called manually in a driver domain
+find $RPM_BUILD_ROOT -name xendriverdomain.service -print -delete
+
# Create symlinks for keymaps
%fdupes -s $RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -size 0 -delete
@@ -747,6 +774,7 @@
rm -rf $RPM_BUILD_ROOT/%{_libdir}/python*
rm -rf $RPM_BUILD_ROOT/%{_libdir}/ocaml*
rm -rf $RPM_BUILD_ROOT%{_unitdir}
+rm -rf $RPM_BUILD_ROOT%{_fillupdir}
rm -rf $RPM_BUILD_ROOT%{with_systemd_modules_load}
rm -rf $RPM_BUILD_ROOT/usr/sbin
rm -rf $RPM_BUILD_ROOT/etc/xen
@@ -855,9 +883,9 @@
%dir /usr/lib/supportconfig/plugins
/usr/lib/supportconfig/plugins/xen
%{_libexecdir}/xen
-/var/adm/fillup-templates/sysconfig.pciback
-/var/adm/fillup-templates/sysconfig.xencommons
-/var/adm/fillup-templates/sysconfig.xendomains
+%{_fillupdir}/sysconfig.pciback
+%{_fillupdir}/sysconfig.xencommons
+%{_fillupdir}/sysconfig.xendomains
%dir /var/lib/xen
%dir %attr(700,root,root) /var/lib/xen/images
%dir %attr(700,root,root) /var/lib/xen/save
@@ -1019,7 +1047,6 @@
%service_add_pre xenconsoled.service
%service_add_pre xen-init-dom0.service
%service_add_pre xen-qemu-dom0-disk-backend.service
-%service_add_pre xendriverdomain.service
%post tools
xen_tools_first_arg=$1
@@ -1033,7 +1060,6 @@
%service_add_post xenconsoled.service
%service_add_post xen-init-dom0.service
%service_add_post xen-qemu-dom0-disk-backend.service
-%service_add_post xendriverdomain.service
if [ -f /usr/bin/qemu-img ]; then
if [ -f /usr/bin/qemu-img-xen ]; then
@@ -1069,7 +1095,6 @@
%service_del_preun xenconsoled.service
%service_del_preun xen-init-dom0.service
%service_del_preun xen-qemu-dom0-disk-backend.service
-%service_del_preun xendriverdomain.service
%postun tools
export DISABLE_RESTART_ON_UPDATE=yes
@@ -1081,7 +1106,6 @@
%service_del_postun xenconsoled.service
%service_del_postun xen-init-dom0.service
%service_del_postun xen-qemu-dom0-disk-backend.service
-%service_del_postun xendriverdomain.service
%endif
++++++ aarch64-rename-PSR_MODE_ELxx-to-match-linux-headers.patch ++++++
--- /var/tmp/diff_new_pack.JSV8D9/_old 2017-11-30 12:41:36.446172895 +0100
+++ /var/tmp/diff_new_pack.JSV8D9/_new 2017-11-30 12:41:36.446172895 +0100
@@ -10,11 +10,11 @@
xen/include/public/arch-arm.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
-Index: xen-4.7.0-testing/xen/include/public/arch-arm.h
+Index: xen-4.10.0-testing/xen/include/public/arch-arm.h
===================================================================
---- xen-4.7.0-testing.orig/xen/include/public/arch-arm.h
-+++ xen-4.7.0-testing/xen/include/public/arch-arm.h
-@@ -362,13 +362,13 @@ typedef uint64_t xen_callback_t;
+--- xen-4.10.0-testing.orig/xen/include/public/arch-arm.h
++++ xen-4.10.0-testing/xen/include/public/arch-arm.h
+@@ -363,13 +363,13 @@ typedef uint64_t xen_callback_t;
/* 64 bit modes */
#define PSR_MODE_BIT 0x10 /* Set iff AArch32 */
++++++ libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch ++++++
--- /var/tmp/diff_new_pack.JSV8D9/_old 2017-11-30 12:41:36.602167223 +0100
+++ /var/tmp/diff_new_pack.JSV8D9/_new 2017-11-30 12:41:36.602167223 +0100
@@ -81,3 +81,40 @@
/* the target magic parameter, eats the rest of the string */
+Index: xen-4.10.0-testing/docs/man/xl-disk-configuration.pod.5
+===================================================================
+--- xen-4.10.0-testing.orig/docs/man/xl-disk-configuration.pod.5
++++ xen-4.10.0-testing/docs/man/xl-disk-configuration.pod.5
+@@ -344,6 +344,32 @@ can be used to disable "hole punching" f
+ were intentionally created non-sparse to avoid fragmentation of the
+ file.
+
++=item B<suse-diskcache-disable-flush>
++
++=over 4
++
++=item Description
++
++Request that the qemu block driver does not automatically flush written data to the backend storage.
++
++=item Supported values
++
++absent, present
++
++=item Mandatory
++
++No
++
++=item Default value
++
++absent
++
++=back
++
++This enables the '-disk cache=unsafe' mode inside qemu.
++In this mode writes to the underlying blockdevice are delayed.
++While using this option in production is dangerous, it improves performance during installation of a domU.
++
+ =back
+
+
++++++ libxl.set-migration-constraints-from-cmdline.patch ++++++
From 77deb80879859ed279e24a790ec08e9c5d37dd0e Mon Sep 17 00:00:00 2001
From: Olaf Hering
Date: Wed, 5 Feb 2014 14:37:53 +0100
Subject: libxl: set migration constraints from cmdline
Add new options to xl migrate to control the process of migration.
The intention is to optionally abort the migration if it takes too long
to migrate a busy guest due to the high number of new dirty pages.
Currently the guest is suspended to transfer the remaining dirty pages.
The suspend/resume cycle will cause a time jump. This transfer can take
a long time, which can confuse the guest if the time jump is too far.
The new options allow to override the built-in default values, which are
not changed by this patch.
--max_iters <number> Number of iterations before final suspend (default: 30)
--max_factor <factor> Max amount of memory to transfer before final suspend (default: 3*RAM)
--min_remaing <pages> Number of dirty pages before stop© (default: 50)
--abort_if_busy Abort migration instead of doing final suspend.
The changes to libxl change the API, handle LIBXL_API_VERSION == 0x040200.
v8:
- merge --min_remaing changes
- tools/libxc: print stats if migration is aborted
- use special _suse version of lib calls to preserve ABI
v7:
- remove short options
- update description of --abort_if_busy in xl.1
- extend description of --abort_if_busy in xl help
- add comment to libxl_domain_suspend declaration, props is optional
v6:
- update the LIBXL_API_VERSION handling for libxl_domain_suspend
change it to an inline function if LIBXL_API_VERSION is defined to 4.2.0
- rename libxl_save_properties to libxl_domain_suspend_properties
- rename ->xlflags to ->flags within that struct
v5:
- adjust libxl_domain_suspend prototype, move flags, max_iters,
max_factor into a new, optional struct libxl_save_properties
- rename XCFLAGS_DOMSAVE_NOSUSPEND to XCFLAGS_DOMSAVE_ABORT_IF_BUSY
- rename LIBXL_SUSPEND_NO_FINAL_SUSPEND to LIBXL_SUSPEND_ABORT_IF_BUSY
- rename variables no_suspend to abort_if_busy
- rename option -N/--no_suspend to -A/--abort_if_busy
- update xl.1, extend description of -A option
v4:
- update default for no_suspend from None to 0 in XendCheckpoint.py:save
- update logoutput in setMigrateConstraints
- change xm migrate defaults from None to 0
- add new options to xl.1
- fix syntax error in XendDomain.py:domain_migrate_constraints_set
- fix xm migrate -N option name to match xl migrate
v3:
- move logic errors in libxl__domain_suspend and fixed help text in
cmd_table to separate patches
- fix syntax error in XendCheckpoint.py
- really pass max_iters and max_factor in libxl__xc_domain_save
- make libxl_domain_suspend_0x040200 declaration globally visible
- bump libxenlight.so SONAME from 2.0 to 2.1 due to changed
libxl_domain_suspend
v2:
- use LIBXL_API_VERSION and define libxl_domain_suspend_0x040200
- fix logic error in min_reached check in xc_domain_save
- add longopts
- update --help text
- correct description of migrate --help text
Signed-off-by: Olaf Hering
---
docs/man/xl.pod.1 | 20 +++++++++++++++++++
tools/libxc/include/xenguest.h | 7 ++++++
tools/libxc/xc_nomigrate.c | 10 +++++++++
tools/libxc/xc_sr_common.h | 1
tools/libxc/xc_sr_save.c | 22 +++++++++++++++------
tools/libxl/libxl.c | 29 ++++++++++++++++++++++++----
tools/libxl/libxl.h | 15 ++++++++++++++
tools/libxl/libxl_dom_save.c | 1
tools/libxl/libxl_internal.h | 4 +++
tools/libxl/libxl_save_callout.c | 4 ++-
tools/libxl/libxl_save_helper.c | 8 ++++---
tools/libxl/xl_cmdimpl.c | 40 +++++++++++++++++++++++++++++++++------
tools/libxl/xl_cmdtable.c | 23 ++++++++++++++--------
13 files changed, 156 insertions(+), 28 deletions(-)
Index: xen-4.10.0-testing/docs/man/xl.pod.1.in
===================================================================
--- xen-4.10.0-testing.orig/docs/man/xl.pod.1.in
+++ xen-4.10.0-testing/docs/man/xl.pod.1.in
@@ -459,6 +459,26 @@ Display huge (!) amount of debug informa
Leave the domain on the receive side paused after migration.
+=item B<--max_iters> I<number>
+
+Number of iterations before final suspend (default: 30)
+
+=item B<--max_factor> I<factor>
+
+Max amount of memory to transfer before final suspend (default: 3*RAM)
+
+=item B<--min_remaining>
+
+Number of remaining dirty pages. If the number of dirty pages drops that
+low the guest is suspended and the remaing pages are transfered to <host>.
+
+=item B<--abort_if_busy>
+
+Abort migration instead of doing final suspend/transfer/resume if the
+guest has still dirty pages after the number of iterations and/or the
+amount of RAM transferred. This avoids long periods of time where the
+guest is suspended.
+
=back
=item B<remus> [I<OPTIONS>] I<domain-id> I<host>
Index: xen-4.10.0-testing/tools/libxc/include/xenguest.h
===================================================================
--- xen-4.10.0-testing.orig/tools/libxc/include/xenguest.h
+++ xen-4.10.0-testing/tools/libxc/include/xenguest.h
@@ -29,6 +29,7 @@
#define XCFLAGS_HVM (1 << 2)
#define XCFLAGS_STDVGA (1 << 3)
#define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4)
+#define XCFLAGS_DOMSAVE_ABORT_IF_BUSY (1 << 5)
#define X86_64_B_SIZE 64
#define X86_32_B_SIZE 32
@@ -131,10 +132,20 @@ typedef enum {
* doesn't use checkpointing
* @return 0 on success, -1 on failure
*/
+int xc_domain_save_suse(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
+ uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
+ uint32_t min_remaining,
+ struct save_callbacks* callbacks, int hvm,
+ xc_migration_stream_t stream_type, int recv_fd);
+static inline
int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
uint32_t flags /* XCFLAGS_xxx */,
struct save_callbacks* callbacks, int hvm,
- xc_migration_stream_t stream_type, int recv_fd);
+ xc_migration_stream_t stream_type, int recv_fd)
+{
+ return xc_domain_save_suse(xch,io_fd,dom,0,0,flags,0,callbacks,hvm,stream_type,recv_fd);
+}
+
/* callbacks provided by xc_domain_restore */
struct restore_callbacks {
Index: xen-4.10.0-testing/tools/libxc/xc_nomigrate.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxc/xc_nomigrate.c
+++ xen-4.10.0-testing/tools/libxc/xc_nomigrate.c
@@ -20,9 +20,11 @@
#include
#include
-int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t flags,
- struct save_callbacks* callbacks, int hvm,
- xc_migration_stream_t stream_type, int recv_fd)
+int xc_domain_save_suse(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iters,
+ uint32_t max_factor, uint32_t flags,
+ uint32_t min_remaining,
+ struct save_callbacks* callbacks, int hvm,
+ xc_migration_stream_t stream_type, int recv_fd)
{
errno = ENOSYS;
return -1;
Index: xen-4.10.0-testing/tools/libxc/xc_sr_save.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxc/xc_sr_save.c
+++ xen-4.10.0-testing/tools/libxc/xc_sr_save.c
@@ -525,6 +525,11 @@ static int send_memory_live(struct xc_sr
policy_decision = precopy_policy(*policy_stats, data);
x++;
+ if ( policy_decision == XGS_POLICY_ABORT )
+ {
+ rc = -1;
+ break;
+ }
if ( stats.dirty_count > 0 && policy_decision != XGS_POLICY_ABORT )
{
rc = update_progress_string(ctx, &progress_str);
@@ -545,6 +550,11 @@ static int send_memory_live(struct xc_sr
policy_decision = precopy_policy(*policy_stats, data);
+ if ( policy_decision == XGS_POLICY_ABORT )
+ {
+ rc = -1;
+ break;
+ }
if ( policy_decision != XGS_POLICY_CONTINUE_PRECOPY )
break;
@@ -965,9 +975,71 @@ static int save(struct xc_sr_context *ct
return rc;
};
-int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom,
- uint32_t flags, struct save_callbacks* callbacks,
- int hvm, xc_migration_stream_t stream_type, int recv_fd)
+static struct suse_flags {
+ struct xc_sr_context *ctx;
+ unsigned long cnt;
+ uint32_t max_iters;
+ unsigned long max_factor;
+ long min_remaining;
+ long dirty_count;
+ uint32_t abort_if_busy;
+} suse_flags;
+
+static int suse_precopy_policy(struct precopy_stats stats, void *user)
+{
+ xc_interface *xch = suse_flags.ctx->xch;
+
+ suse_flags.cnt++;
+ errno = 0;
+ DBGPRINTF("%s: domU %u: #%lu iteration %u total_written %u dirty_count %ld",
+ __func__, suse_flags.ctx->domid, suse_flags.cnt, stats.iteration, stats.total_written, stats.dirty_count);
+
+ if ( stats.dirty_count >= 0 )
+ suse_flags.dirty_count = stats.dirty_count;
+
+ /* Stop loop after N iterations */
+ if ( stats.iteration > suse_flags.max_iters )
+ {
+ IPRINTF("%s: domU %u, too many iterations (%u/%u)",
+ __func__, suse_flags.ctx->domid, stats.iteration, suse_flags.max_iters);
+ goto out;
+ }
+ /* Suspend domU in case only few dirty pages remain */
+ if ( stats.dirty_count >= 0 && stats.dirty_count < suse_flags.min_remaining )
+ {
+ IPRINTF("%s: domU %u, dirty_count reached (%ld/%ld)",
+ __func__, suse_flags.ctx->domid, stats.dirty_count, suse_flags.min_remaining);
+ goto suspend;
+ }
+ /* Stop loop if too much memory was transfered (formula incorrect for ballooned domU) */
+ if ( stats.total_written > suse_flags.max_factor * suse_flags.ctx->save.p2m_size )
+ {
+ IPRINTF("%s: domU %u, too much memory transfered (%u/%lu)",
+ __func__, suse_flags.ctx->domid, stats.total_written, suse_flags.max_factor * suse_flags.ctx->save.p2m_size);
+ goto out;
+ }
+ /* Keep going */
+ return XGS_POLICY_CONTINUE_PRECOPY;
+
+out:
+ if ( suse_flags.abort_if_busy )
+ {
+ errno = EBUSY;
+ PERROR("%s: domU %u busy, dirty pages %ld/%lu after %u iterations, %u pages transfered",
+ __func__, suse_flags.ctx->domid,
+ suse_flags.dirty_count, suse_flags.ctx->save.p2m_size,
+ stats.iteration, stats.total_written);
+ return XGS_POLICY_ABORT;
+ }
+suspend:
+ return XGS_POLICY_STOP_AND_COPY;
+}
+
+int xc_domain_save_suse(xc_interface *xch, int io_fd, uint32_t dom,
+ uint32_t max_iters, uint32_t max_factor, uint32_t flags,
+ uint32_t min_remaining,
+ struct save_callbacks* callbacks, int hvm,
+ xc_migration_stream_t stream_type, int recv_fd)
{
struct xc_sr_context ctx =
{
@@ -982,6 +1054,19 @@ int xc_domain_save(xc_interface *xch, in
ctx.save.checkpointed = stream_type;
ctx.save.recv_fd = recv_fd;
+ if ( callbacks->precopy_policy )
+ {
+ errno = EBUSY;
+ PERROR("%s: precopy_policy already set (%p)", __func__, callbacks->precopy_policy);
+ return -1;
+ }
+ callbacks->precopy_policy = suse_precopy_policy;
+ suse_flags.ctx = &ctx;
+ suse_flags.max_iters = max_iters ? : 5;
+ suse_flags.max_factor = max_factor ? : 3;
+ suse_flags.min_remaining = min_remaining ? : 50;
+ suse_flags.abort_if_busy = !!(flags & XCFLAGS_DOMSAVE_ABORT_IF_BUSY);
+
/* If altering migration_stream update this assert too. */
assert(stream_type == XC_MIG_STREAM_NONE ||
stream_type == XC_MIG_STREAM_REMUS ||
Index: xen-4.10.0-testing/tools/libxl/libxl.h
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl.h
+++ xen-4.10.0-testing/tools/libxl/libxl.h
@@ -1467,8 +1467,23 @@ int libxl_domain_suspend(libxl_ctx *ctx,
int flags, /* LIBXL_SUSPEND_* */
const libxl_asyncop_how *ao_how)
LIBXL_EXTERNAL_CALLERS_ONLY;
+
+typedef struct {
+ int flags; /* LIBXL_SUSPEND_* */
+ int max_iters;
+ int max_factor;
+ int min_remaining;
+} libxl_domain_suspend_suse_properties;
+
+#define LIBXL_HAVE_DOMAIN_SUSPEND_SUSE
+int libxl_domain_suspend_suse(libxl_ctx *ctx, uint32_t domid, int fd,
+ const libxl_domain_suspend_suse_properties *props, /* optional */
+ const libxl_asyncop_how *ao_how)
+ LIBXL_EXTERNAL_CALLERS_ONLY;
+
#define LIBXL_SUSPEND_DEBUG 1
#define LIBXL_SUSPEND_LIVE 2
+#define LIBXL_SUSPEND_ABORT_IF_BUSY 4
/* @param suspend_cancel [from xenctrl.h:xc_domain_resume( @param fast )]
* If this parameter is true, use co-operative resume. The guest
Index: xen-4.10.0-testing/tools/libxl/libxl_dom_save.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl_dom_save.c
+++ xen-4.10.0-testing/tools/libxl/libxl_dom_save.c
@@ -379,6 +379,7 @@ void libxl__domain_save(libxl__egc *egc,
dss->xcflags = (live ? XCFLAGS_LIVE : 0)
| (debug ? XCFLAGS_DEBUG : 0)
+ | (dss->xlflags & LIBXL_SUSPEND_ABORT_IF_BUSY ? XCFLAGS_DOMSAVE_ABORT_IF_BUSY : 0)
| (dss->hvm ? XCFLAGS_HVM : 0);
/* Disallow saving a guest with vNUMA configured because migration
Index: xen-4.10.0-testing/tools/libxl/libxl_domain.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl_domain.c
+++ xen-4.10.0-testing/tools/libxl/libxl_domain.c
@@ -486,8 +486,9 @@ static void domain_suspend_cb(libxl__egc
}
-int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags,
- const libxl_asyncop_how *ao_how)
+static int do_libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd,
+ const libxl_domain_suspend_suse_properties *props,
+ const libxl_asyncop_how *ao_how)
{
AO_CREATE(ctx, domid, ao_how);
int rc;
@@ -507,9 +508,15 @@ int libxl_domain_suspend(libxl_ctx *ctx,
dss->domid = domid;
dss->fd = fd;
dss->type = type;
- dss->live = flags & LIBXL_SUSPEND_LIVE;
- dss->debug = flags & LIBXL_SUSPEND_DEBUG;
dss->checkpointed_stream = LIBXL_CHECKPOINTED_STREAM_NONE;
+ if (props) {
+ dss->live = props->flags & LIBXL_SUSPEND_LIVE;
+ dss->debug = props->flags & LIBXL_SUSPEND_DEBUG;
+ dss->max_iters = props->max_iters;
+ dss->max_factor = props->max_factor;
+ dss->min_remaining = props->min_remaining;
+ dss->xlflags = props->flags;
+ }
rc = libxl__fd_flags_modify_save(gc, dss->fd,
~(O_NONBLOCK|O_NDELAY), 0,
@@ -523,6 +530,20 @@ int libxl_domain_suspend(libxl_ctx *ctx,
return AO_CREATE_FAIL(rc);
}
+int libxl_domain_suspend_suse(libxl_ctx *ctx, uint32_t domid, int fd,
+ const libxl_domain_suspend_suse_properties *props,
+ const libxl_asyncop_how *ao_how)
+{
+ return do_libxl_domain_suspend(ctx, domid, fd, props, ao_how);
+}
+
+int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags,
+ const libxl_asyncop_how *ao_how)
+{
+ libxl_domain_suspend_suse_properties props = { .flags = flags };
+ return do_libxl_domain_suspend(ctx, domid, fd, &props, ao_how);
+}
+
int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid)
{
int ret;
Index: xen-4.10.0-testing/tools/libxl/libxl_internal.h
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl_internal.h
+++ xen-4.10.0-testing/tools/libxl/libxl_internal.h
@@ -3293,6 +3293,10 @@ struct libxl__domain_save_state {
/* private */
int rc;
int hvm;
+ int max_iters;
+ int max_factor;
+ int min_remaining;
+ int xlflags;
int xcflags;
libxl__domain_suspend_state dsps;
union {
Index: xen-4.10.0-testing/tools/libxl/libxl_save_callout.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl_save_callout.c
+++ xen-4.10.0-testing/tools/libxl/libxl_save_callout.c
@@ -89,7 +89,9 @@ void libxl__xc_domain_save(libxl__egc *e
libxl__srm_callout_enumcallbacks_save(&shs->callbacks.save.a);
const unsigned long argnums[] = {
- dss->domid, dss->xcflags, dss->hvm, cbflags,
+ dss->domid,
+ dss->max_iters, dss->max_factor, dss->min_remaining,
+ dss->xcflags, dss->hvm, cbflags,
dss->checkpointed_stream,
};
Index: xen-4.10.0-testing/tools/libxl/libxl_save_helper.c
===================================================================
--- xen-4.10.0-testing.orig/tools/libxl/libxl_save_helper.c
+++ xen-4.10.0-testing/tools/libxl/libxl_save_helper.c
@@ -251,6 +251,9 @@ int main(int argc, char **argv)
io_fd = atoi(NEXTARG);
recv_fd = atoi(NEXTARG);
uint32_t dom = strtoul(NEXTARG,0,10);
+ uint32_t max_iters = strtoul(NEXTARG,0,10);
+ uint32_t max_factor = strtoul(NEXTARG,0,10);
+ uint32_t min_remaining = strtoul(NEXTARG,0,10);
uint32_t flags = strtoul(NEXTARG,0,10);
int hvm = atoi(NEXTARG);
unsigned cbflags = strtoul(NEXTARG,0,10);
@@ -262,8 +265,10 @@ int main(int argc, char **argv)
startup("save");
setup_signals(save_signal_handler);
- r = xc_domain_save(xch, io_fd, dom, flags, &helper_save_callbacks,
- hvm, stream_type, recv_fd);
+ r = xc_domain_save_suse(xch, io_fd, dom, max_iters, max_factor, flags,
+ min_remaining,
+ &helper_save_callbacks, hvm, stream_type,
+ recv_fd);
complete(r);
} else if (!strcmp(mode,"--restore-domain")) {
Index: xen-4.10.0-testing/tools/xl/xl_cmdtable.c
===================================================================
--- xen-4.10.0-testing.orig/tools/xl/xl_cmdtable.c
+++ xen-4.10.0-testing/tools/xl/xl_cmdtable.c
@@ -157,15 +157,22 @@ struct cmd_spec cmd_table[] = {
&main_migrate, 0, 1,
"Migrate a domain to another host",
"[options] <Domain> <host>",
- "-h Print this help.\n"
- "-C <config> Send <config> instead of config file from creation.\n"
- "-s <sshcommand> Use <sshcommand> instead of ssh. String will be passed\n"
- " to sh. If empty, run <host> instead of ssh <host> xl\n"
- " migrate-receive [-d -e]\n"
- "-e Do not wait in the background (on <host>) for the death\n"
- " of the domain.\n"
- "--debug Print huge (!) amount of debug during the migration process.\n"
- "-p Do not unpause domain after migrating it."
+ "-h Print this help.\n"
+ "-C <config> Send <config> instead of config file from creation.\n"
+ "-s <sshcommand> Use <sshcommand> instead of ssh. String will be passed\n"
+ " to sh. If empty, run <host> instead of ssh <host> xl\n"
+ " migrate-receive [-d -e]\n"
+ "-e Do not wait in the background (on <host>) for the death\n"
+ " of the domain.\n"
+ "--debug Print huge (!) amount of debug during the migration process.\n"
+ "-p Do not unpause domain after migrating it.\n"
+ "\n"
+ "SUSE Linux specific options:\n"
+ "--max_iters <number> Number of iterations before final suspend (default: 30)\n"
+ "--max_factor <factor> Max amount of memory to transfer before final suspend (default: 3*RAM).\n"
+ "--min_remaining <pages> Number of remaining dirty pages before final suspend (default: 50).\n"
+ "--abort_if_busy Abort migration instead of doing final suspend, if number\n"
+ " of iterations or amount of transfered memory is exceeded."
},
{ "restore",
&main_restore, 0, 1,
Index: xen-4.10.0-testing/tools/xl/xl_migrate.c
===================================================================
--- xen-4.10.0-testing.orig/tools/xl/xl_migrate.c
+++ xen-4.10.0-testing/tools/xl/xl_migrate.c
@@ -177,6 +177,8 @@ static void migrate_do_preamble(int send
}
static void migrate_domain(uint32_t domid, const char *rune, int debug,
+ int max_iters, int max_factor,
+ int min_remaining, int abort_if_busy,
const char *override_config_file)
{
pid_t child = -1;
@@ -185,7 +187,13 @@ static void migrate_domain(uint32_t domi
char *away_domname;
char rc_buf;
uint8_t *config_data;
- int config_len, flags = LIBXL_SUSPEND_LIVE;
+ int config_len;
+ libxl_domain_suspend_suse_properties props = {
+ .flags = LIBXL_SUSPEND_LIVE,
+ .max_iters = max_iters,
+ .max_factor = max_factor,
+ .min_remaining = min_remaining,
+ };
save_domain_core_begin(domid, override_config_file,
&config_data, &config_len);
@@ -204,10 +212,12 @@ static void migrate_domain(uint32_t domi
xtl_stdiostream_adjust_flags(logger, XTL_STDIOSTREAM_HIDE_PROGRESS, 0);
if (debug)
- flags |= LIBXL_SUSPEND_DEBUG;
- rc = libxl_domain_suspend(ctx, domid, send_fd, flags, NULL);
+ props.flags |= LIBXL_SUSPEND_DEBUG;
+ if (abort_if_busy)
+ props.flags |= LIBXL_SUSPEND_ABORT_IF_BUSY;
+ rc = libxl_domain_suspend_suse(ctx, domid, send_fd, &props, NULL);
if (rc) {
- fprintf(stderr, "migration sender: libxl_domain_suspend failed"
+ fprintf(stderr, "migration sender: libxl_domain_suspend_suse failed"
" (rc=%d)\n", rc);
if (rc == ERROR_GUEST_TIMEDOUT)
goto failed_suspend;
@@ -537,13 +547,18 @@ int main_migrate(int argc, char **argv)
char *rune = NULL;
char *host;
int opt, daemonize = 1, monitor = 1, debug = 0, pause_after_migration = 0;
+ int max_iters = 0, max_factor = 0, min_remaining = 0, abort_if_busy = 0;
static struct option opts[] = {
{"debug", 0, 0, 0x100},
+ {"max_iters", 1, 0, 0x101},
+ {"max_factor", 1, 0, 0x102},
+ {"min_remaining", 1, 0, 0x103},
+ {"abort_if_busy", 0, 0, 0x104},
{"live", 0, 0, 0x200},
COMMON_LONG_OPTS
};
- SWITCH_FOREACH_OPT(opt, "FC:s:ep", opts, "migrate", 2) {
+ SWITCH_FOREACH_OPT(opt, "FC:s:epM:m:A", opts, "migrate", 2) {
case 'C':
config_filename = optarg;
break;
@@ -563,6 +578,18 @@ int main_migrate(int argc, char **argv)
case 0x100: /* --debug */
debug = 1;
break;
+ case 0x101:
+ max_iters = atoi(optarg);
+ break;
+ case 0x102:
+ max_factor = atoi(optarg);
+ break;
+ case 0x103:
+ min_remaining = atoi(optarg);
+ break;
+ case 0x104:
+ abort_if_busy = 1;
+ break;
case 0x200: /* --live */
/* ignored for compatibility with xm */
break;
@@ -596,7 +623,8 @@ int main_migrate(int argc, char **argv)
pause_after_migration ? " -p" : "");
}
- migrate_domain(domid, rune, debug, config_filename);
+ migrate_domain(domid, rune, debug, max_iters, max_factor, min_remaining,
+ abort_if_busy, config_filename);
return EXIT_SUCCESS;
}
++++++ migration-python3-conversion.patch ++++++
Index: xen-4.10.0-testing/tools/python/xen/migration/libxc.py
===================================================================
--- xen-4.10.0-testing.orig/tools/python/xen/migration/libxc.py
+++ xen-4.10.0-testing/tools/python/xen/migration/libxc.py
@@ -87,23 +87,23 @@ rec_type_to_str = {
# page_data
PAGE_DATA_FORMAT = "II"
-PAGE_DATA_PFN_MASK = (long(1) << 52) - 1
-PAGE_DATA_PFN_RESZ_MASK = ((long(1) << 60) - 1) & ~((long(1) << 52) - 1)
+PAGE_DATA_PFN_MASK = (int(1) << 52) - 1
+PAGE_DATA_PFN_RESZ_MASK = ((int(1) << 60) - 1) & ~((int(1) << 52) - 1)
# flags from xen/public/domctl.h: XEN_DOMCTL_PFINFO_* shifted by 32 bits
PAGE_DATA_TYPE_SHIFT = 60
-PAGE_DATA_TYPE_LTABTYPE_MASK = (long(0x7) << PAGE_DATA_TYPE_SHIFT)
-PAGE_DATA_TYPE_LTAB_MASK = (long(0xf) << PAGE_DATA_TYPE_SHIFT)
-PAGE_DATA_TYPE_LPINTAB = (long(0x8) << PAGE_DATA_TYPE_SHIFT) # Pinned pagetable
+PAGE_DATA_TYPE_LTABTYPE_MASK = (int(0x7) << PAGE_DATA_TYPE_SHIFT)
+PAGE_DATA_TYPE_LTAB_MASK = (int(0xf) << PAGE_DATA_TYPE_SHIFT)
+PAGE_DATA_TYPE_LPINTAB = (int(0x8) << PAGE_DATA_TYPE_SHIFT) # Pinned pagetable
-PAGE_DATA_TYPE_NOTAB = (long(0x0) << PAGE_DATA_TYPE_SHIFT) # Regular page
-PAGE_DATA_TYPE_L1TAB = (long(0x1) << PAGE_DATA_TYPE_SHIFT) # L1 pagetable
-PAGE_DATA_TYPE_L2TAB = (long(0x2) << PAGE_DATA_TYPE_SHIFT) # L2 pagetable
-PAGE_DATA_TYPE_L3TAB = (long(0x3) << PAGE_DATA_TYPE_SHIFT) # L3 pagetable
-PAGE_DATA_TYPE_L4TAB = (long(0x4) << PAGE_DATA_TYPE_SHIFT) # L4 pagetable
-PAGE_DATA_TYPE_BROKEN = (long(0xd) << PAGE_DATA_TYPE_SHIFT) # Broken
-PAGE_DATA_TYPE_XALLOC = (long(0xe) << PAGE_DATA_TYPE_SHIFT) # Allocate-only
-PAGE_DATA_TYPE_XTAB = (long(0xf) << PAGE_DATA_TYPE_SHIFT) # Invalid
+PAGE_DATA_TYPE_NOTAB = (int(0x0) << PAGE_DATA_TYPE_SHIFT) # Regular page
+PAGE_DATA_TYPE_L1TAB = (int(0x1) << PAGE_DATA_TYPE_SHIFT) # L1 pagetable
+PAGE_DATA_TYPE_L2TAB = (int(0x2) << PAGE_DATA_TYPE_SHIFT) # L2 pagetable
+PAGE_DATA_TYPE_L3TAB = (int(0x3) << PAGE_DATA_TYPE_SHIFT) # L3 pagetable
+PAGE_DATA_TYPE_L4TAB = (int(0x4) << PAGE_DATA_TYPE_SHIFT) # L4 pagetable
+PAGE_DATA_TYPE_BROKEN = (int(0xd) << PAGE_DATA_TYPE_SHIFT) # Broken
+PAGE_DATA_TYPE_XALLOC = (int(0xe) << PAGE_DATA_TYPE_SHIFT) # Allocate-only
+PAGE_DATA_TYPE_XTAB = (int(0xf) << PAGE_DATA_TYPE_SHIFT) # Invalid
# x86_pv_info
X86_PV_INFO_FORMAT = "BBHI"
Index: xen-4.10.0-testing/tools/python/xen/migration/verify.py
===================================================================
--- xen-4.10.0-testing.orig/tools/python/xen/migration/verify.py
+++ xen-4.10.0-testing/tools/python/xen/migration/verify.py
@@ -7,11 +7,11 @@ Common verification infrastructure for v
from struct import calcsize, unpack
-class StreamError(StandardError):
+class StreamError(Exception):
"""Error with the stream"""
pass
-class RecordError(StandardError):
+class RecordError(Exception):
"""Error with a record in the stream"""
pass
++++++ pygrub-python3-conversion.patch ++++++
Index: xen-4.10.0-testing/tools/pygrub/src/pygrub
===================================================================
--- xen-4.10.0-testing.orig/tools/pygrub/src/pygrub
+++ xen-4.10.0-testing/tools/pygrub/src/pygrub
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#!/usr/bin/python
#
# pygrub - simple python-based bootloader for Xen
#
@@ -12,6 +12,7 @@
# along with this program; If not, see http://www.gnu.org/licenses/.
#
+from __future__ import print_function
import os, sys, string, struct, tempfile, re, traceback, stat, errno
import copy
import logging
@@ -51,7 +52,7 @@ def enable_cursor(ison):
except _curses.error:
pass
-DISK_TYPE_RAW, DISK_TYPE_HYBRIDISO, DISK_TYPE_DOS = range(3)
+DISK_TYPE_RAW, DISK_TYPE_HYBRIDISO, DISK_TYPE_DOS = list(range(3))
def identify_disk_image(file):
"""Detect DOS partition table or HybridISO format."""
fd = os.open(file, os.O_RDONLY)
@@ -78,7 +79,7 @@ def get_solaris_slice(file, offset):
buf = os.read(fd, 512)
os.close(fd)
if struct.unpack(">sys.stderr, "Using %s to parse %s" % (parser,f)
+ print("Using %s to parse %s" % (parser,f), file=sys.stderr)
self.cf = parser()
self.cf.filename = f
break
@@ -636,18 +634,18 @@ def run_grub(file, entry, fs, cfg_args):
chosencfg["args"] = cfg_args
return chosencfg
if g.__dict__.get('cf', None) is None:
- raise RuntimeError, "couldn't find bootloader config file in the image provided."
+ raise RuntimeError("couldn't find bootloader config file in the image provided.")
else:
return
if list_entries:
for i in range(len(g.cf.images)):
img = g.cf.images[i]
- print "title: %s" % img.title
- print " root: %s" % img.root
- print " kernel: %s" % img.kernel[1]
- print " args: %s" % img.args
- print " initrd: %s" % img.initrd[1]
+ print("title: %s" % img.title)
+ print(" root: %s" % img.root)
+ print(" kernel: %s" % img.kernel[1])
+ print(" args: %s" % img.args)
+ print(" initrd: %s" % img.initrd[1])
if interactive and not list_entries:
curses.wrapper(run_main)
@@ -661,7 +659,7 @@ def run_grub(file, entry, fs, cfg_args):
sel = idx
if sel == -1:
- print "No kernel image selected!"
+ print("No kernel image selected!")
sys.exit(1)
try:
@@ -759,7 +757,7 @@ def format_sxp(kernel, ramdisk, args):
def format_simple(kernel, ramdisk, args, sep):
for check in (kernel, ramdisk, args):
if check is not None and sep in check:
- raise RuntimeError, "simple format cannot represent delimiter-containing value"
+ raise RuntimeError("simple format cannot represent delimiter-containing value")
s = ("kernel %s" % kernel) + sep
if ramdisk:
s += ("ramdisk %s" % ramdisk) + sep
@@ -772,7 +770,7 @@ if __name__ == "__main__":
sel = None
def usage():
- print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],)
+ print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr)
def copy_from_image(fs, file_to_read, file_type, output_directory,
not_really):
@@ -783,8 +781,8 @@ if __name__ == "__main__":
sys.exit("The requested %s file does not exist" % file_type)
try:
datafile = fs.open_file(file_to_read)
- except Exception, e:
- print >>sys.stderr, e
+ except Exception as e:
+ print(e, file=sys.stderr)
sys.exit("Error opening %s in guest" % file_to_read)
(tfd, ret) = tempfile.mkstemp(prefix="boot_"+file_type+".",
dir=output_directory)
@@ -799,8 +797,8 @@ if __name__ == "__main__":
return ret
try:
os.write(tfd, data)
- except Exception, e:
- print >>sys.stderr, e
+ except Exception as e:
+ print(e, file=sys.stderr)
os.close(tfd)
os.unlink(ret)
del datafile
@@ -864,7 +862,7 @@ if __name__ == "__main__":
try:
part_offs = [ int(a) ]
except ValueError:
- print "offset value must be an integer"
+ print("offset value must be an integer")
usage()
sys.exit(1)
elif o in ("--entry",):
@@ -877,13 +875,13 @@ if __name__ == "__main__":
debug = True
elif o in ("--output-format",):
if a not in ["sxp", "simple", "simple0"]:
- print "unknown output format %s" % a
+ print("unknown output format %s" % a)
usage()
sys.exit(1)
output_format = a
elif o in ("--output-directory",):
if not os.path.isdir(a):
- print "%s is not an existing directory" % a
+ print("%s is not an existing directory" % a)
sys.exit(1)
output_directory = a
@@ -892,8 +890,8 @@ if __name__ == "__main__":
try:
- os.makedirs(output_directory, 0700)
- except OSError,e:
+ os.makedirs(output_directory, 0o700)
+ except OSError as e:
if (e.errno == errno.EEXIST) and os.path.isdir(output_directory):
pass
else:
@@ -907,10 +905,10 @@ if __name__ == "__main__":
# debug
if isconfig:
chosencfg = run_grub(file, entry, fs, incfg["args"])
- print " kernel: %s" % chosencfg["kernel"]
+ print(" kernel: %s" % chosencfg["kernel"])
if chosencfg["ramdisk"]:
- print " initrd: %s" % chosencfg["ramdisk"]
- print " args: %s" % chosencfg["args"]
+ print(" initrd: %s" % chosencfg["ramdisk"])
+ print(" args: %s" % chosencfg["args"])
sys.exit(0)
# if boot filesystem is set then pass to fsimage.open
@@ -956,7 +954,7 @@ if __name__ == "__main__":
# Did looping through partitions find us a kernel?
if fs is None:
- raise RuntimeError, "Unable to find partition containing kernel"
+ raise RuntimeError("Unable to find partition containing kernel")
bootcfg["kernel"] = copy_from_image(fs, chosencfg["kernel"], "kernel",
output_directory, not_really)
Index: xen-4.10.0-testing/tools/pygrub/src/GrubConf.py
===================================================================
--- xen-4.10.0-testing.orig/tools/pygrub/src/GrubConf.py
+++ xen-4.10.0-testing/tools/pygrub/src/GrubConf.py
@@ -44,7 +44,7 @@ def get_path(s):
return (None, s)
idx = s.find(')')
if idx == -1:
- raise ValueError, "Unable to find matching ')'"
+ raise ValueError("Unable to find matching ')'")
d = s[:idx]
return (GrubDiskPart(d), s[idx + 1:])
@@ -100,7 +100,7 @@ class _GrubImage(object):
" initrd: %s\n" %(self.title, self.root, self.kernel,
self.args, self.initrd))
def _parse(self, lines):
- map(self.set_from_line, lines)
+ list(map(self.set_from_line, lines))
def reset(self, lines):
self._root = self._initrd = self._kernel = self._args = None
@@ -141,7 +141,7 @@ class GrubImage(_GrubImage):
def set_from_line(self, line, replace = None):
(com, arg) = grub_exact_split(line, 2)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -177,7 +177,7 @@ class _GrubConfigFile(object):
self.parse()
def parse(self, buf = None):
- raise RuntimeError, "unimplemented parse function"
+ raise RuntimeError("unimplemented parse function")
def hasPasswordAccess(self):
return self.passwordAccess
@@ -201,7 +201,7 @@ class _GrubConfigFile(object):
import crypt
if crypt.crypt(password, pwd[1]) == pwd[1]:
return True
- except Exception, e:
+ except Exception as e:
self.passExc = "Can't verify password: %s" % str(e)
return False
@@ -213,7 +213,7 @@ class _GrubConfigFile(object):
def set(self, line):
(com, arg) = grub_exact_split(line, 2)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -233,7 +233,7 @@ class _GrubConfigFile(object):
self._default = val
if self._default < 0:
- raise ValueError, "default must be positive number"
+ raise ValueError("default must be positive number")
default = property(_get_default, _set_default)
def set_splash(self, val):
@@ -265,7 +265,7 @@ class GrubConfigFile(_GrubConfigFile):
def parse(self, buf = None):
if buf is None:
if self.filename is None:
- raise ValueError, "No config file defined to parse!"
+ raise ValueError("No config file defined to parse!")
f = open(self.filename, 'r')
lines = f.readlines()
@@ -296,7 +296,7 @@ class GrubConfigFile(_GrubConfigFile):
continue
(com, arg) = grub_exact_split(l, 2)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -328,7 +328,7 @@ class Grub2Image(_GrubImage):
if com == "set":
(com,arg) = grub2_handle_set(arg)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -364,7 +364,7 @@ class Grub2ConfigFile(_GrubConfigFile):
def parse(self, buf = None):
if buf is None:
if self.filename is None:
- raise ValueError, "No config file defined to parse!"
+ raise ValueError("No config file defined to parse!")
f = open(self.filename, 'r')
lines = f.readlines()
@@ -398,7 +398,7 @@ class Grub2ConfigFile(_GrubConfigFile):
title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
if title_match:
if img is not None:
- raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img)
+ raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img))
img = []
title = title_match.group(1)
if not l.endswith('}'):
@@ -416,7 +416,7 @@ class Grub2ConfigFile(_GrubConfigFile):
menu_level -= 1
continue
else:
- raise RuntimeError, "syntax error: closing brace without menuentry"
+ raise RuntimeError("syntax error: closing brace without menuentry")
self.add_image(Grub2Image(title, img))
img = None
@@ -431,7 +431,7 @@ class Grub2ConfigFile(_GrubConfigFile):
if com == "set":
(com,arg) = grub2_handle_set(arg)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
arg_strip = arg.strip()
if arg_strip == "${saved_entry}" or arg_strip == "${next_entry}":
@@ -446,7 +446,7 @@ class Grub2ConfigFile(_GrubConfigFile):
logging.debug("Unknown directive %s" %(com,))
if img is not None:
- raise RuntimeError, "syntax error: end of file with open menuentry(%d %s)" % (len(img),img)
+ raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img))
if self.hasPassword():
self.setPasswordAccess(False)
@@ -465,12 +465,12 @@ class Grub2ConfigFile(_GrubConfigFile):
if __name__ == "__main__":
if len(sys.argv) < 3:
- raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read"
+ raise RuntimeError("Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read")
if sys.argv[1] == "grub":
g = GrubConfigFile(sys.argv[2])
elif sys.argv[1] == "grub2":
g = Grub2ConfigFile(sys.argv[2])
else:
- raise RuntimeError, "Unknown config type %s" % sys.argv[1]
+ raise RuntimeError("Unknown config type %s" % sys.argv[1])
for i in g.images:
- print i #, i.title, i.root, i.kernel, i.args, i.initrd
+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd
Index: xen-4.10.0-testing/tools/pygrub/src/ExtLinuxConf.py
===================================================================
--- xen-4.10.0-testing.orig/tools/pygrub/src/ExtLinuxConf.py
+++ xen-4.10.0-testing/tools/pygrub/src/ExtLinuxConf.py
@@ -12,7 +12,7 @@
import sys, re, os
import logging
-import GrubConf
+from . import GrubConf
class ExtLinuxImage(object):
def __init__(self, lines, path):
@@ -32,7 +32,7 @@ class ExtLinuxImage(object):
self.lines = []
self.path = path
self.root = ""
- map(self.set_from_line, lines)
+ list(map(self.set_from_line, lines))
def set_from_line(self, line, replace = None):
(com, arg) = GrubConf.grub_exact_split(line, 2)
@@ -67,7 +67,7 @@ class ExtLinuxImage(object):
setattr(self, "initrd", a.replace("initrd=", ""))
arg = arg.replace(a, "")
- if com is not None and self.commands.has_key(com):
+ if com is not None and com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip()))
else:
@@ -136,7 +136,7 @@ class ExtLinuxConfigFile(object):
def parse(self, buf = None):
if buf is None:
if self.filename is None:
- raise ValueError, "No config file defined to parse!"
+ raise ValueError("No config file defined to parse!")
f = open(self.filename, 'r')
lines = f.readlines()
@@ -167,7 +167,7 @@ class ExtLinuxConfigFile(object):
(com, arg) = GrubConf.grub_exact_split(l, 2)
com = com.lower()
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -207,8 +207,8 @@ class ExtLinuxConfigFile(object):
if __name__ == "__main__":
if len(sys.argv) < 2:
- raise RuntimeError, "Need a configuration file to read"
+ raise RuntimeError("Need a configuration file to read")
g = ExtLinuxConfigFile(sys.argv[1])
for i in g.images:
- print i
- print g.default
+ print(i)
+ print(g.default)
Index: xen-4.10.0-testing/tools/pygrub/src/LiloConf.py
===================================================================
--- xen-4.10.0-testing.orig/tools/pygrub/src/LiloConf.py
+++ xen-4.10.0-testing/tools/pygrub/src/LiloConf.py
@@ -4,7 +4,7 @@
import sys, re, os
import logging
-import GrubConf
+from . import GrubConf
class LiloImage(object):
def __init__(self, lines, path):
@@ -24,12 +24,12 @@ class LiloImage(object):
self.lines = []
self.path = path
self.root = ""
- map(self.set_from_line, lines)
+ list(map(self.set_from_line, lines))
def set_from_line(self, line, replace = None):
(com, arg) = GrubConf.grub_exact_split(line, 2)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip()))
else:
@@ -97,7 +97,7 @@ class LiloConfigFile(object):
def parse(self, buf = None):
if buf is None:
if self.filename is None:
- raise ValueError, "No config file defined to parse!"
+ raise ValueError("No config file defined to parse!")
f = open(self.filename, 'r')
lines = f.readlines()
@@ -127,7 +127,7 @@ class LiloConfigFile(object):
continue
(com, arg) = GrubConf.grub_exact_split(l, 2)
- if self.commands.has_key(com):
+ if com in self.commands:
if self.commands[com] is not None:
setattr(self, self.commands[com], arg.strip())
else:
@@ -170,8 +170,8 @@ class LiloConfigFile(object):
if __name__ == "__main__":
if len(sys.argv) < 2:
- raise RuntimeError, "Need a lilo.conf to read"
+ raise RuntimeError("Need a lilo.conf to read")
g = LiloConfigFile(sys.argv[1])
for i in g.images:
- print i #, i.title, i.root, i.kernel, i.args, i.initrd
- print g.default
+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd
+ print(g.default)
++++++ xen-4.10.0-testing-src.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/ChangeLog new/xen-4.10.0-testing/ChangeLog
--- old/xen-4.10.0-testing/ChangeLog 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/ChangeLog 2017-11-24 17:28:36.000000000 +0100
@@ -1,42 +1,28 @@
-commit bb2c1a1cc98a22e2d4c14b18421aa7be6c2adf0d
-Author: Bhupinder Thakur
-Date: Tue Oct 24 18:09:22 2017 +0100
+commit d2f86bf604698806d311cc251c1b66fbb752673c
+Author: Andrew Cooper
+Date: Thu Nov 16 21:34:02 2017 +0000
- arm/xen: vpl011: Fix SBSA UART interrupt assertion
+ x86/hvm: Don't corrupt the HVM context stream when writing the MSR record
- With the current SBSA UART emulation, streaming larger amounts of data
- (as caused by "find /", for instance) can lead to character losses.
- This is due to the OUT ring buffer getting full, because we change the
- TX interrupt bit only when the FIFO is actually full, and not already
- when it's half-way filled, as the Linux driver expects.
- The SBSA spec does not explicitly state this, but we assume that an
- SBSA compliant UART uses the PL011 default "interrupt FIFO level select
- register" value of "1/2 way". The Linux driver certainly makes this
- assumption, so it expect to be able to write a number of characters
- after the TX interrupt line has been asserted.
- On a similar issue we have the same wrong behaviour on the receive side.
- However changing the RX interrupt to trigger on reaching half of the FIFO
- level will lead to lag, because the guest would not be notified of incoming
- characters until the FIFO is half way filled. This leads to inacceptible
- lags when typing on a terminal.
- Real hardware solves this issue by using the "receive timeout
- interrupt" (RTI), which is triggered when character reception stops for
- 32 baud cycles. As we cannot and do not want to emulate any timing here,
- we slightly abuse the timeout interrupt to notify the guest of new
- characters: when a new character comes in, the RTI is asserted, when
- the FIFO is cleared, the interrupt gets cleared.
-
- So this patch changes the emulated interrupt trigger behaviour to come
- as close to real hardware as possible: the RX and TX interrupt trigger
- when the FIFO gets half full / half empty, and the RTI interrupt signals
- new incoming characters.
-
- [Andre: reword commit message, introduce receive timeout interrupt, add
- comments]
-
- Signed-off-by: Bhupinder Thakur
- Reviewed-by: Andre Przywara
- Signed-off-by: Andre Przywara
- Signed-off-by: Stefano Stabellini
- Reviewed-by: Stefano Stabellini
+ Ever since it was introduced in c/s bd1f0b45ff, hvm_save_cpu_msrs() has had a
+ bug whereby it corrupts the HVM context stream if some, but fewer than the
+ maximum number of MSRs are written.
+
+ _hvm_init_entry() creates an hvm_save_descriptor with length for
+ msr_count_max, but in the case that we write fewer than max, h->cur only moves
+ forward by the amount of space used, causing the subsequent
+ hvm_save_descriptor to be written within the bounds of the previous one.
+
+ To resolve this, reduce the length reported by the descriptor to match the
+ actual number of bytes used.
+
+ A typical failure on the destination side looks like:
+
+ (XEN) HVM4 restore: CPU_MSR 0
+ (XEN) HVM4.0 restore: not enough data left to read 56 MSR bytes
+ (XEN) HVM4 restore: failed to load entry 20/0
+
+ Signed-off-by: Andrew Cooper
+ Reviewed-by: Wei Liu
+ Reviewed-by: Jan Beulich
Release-acked-by: Julien Grall
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/Config.mk new/xen-4.10.0-testing/Config.mk
--- old/xen-4.10.0-testing/Config.mk 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/Config.mk 2017-11-24 17:28:36.000000000 +0100
@@ -273,7 +273,7 @@
MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
endif
OVMF_UPSTREAM_REVISION ?= 947f3737abf65fda63f3ffd97fddfa6986986868
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.10.0-rc1
+QEMU_UPSTREAM_REVISION ?= b79708a8ed1b3d18bee67baeaf33b3fa529493e2
MINIOS_UPSTREAM_REVISION ?= 0b4b7897e08b967a09bed2028a79fabff82342dd
# Mon Oct 16 16:36:41 2017 +0100
# Update Xen header files again
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/docs/features/sched_credit2.pandoc new/xen-4.10.0-testing/docs/features/sched_credit2.pandoc
--- old/xen-4.10.0-testing/docs/features/sched_credit2.pandoc 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/docs/features/sched_credit2.pandoc 2017-11-24 17:28:36.000000000 +0100
@@ -1,5 +1,5 @@
% Credit2 Scheduler
-% Revision 1
+% Revision 2
\clearpage
@@ -60,14 +60,6 @@
`LIBXL\_HAVE\_SCHED\_CREDIT2\_PARAMS` symbol is introduced to
indicate their availability.
-# Limitations
-
-The Credit1 scheduler comes with vCPU hard-affinity, vCPU soft-affinity
-and caps (see `docs/man/xl.pod.1.in` for more details). In Credit2,
-vCPU hard affinity is supported starting from Xen 4.8, while soft-affinity
-and caps, while being worked on, are not yet available in any released
-hypervisor.
-
# Testing
Any change done in Credit2 wants to be tested by doing at least the
@@ -87,8 +79,6 @@
# Areas for improvement
-* Close the feature gap with Credit1 (i.e., finishing implementing vCPU
- soft-affinity and caps);
* vCPUs' reservations (similar to caps, but providing a vCPU with guarantees
about some pCPU time it will always be able to execute for);
* benchmarking for assessing the best combination of values for the various
@@ -115,4 +105,5 @@
Date Revision Version Notes
---------- -------- -------- -------------------------------------------
2016-10-14 1 Xen 4.8 Document written
+2017-11-6 2 Xen 4.10 Soft-affinity and caps implemented
---------- -------- -------- -------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/docs/misc/hvmlite.markdown new/xen-4.10.0-testing/docs/misc/hvmlite.markdown
--- old/xen-4.10.0-testing/docs/misc/hvmlite.markdown 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/docs/misc/hvmlite.markdown 1970-01-01 01:00:00.000000000 +0100
@@ -1,97 +0,0 @@
-**NOTE**: this document will be merged into `pvh.markdown` once PVH is replaced
-with the HVMlite implementation.
-
-# x86/HVM direct boot ABI #
-
-Since the Xen entry point into the kernel can be different from the
-native entry point, a `ELFNOTE` is used in order to tell the domain
-builder how to load and jump into the kernel entry point:
-
- ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long, xen_start32)
-
-The presence of the `XEN_ELFNOTE_PHYS32_ENTRY` note indicates that the
-kernel supports the boot ABI described in this document.
-
-The domain builder must load the kernel into the guest memory space and
-jump into the entry point defined at `XEN_ELFNOTE_PHYS32_ENTRY` with the
-following machine state:
-
- * `ebx`: contains the physical memory address where the loader has placed
- the boot start info structure.
-
- * `cr0`: bit 0 (PE) must be set. All the other writeable bits are cleared.
-
- * `cr4`: all bits are cleared.
-
- * `cs`: must be a 32-bit read/execute code segment with a base of ‘0’
- and a limit of ‘0xFFFFFFFF’. The selector value is unspecified.
-
- * `ds`, `es`: must be a 32-bit read/write data segment with a base of
- ‘0’ and a limit of ‘0xFFFFFFFF’. The selector values are all unspecified.
-
- * `tr`: must be a 32-bit TSS (active) with a base of '0' and a limit of '0x67'.
-
- * `eflags`: bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared.
- Bit 8 (TF) must be cleared. Other bits are all unspecified.
-
-All other processor registers and flag bits are unspecified. The OS is in
-charge of setting up it's own stack, GDT and IDT.
-
-The format of the boot start info structure (pointed to by %ebx) can be found
-in xen/include/public/arch-x86/hvm/start_info.h
-
-Other relevant information needed in order to boot a guest kernel
-(console page address, xenstore event channel...) can be obtained
-using HVMPARAMS, just like it's done on HVM guests.
-
-The setup of the hypercall page is also performed in the same way
-as HVM guests, using the hypervisor cpuid leaves and msr ranges.
-
-## AP startup ##
-
-AP startup can be performed using hypercalls or the local APIC if present.
-The following VCPU hypercalls can be used in order to bring up secondary vCPUs:
-
- * `VCPUOP_initialise` is used to set the initial state of the vCPU. The
- argument passed to the hypercall must be of the type vcpu_hvm_context.
- See `public/hvm/hvm_vcpu.h` for the layout of the structure. Note that
- this hypercall allows starting the vCPU in several modes (16/32/64bits),
- regardless of the mode the BSP is currently running on.
-
- * `VCPUOP_up` is used to launch the vCPU once the initial state has been
- set using `VCPUOP_initialise`.
-
- * `VCPUOP_down` is used to bring down a vCPU.
-
- * `VCPUOP_is_up` is used to scan the number of available vCPUs.
-
-## Hardware description ##
-
-PVHv2 guests that have access to hardware (either emulated or real) will also
-have ACPI tables with the description of the hardware that's available to the
-guest. This applies to both privileged and unprivileged guests. A pointer to
-the position of the RSDP in memory (if present) can be fetched from the start
-info structure that's passed at boot time (field rsdp_paddr).
-
-Description of paravirtualized devices will come from XenStore, just as it's
-done for HVM guests.
-
-## Interrupts ##
-
-### Interrupts from physical devices ###
-
-Interrupts from physical devices are delivered using native methods, this is
-done in order to take advantage of new hardware assisted virtualization
-functions, like posted interrupts. This implies that PVHv2 guests with physical
-devices will also have the necessary interrupt controllers in order to manage
-the delivery of interrupts from those devices, using the same interfaces that
-are available on native hardware.
-
-### Interrupts from paravirtualized devices ###
-
-Interrupts from paravirtualized devices are delivered using event channels, see
-[Event Channel Internals][event_channels] for more detailed information about
-event channels. Delivery of those interrupts can be configured in the same way
-as HVM guests, check xen/include/public/hvm/params.h and
-xen/include/public/hvm/hvm_op.h for more information about available delivery
-methods.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/docs/misc/pvh.markdown new/xen-4.10.0-testing/docs/misc/pvh.markdown
--- old/xen-4.10.0-testing/docs/misc/pvh.markdown 1970-01-01 01:00:00.000000000 +0100
+++ new/xen-4.10.0-testing/docs/misc/pvh.markdown 2017-11-24 17:28:36.000000000 +0100
@@ -0,0 +1,94 @@
+# x86/HVM direct boot ABI #
+
+Since the Xen entry point into the kernel can be different from the
+native entry point, a `ELFNOTE` is used in order to tell the domain
+builder how to load and jump into the kernel entry point:
+
+ ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long, xen_start32)
+
+The presence of the `XEN_ELFNOTE_PHYS32_ENTRY` note indicates that the
+kernel supports the boot ABI described in this document.
+
+The domain builder must load the kernel into the guest memory space and
+jump into the entry point defined at `XEN_ELFNOTE_PHYS32_ENTRY` with the
+following machine state:
+
+ * `ebx`: contains the physical memory address where the loader has placed
+ the boot start info structure.
+
+ * `cr0`: bit 0 (PE) must be set. All the other writeable bits are cleared.
+
+ * `cr4`: all bits are cleared.
+
+ * `cs`: must be a 32-bit read/execute code segment with a base of ‘0’
+ and a limit of ‘0xFFFFFFFF’. The selector value is unspecified.
+
+ * `ds`, `es`: must be a 32-bit read/write data segment with a base of
+ ‘0’ and a limit of ‘0xFFFFFFFF’. The selector values are all unspecified.
+
+ * `tr`: must be a 32-bit TSS (active) with a base of '0' and a limit of '0x67'.
+
+ * `eflags`: bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared.
+ Bit 8 (TF) must be cleared. Other bits are all unspecified.
+
+All other processor registers and flag bits are unspecified. The OS is in
+charge of setting up it's own stack, GDT and IDT.
+
+The format of the boot start info structure (pointed to by %ebx) can be found
+in xen/include/public/arch-x86/hvm/start\_info.h
+
+Other relevant information needed in order to boot a guest kernel
+(console page address, xenstore event channel...) can be obtained
+using HVMPARAMS, just like it's done on HVM guests.
+
+The setup of the hypercall page is also performed in the same way
+as HVM guests, using the hypervisor cpuid leaves and msr ranges.
+
+## AP startup ##
+
+AP startup can be performed using hypercalls or the local APIC if present.
+The following VCPU hypercalls can be used in order to bring up secondary vCPUs:
+
+ * `VCPUOP_initialise` is used to set the initial state of the vCPU. The
+ argument passed to the hypercall must be of the type vcpu\_hvm\_context.
+ See `public/hvm/hvm_vcpu.h` for the layout of the structure. Note that
+ this hypercall allows starting the vCPU in several modes (16/32/64bits),
+ regardless of the mode the BSP is currently running on.
+
+ * `VCPUOP_up` is used to launch the vCPU once the initial state has been
+ set using `VCPUOP_initialise`.
+
+ * `VCPUOP_down` is used to bring down a vCPU.
+
+ * `VCPUOP_is_up` is used to scan the number of available vCPUs.
+
+## Hardware description ##
+
+PVHv2 guests that have access to hardware (either emulated or real) will also
+have ACPI tables with the description of the hardware that's available to the
+guest. This applies to both privileged and unprivileged guests. A pointer to
+the position of the RSDP in memory (if present) can be fetched from the start
+info structure that's passed at boot time (field rsdp\_paddr).
+
+Description of paravirtualized devices will come from XenStore, just as it's
+done for HVM guests.
+
+## Interrupts ##
+
+### Interrupts from physical devices ###
+
+Interrupts from physical devices are delivered using native methods, this is
+done in order to take advantage of new hardware assisted virtualization
+functions, like posted interrupts. This implies that PVHv2 guests with physical
+devices will also have the necessary interrupt controllers in order to manage
+the delivery of interrupts from those devices, using the same interfaces that
+are available on native hardware.
+
+### Interrupts from paravirtualized devices ###
+
+Interrupts from paravirtualized devices are delivered using event channels, see
+[Event Channel Internals][event_channels] for more detailed information about
+event channels. Delivery of those interrupts can be configured in the same way
+as HVM guests, check xen/include/public/hvm/params.h and
+xen/include/public/hvm/hvm\_op.h for more information about available delivery
+methods.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/debugger/gdbsx/xg/xg_main.c new/xen-4.10.0-testing/tools/debugger/gdbsx/xg/xg_main.c
--- old/xen-4.10.0-testing/tools/debugger/gdbsx/xg/xg_main.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/debugger/gdbsx/xg/xg_main.c 2017-11-24 17:28:36.000000000 +0100
@@ -126,9 +126,11 @@
int flags, saved_errno;
XGTRC("E\n");
- if ((_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1) {
- perror("Failed to open /proc/xen/privcmd\n");
- return -1;
+ if ((_dom0_fd=open("/dev/xen/privcmd", O_RDWR)) == -1) {
+ if ((_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1) {
+ perror("Failed to open /dev/xen/privcmd or /proc/xen/privcmd\n");
+ return -1;
+ }
}
/* Although we return the file handle as the 'xc handle' the API
* does not specify / guarentee that this integer is in fact
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/hotplug/Linux/init.d/xencommons.in new/xen-4.10.0-testing/tools/hotplug/Linux/init.d/xencommons.in
--- old/xen-4.10.0-testing/tools/hotplug/Linux/init.d/xencommons.in 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/hotplug/Linux/init.d/xencommons.in 2017-11-24 17:28:36.000000000 +0100
@@ -58,6 +58,7 @@
mkdir -p ${XEN_RUN_DIR}
mkdir -p ${XEN_LOCK_DIR}
+ mkdir -p ${XEN_LOG_DIR}
@XEN_SCRIPT_DIR@/launch-xenstore || exit 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libs/evtchn/core.c new/xen-4.10.0-testing/tools/libs/evtchn/core.c
--- old/xen-4.10.0-testing/tools/libs/evtchn/core.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libs/evtchn/core.c 2017-11-24 17:28:36.000000000 +0100
@@ -56,6 +56,7 @@
err:
osdep_evtchn_close(xce);
+ xentoolcore__deregister_active_handle(&xce->tc_ah);
xtl_logger_destroy(xce->logger_tofree);
free(xce);
return NULL;
@@ -69,6 +70,7 @@
return 0;
rc = osdep_evtchn_close(xce);
+ xentoolcore__deregister_active_handle(&xce->tc_ah);
xtl_logger_destroy(xce->logger_tofree);
free(xce);
return rc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libs/evtchn/freebsd.c new/xen-4.10.0-testing/tools/libs/evtchn/freebsd.c
--- old/xen-4.10.0-testing/tools/libs/evtchn/freebsd.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libs/evtchn/freebsd.c 2017-11-24 17:28:36.000000000 +0100
@@ -19,6 +19,7 @@
* Split off from xc_freebsd_osdep.c
*/
+#include
#include
#include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libs/evtchn/netbsd.c new/xen-4.10.0-testing/tools/libs/evtchn/netbsd.c
--- old/xen-4.10.0-testing/tools/libs/evtchn/netbsd.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libs/evtchn/netbsd.c 2017-11-24 17:28:36.000000000 +0100
@@ -19,6 +19,7 @@
* Split out from xc_netbsd.c
*/
+#include
#include
#include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libs/evtchn/solaris.c new/xen-4.10.0-testing/tools/libs/evtchn/solaris.c
--- old/xen-4.10.0-testing/tools/libs/evtchn/solaris.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libs/evtchn/solaris.c 2017-11-24 17:28:36.000000000 +0100
@@ -19,6 +19,7 @@
* Split out from xc_solaris.c
*/
+#include
#include
#include
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libxc/xc_dom_arm.c new/xen-4.10.0-testing/tools/libxc/xc_dom_arm.c
--- old/xen-4.10.0-testing/tools/libxc/xc_dom_arm.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libxc/xc_dom_arm.c 2017-11-24 17:28:36.000000000 +0100
@@ -91,7 +91,8 @@
xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn);
xc_clear_domain_page(dom->xch, dom->guest_domid, base + MEMACCESS_PFN_OFFSET);
- xc_clear_domain_page(dom->xch, dom->guest_domid, base + VUART_PFN_OFFSET);
+ xc_clear_domain_page(dom->xch, dom->guest_domid, dom->vuart_gfn);
+
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN,
dom->console_pfn);
xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libxc/xc_dom_boot.c new/xen-4.10.0-testing/tools/libxc/xc_dom_boot.c
--- old/xen-4.10.0-testing/tools/libxc/xc_dom_boot.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libxc/xc_dom_boot.c 2017-11-24 17:28:36.000000000 +0100
@@ -62,25 +62,6 @@
return rc;
}
-static int clear_page(struct xc_dom_image *dom, xen_pfn_t pfn)
-{
- xen_pfn_t dst;
- int rc;
-
- if ( pfn == 0 )
- return 0;
-
- dst = xc_dom_p2m(dom, pfn);
- DOMPRINTF("%s: pfn 0x%" PRIpfn ", mfn 0x%" PRIpfn "",
- __FUNCTION__, pfn, dst);
- rc = xc_clear_domain_page(dom->xch, dom->guest_domid, dst);
- if ( rc != 0 )
- xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
- "%s: xc_clear_domain_page failed (pfn 0x%" PRIpfn
- ", rc=%d)", __FUNCTION__, pfn, rc);
- return rc;
-}
-
/* ------------------------------------------------------------------------ */
@@ -222,13 +203,6 @@
if ( (rc = dom->arch_hooks->setup_pgtables(dom)) != 0 )
return rc;
- if ( (rc = clear_page(dom, dom->console_pfn)) != 0 )
- return rc;
- if ( (rc = clear_page(dom, dom->xenstore_pfn)) != 0 )
- return rc;
- if ( (rc = clear_page(dom, dom->vuart_gfn)) != 0 )
- return rc;
-
/* start info page */
if ( dom->arch_hooks->start_info )
dom->arch_hooks->start_info(dom);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libxc/xc_dom_x86.c new/xen-4.10.0-testing/tools/libxc/xc_dom_x86.c
--- old/xen-4.10.0-testing/tools/libxc/xc_dom_x86.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libxc/xc_dom_x86.c 2017-11-24 17:28:36.000000000 +0100
@@ -534,24 +534,24 @@
/* ------------------------------------------------------------------------ */
-static int alloc_magic_pages(struct xc_dom_image *dom)
+static int alloc_magic_pages_pv(struct xc_dom_image *dom)
{
- /* allocate special pages */
dom->start_info_pfn = xc_dom_alloc_page(dom, "start info");
if ( dom->start_info_pfn == INVALID_PFN )
return -1;
+
dom->xenstore_pfn = xc_dom_alloc_page(dom, "xenstore");
if ( dom->xenstore_pfn == INVALID_PFN )
return -1;
+ xc_clear_domain_page(dom->xch, dom->guest_domid,
+ xc_dom_p2m(dom, dom->xenstore_pfn));
+
dom->console_pfn = xc_dom_alloc_page(dom, "console");
if ( dom->console_pfn == INVALID_PFN )
return -1;
- if ( xc_dom_translated(dom) )
- {
- dom->shared_info_pfn = xc_dom_alloc_page(dom, "shared info");
- if ( dom->shared_info_pfn == INVALID_PFN )
- return -1;
- }
+ xc_clear_domain_page(dom->xch, dom->guest_domid,
+ xc_dom_p2m(dom, dom->console_pfn));
+
dom->alloc_bootstack = 1;
return 0;
@@ -700,7 +700,11 @@
special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
dom->console_pfn = special_pfn(SPECIALPAGE_CONSOLE);
+ xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
+
dom->xenstore_pfn = special_pfn(SPECIALPAGE_XENSTORE);
+ xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn);
+
dom->parms.virt_hypercall = -1;
rc = 0;
@@ -1756,7 +1760,7 @@
.sizeof_pfn = 4,
.p2m_base_supported = 0,
.arch_private_size = sizeof(struct xc_dom_image_x86),
- .alloc_magic_pages = alloc_magic_pages,
+ .alloc_magic_pages = alloc_magic_pages_pv,
.alloc_pgtables = alloc_pgtables_x86_32_pae,
.alloc_p2m_list = alloc_p2m_list_x86_32,
.setup_pgtables = setup_pgtables_x86_32_pae,
@@ -1775,7 +1779,7 @@
.sizeof_pfn = 8,
.p2m_base_supported = 1,
.arch_private_size = sizeof(struct xc_dom_image_x86),
- .alloc_magic_pages = alloc_magic_pages,
+ .alloc_magic_pages = alloc_magic_pages_pv,
.alloc_pgtables = alloc_pgtables_x86_64,
.alloc_p2m_list = alloc_p2m_list_x86_64,
.setup_pgtables = setup_pgtables_x86_64,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libxc/xc_sr_restore_x86_pv.c new/xen-4.10.0-testing/tools/libxc/xc_sr_restore_x86_pv.c
--- old/xen-4.10.0-testing/tools/libxc/xc_sr_restore_x86_pv.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libxc/xc_sr_restore_x86_pv.c 2017-11-24 17:28:36.000000000 +0100
@@ -455,8 +455,8 @@
domctl.cmd = XEN_DOMCTL_set_vcpu_msrs;
domctl.domain = ctx->domid;
domctl.u.vcpu_msrs.vcpu = vcpuid;
- domctl.u.vcpu_msrs.msr_count = vcpu->msrsz % sizeof(xen_domctl_vcpu_msr_t);
- set_xen_guest_handle(domctl.u.vcpuextstate.buffer, buffer);
+ domctl.u.vcpu_msrs.msr_count = vcpu->msrsz / sizeof(xen_domctl_vcpu_msr_t);
+ set_xen_guest_handle(domctl.u.vcpu_msrs.msrs, buffer);
memcpy(buffer, vcpu->msr, vcpu->msrsz);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/libxl/libxl_console.c new/xen-4.10.0-testing/tools/libxl/libxl_console.c
--- old/xen-4.10.0-testing/tools/libxl/libxl_console.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/libxl/libxl_console.c 2017-11-24 17:28:36.000000000 +0100
@@ -376,7 +376,7 @@
flexarray_append(ro_front, "port");
flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
flexarray_append(ro_front, "ring-ref");
- flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));
+ flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->vuart_gfn));
flexarray_append(ro_front, "limit");
flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT));
flexarray_append(ro_front, "type");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/misc/xen-cpuid.c new/xen-4.10.0-testing/tools/misc/xen-cpuid.c
--- old/xen-4.10.0-testing/tools/misc/xen-cpuid.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/misc/xen-cpuid.c 2017-11-24 17:28:36.000000000 +0100
@@ -95,7 +95,7 @@
[ 0] = "fsgsbase", [ 1] = "tsc-adj",
[ 2] = "sgx", [ 3] = "bmi1",
[ 4] = "hle", [ 5] = "avx2",
- [ 6] = "REZ", [ 7] = "smep",
+ [ 6] = "fdp_exn", [ 7] = "smep",
[ 8] = "bmi2", [ 9] = "erms",
[10] = "invpcid", [11] = "rtm",
[12] = "pqm", [13] = "depfpp",
@@ -121,23 +121,28 @@
static const char *str_7c0[32] =
{
[ 0] = "prechwt1", [ 1] = "avx512vbmi",
- [ 2] = "REZ", [ 3] = "pku",
+ [ 2] = "umip", [ 3] = "pku",
[ 4] = "ospke",
[5 ... 13] = "REZ",
[14] = "avx512_vpopcntdq",
- [15 ... 31] = "REZ",
+ [15 ... 21] = "REZ",
+
+ [22] = "rdpid",
+
+ [23 ... 31] = "REZ",
};
static const char *str_e7d[32] =
{
[0 ... 7] = "REZ",
- [ 8] = "itsc",
+ [ 8] = "itsc", [ 9] = "REZ",
+ [10] = "efro",
- [9 ... 31] = "REZ",
+ [11 ... 31] = "REZ",
};
static const char *str_e8b[32] =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/tools/xenstore/xenstored_control.c new/xen-4.10.0-testing/tools/xenstore/xenstored_control.c
--- old/xen-4.10.0-testing/tools/xenstore/xenstored_control.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/tools/xenstore/xenstored_control.c 2017-11-24 17:28:36.000000000 +0100
@@ -184,6 +184,8 @@
return EACCES;
num = xs_count_strings(in->buffer, in->used);
+ if (num < 1)
+ return EINVAL;
vec = talloc_array(in, char *, num);
if (!vec)
return ENOMEM;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/arm/domain_build.c new/xen-4.10.0-testing/xen/arch/arm/domain_build.c
--- old/xen-4.10.0-testing/xen/arch/arm/domain_build.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/arm/domain_build.c 2017-11-24 17:28:36.000000000 +0100
@@ -2002,15 +2002,15 @@
for ( offs = 0; offs < len; )
{
- int rc;
- paddr_t s, l, ma;
+ uint64_t par;
+ paddr_t s, l, ma = 0;
void *dst;
s = offs & ~PAGE_MASK;
l = min(PAGE_SIZE - s, len);
- rc = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE);
- if ( rc )
+ par = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE);
+ if ( par )
{
panic("Unable to translate guest address");
return;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/arm/kernel.c new/xen-4.10.0-testing/xen/arch/arm/kernel.c
--- old/xen-4.10.0-testing/xen/arch/arm/kernel.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/arm/kernel.c 2017-11-24 17:28:36.000000000 +0100
@@ -167,15 +167,15 @@
paddr, load_addr, load_addr + len);
for ( offs = 0; offs < len; )
{
- int rc;
- paddr_t s, l, ma;
+ uint64_t par;
+ paddr_t s, l, ma = 0;
void *dst;
s = offs & ~PAGE_MASK;
l = min(PAGE_SIZE - s, len);
- rc = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE);
- if ( rc )
+ par = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE);
+ if ( par )
{
panic("Unable to map translate guest address");
return;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/arm/p2m.c new/xen-4.10.0-testing/xen/arch/arm/p2m.c
--- old/xen-4.10.0-testing/xen/arch/arm/p2m.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/arm/p2m.c 2017-11-24 17:28:36.000000000 +0100
@@ -1414,7 +1414,7 @@
struct p2m_domain *p2m = p2m_get_hostp2m(d);
struct page_info *page = NULL;
paddr_t maddr = 0;
- int rc;
+ uint64_t par;
/*
* XXX: To support a different vCPU, we would need to load the
@@ -1425,19 +1425,32 @@
p2m_read_lock(p2m);
- rc = gvirt_to_maddr(va, &maddr, flags);
+ par = gvirt_to_maddr(va, &maddr, flags);
- if ( rc )
+ if ( par )
+ {
+ dprintk(XENLOG_G_DEBUG,
+ "%pv: gvirt_to_maddr failed va=%#"PRIvaddr" flags=0x%lx par=%#"PRIx64"\n",
+ v, va, flags, par);
goto err;
+ }
if ( !mfn_valid(maddr_to_mfn(maddr)) )
+ {
+ dprintk(XENLOG_G_DEBUG, "%pv: Invalid MFN %#"PRI_mfn"\n",
+ v, mfn_x(maddr_to_mfn(maddr)));
goto err;
+ }
page = mfn_to_page(maddr_to_mfn(maddr));
ASSERT(page);
if ( unlikely(!get_page(page, d)) )
+ {
+ dprintk(XENLOG_G_DEBUG, "%pv: Failing to acquire the MFN %#"PRI_mfn"\n",
+ v, mfn_x(maddr_to_mfn(maddr)));
page = NULL;
+ }
err:
if ( !page && p2m->mem_access_enabled )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/x86/hvm/hpet.c new/xen-4.10.0-testing/xen/arch/x86/hvm/hpet.c
--- old/xen-4.10.0-testing/xen/arch/x86/hvm/hpet.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/x86/hvm/hpet.c 2017-11-24 17:28:36.000000000 +0100
@@ -635,14 +635,10 @@
HVM_REGISTER_SAVE_RESTORE(HPET, hpet_save, hpet_load, 1, HVMSR_PER_DOM);
-void hpet_init(struct domain *d)
+static void hpet_set(HPETState *h)
{
- HPETState *h = domain_vhpet(d);
int i;
- if ( !has_vhpet(d) )
- return;
-
memset(h, 0, sizeof(HPETState));
rwlock_init(&h->lock);
@@ -668,7 +664,14 @@
h->hpet.comparator64[i] = ~0ULL;
h->pt[i].source = PTSRC_isa;
}
+}
+
+void hpet_init(struct domain *d)
+{
+ if ( !has_vhpet(d) )
+ return;
+ hpet_set(domain_vhpet(d));
register_mmio_handler(d, &hpet_mmio_ops);
d->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] = 1;
}
@@ -697,8 +700,11 @@
void hpet_reset(struct domain *d)
{
+ if ( !has_vhpet(d) )
+ return;
+
hpet_deinit(d);
- hpet_init(d);
+ hpet_set(domain_vhpet(d));
}
/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/x86/hvm/hvm.c new/xen-4.10.0-testing/xen/arch/x86/hvm/hvm.c
--- old/xen-4.10.0-testing/xen/arch/x86/hvm/hvm.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/x86/hvm/hvm.c 2017-11-24 17:28:36.000000000 +0100
@@ -1330,6 +1330,7 @@
for_each_vcpu ( d, v )
{
+ struct hvm_save_descriptor *d = _p(&h->data[h->cur]);
struct hvm_msr *ctxt;
unsigned int i;
@@ -1348,8 +1349,13 @@
ctxt->msr[i]._rsvd = 0;
if ( ctxt->count )
+ {
+ /* Rewrite length to indicate how much space we actually used. */
+ d->length = HVM_CPU_MSR_SIZE(ctxt->count);
h->cur += HVM_CPU_MSR_SIZE(ctxt->count);
+ }
else
+ /* or rewind and remove the descriptor from the stream. */
h->cur -= sizeof(struct hvm_save_descriptor);
}
@@ -4534,12 +4540,18 @@
if ( a.u.enable_notify.pad || a.domain != DOMID_SELF ||
a.u.enable_notify.vcpu_id != curr->vcpu_id )
+ {
rc = -EINVAL;
+ break;
+ }
if ( !gfn_eq(vcpu_altp2m(curr).veinfo_gfn, INVALID_GFN) ||
mfn_eq(get_gfn_query_unlocked(curr->domain,
a.u.enable_notify.gfn, &p2mt), INVALID_MFN) )
- return -EINVAL;
+ {
+ rc = -EINVAL;
+ break;
+ }
vcpu_altp2m(curr).veinfo_gfn = _gfn(a.u.enable_notify.gfn);
altp2m_vcpu_update_vmfunc_ve(curr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/x86/mm/shadow/multi.c new/xen-4.10.0-testing/xen/arch/x86/mm/shadow/multi.c
--- old/xen-4.10.0-testing/xen/arch/x86/mm/shadow/multi.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/x86/mm/shadow/multi.c 2017-11-24 17:28:36.000000000 +0100
@@ -4350,11 +4350,18 @@
/* Carefully look in the shadow linear map for the l1e we expect */
#if SHADOW_PAGING_LEVELS >= 4
- /* Is a shadow linear map is installed in the first place? */
- sl4p = v->arch.paging.shadow.guest_vtable;
- sl4p += shadow_l4_table_offset(SH_LINEAR_PT_VIRT_START);
- if ( !(shadow_l4e_get_flags(*sl4p) & _PAGE_PRESENT) )
- return 0;
+ /*
+ * Non-external guests (i.e. PV) have a SHADOW_LINEAR mapping from the
+ * moment their shadows are created. External guests (i.e. HVM) may not,
+ * but always have a regular linear mapping, which we can use to observe
+ * whether a SHADOW_LINEAR mapping is present.
+ */
+ if ( paging_mode_external(d) )
+ {
+ sl4p = __linear_l4_table + l4_linear_offset(SH_LINEAR_PT_VIRT_START);
+ if ( !(shadow_l4e_get_flags(*sl4p) & _PAGE_PRESENT) )
+ return 0;
+ }
sl4p = sh_linear_l4_table(v) + shadow_l4_linear_offset(vaddr);
if ( !(shadow_l4e_get_flags(*sl4p) & _PAGE_PRESENT) )
return 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/arch/x86/mm.c new/xen-4.10.0-testing/xen/arch/x86/mm.c
--- old/xen-4.10.0-testing/xen/arch/x86/mm.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/arch/x86/mm.c 2017-11-24 17:28:36.000000000 +0100
@@ -2477,26 +2477,19 @@
break;
}
-#ifdef CONFIG_PV_LINEAR_PT
- if ( ptpg && PGT_type_equal(x, ptpg->u.inuse.type_info) )
+ if ( !ptpg || !PGT_type_equal(x, ptpg->u.inuse.type_info) )
{
/*
* set_tlbflush_timestamp() accesses the same union
- * linear_pt_count lives in. Unvalidated page table pages,
- * however, should occur during domain destruction only
- * anyway. Updating of linear_pt_count luckily is not
- * necessary anymore for a dying domain.
+ * linear_pt_count lives in. Pages (including page table ones),
+ * however, don't need their flush time stamp set except when
+ * the last reference is being dropped. For page table pages
+ * this happens in _put_final_page_type().
*/
- ASSERT(page_get_owner(page)->is_dying);
- ASSERT(page->linear_pt_count < 0);
- ASSERT(ptpg->linear_pt_count > 0);
- ptpg = NULL;
- }
-#else /* CONFIG_PV_LINEAR_PT */
- BUG_ON(ptpg && PGT_type_equal(x, ptpg->u.inuse.type_info));
-#endif
-
- set_tlbflush_timestamp(page);
+ set_tlbflush_timestamp(page);
+ }
+ else
+ BUG_ON(!IS_ENABLED(CONFIG_PV_LINEAR_PT));
}
else if ( unlikely((nx & (PGT_locked | PGT_count_mask)) ==
(PGT_locked | 1)) )
@@ -4844,9 +4837,29 @@
{
unsigned long base_mfn;
- pl1e = l2e_to_l1e(*pl2e);
if ( locking )
spin_lock(&map_pgdir_lock);
+
+ ol2e = *pl2e;
+ /*
+ * L2E may be already cleared, or set to a superpage, by
+ * concurrent paging structure modifications on other CPUs.
+ */
+ if ( !(l2e_get_flags(ol2e) & _PAGE_PRESENT) )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ continue;
+ }
+
+ if ( l2e_get_flags(ol2e) & _PAGE_PSE )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ goto check_l3;
+ }
+
+ pl1e = l2e_to_l1e(ol2e);
base_mfn = l1e_get_pfn(*pl1e) & ~(L1_PAGETABLE_ENTRIES - 1);
for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++, pl1e++ )
if ( (l1e_get_pfn(*pl1e) != (base_mfn + i)) ||
@@ -4854,7 +4867,6 @@
break;
if ( i == L1_PAGETABLE_ENTRIES )
{
- ol2e = *pl2e;
l2e_write_atomic(pl2e, l2e_from_pfn(base_mfn,
l1f_to_lNf(flags)));
if ( locking )
@@ -4880,7 +4892,20 @@
if ( locking )
spin_lock(&map_pgdir_lock);
+
ol3e = *pl3e;
+ /*
+ * L3E may be already cleared, or set to a superpage, by
+ * concurrent paging structure modifications on other CPUs.
+ */
+ if ( !(l3e_get_flags(ol3e) & _PAGE_PRESENT) ||
+ (l3e_get_flags(ol3e) & _PAGE_PSE) )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ continue;
+ }
+
pl2e = l3e_to_l2e(ol3e);
base_mfn = l2e_get_pfn(*pl2e) & ~(L2_PAGETABLE_ENTRIES *
L1_PAGETABLE_ENTRIES - 1);
@@ -5079,6 +5104,27 @@
*/
if ( (nf & _PAGE_PRESENT) || ((v != e) && (l1_table_offset(v) != 0)) )
continue;
+ if ( locking )
+ spin_lock(&map_pgdir_lock);
+
+ /*
+ * L2E may be already cleared, or set to a superpage, by
+ * concurrent paging structure modifications on other CPUs.
+ */
+ if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ goto check_l3;
+ }
+
+ if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ continue;
+ }
+
pl1e = l2e_to_l1e(*pl2e);
for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
if ( l1e_get_intpte(pl1e[i]) != 0 )
@@ -5087,11 +5133,16 @@
{
/* Empty: zap the L2E and free the L1 page. */
l2e_write_atomic(pl2e, l2e_empty());
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
free_xen_pagetable(pl1e);
}
+ else if ( locking )
+ spin_unlock(&map_pgdir_lock);
}
+ check_l3:
/*
* If we are not destroying mappings, or not done with the L3E,
* skip the empty&free check.
@@ -5099,6 +5150,21 @@
if ( (nf & _PAGE_PRESENT) ||
((v != e) && (l2_table_offset(v) + l1_table_offset(v) != 0)) )
continue;
+ if ( locking )
+ spin_lock(&map_pgdir_lock);
+
+ /*
+ * L3E may be already cleared, or set to a superpage, by
+ * concurrent paging structure modifications on other CPUs.
+ */
+ if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ||
+ (l3e_get_flags(*pl3e) & _PAGE_PSE) )
+ {
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
+ continue;
+ }
+
pl2e = l3e_to_l2e(*pl3e);
for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
if ( l2e_get_intpte(pl2e[i]) != 0 )
@@ -5107,9 +5173,13 @@
{
/* Empty: zap the L3E and free the L2 page. */
l3e_write_atomic(pl3e, l3e_empty());
+ if ( locking )
+ spin_unlock(&map_pgdir_lock);
flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
free_xen_pagetable(pl2e);
}
+ else if ( locking )
+ spin_unlock(&map_pgdir_lock);
}
flush_area(NULL, FLUSH_TLB_GLOBAL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/common/gcov/gcov.c new/xen-4.10.0-testing/xen/common/gcov/gcov.c
--- old/xen-4.10.0-testing/xen/common/gcov/gcov.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/common/gcov/gcov.c 2017-11-24 17:28:36.000000000 +0100
@@ -239,7 +239,7 @@
break;
default:
- ret = -ENOSYS;
+ ret = -EOPNOTSUPP;
break;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/common/multicall.c new/xen-4.10.0-testing/xen/common/multicall.c
--- old/xen-4.10.0-testing/xen/common/multicall.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/common/multicall.c 2017-11-24 17:28:36.000000000 +0100
@@ -66,6 +66,13 @@
disp = arch_do_multicall_call(mcs);
+ /*
+ * In the unlikely event that a hypercall has left interrupts,
+ * spinlocks, or other things in a bad way, continuing the multicall
+ * will typically lead to far more subtle issues to debug.
+ */
+ ASSERT_NOT_IN_ATOMIC();
+
#ifndef NDEBUG
{
/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/common/spinlock.c new/xen-4.10.0-testing/xen/common/spinlock.c
--- old/xen-4.10.0-testing/xen/common/spinlock.c 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/common/spinlock.c 2017-11-24 17:28:36.000000000 +0100
@@ -44,7 +44,13 @@
if ( unlikely(debug->irq_safe != irq_safe) )
{
int seen = cmpxchg(&debug->irq_safe, -1, irq_safe);
- BUG_ON(seen == !irq_safe);
+
+ if ( seen == !irq_safe )
+ {
+ printk("CHECKLOCK FAILURE: prev irqsafe: %d, curr irqsafe %d\n",
+ seen, irq_safe);
+ BUG();
+ }
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/include/asm-arm/mm.h new/xen-4.10.0-testing/xen/include/asm-arm/mm.h
--- old/xen-4.10.0-testing/xen/include/asm-arm/mm.h 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/include/asm-arm/mm.h 2017-11-24 17:28:36.000000000 +0100
@@ -266,11 +266,16 @@
}
#endif
-static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags)
+/*
+ * Translate a guest virtual address to a machine address.
+ * Return the fault information if the translation has failed else 0.
+ */
+static inline uint64_t gvirt_to_maddr(vaddr_t va, paddr_t *pa,
+ unsigned int flags)
{
uint64_t par = gva_to_ma_par(va, flags);
if ( par & PAR_F )
- return -EFAULT;
+ return par;
*pa = (par & PADDR_MASK & PAGE_MASK) | ((unsigned long) va & ~PAGE_MASK);
return 0;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/include/public/arch-arm.h new/xen-4.10.0-testing/xen/include/public/arch-arm.h
--- old/xen-4.10.0-testing/xen/include/public/arch-arm.h 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/include/public/arch-arm.h 2017-11-24 17:28:36.000000000 +0100
@@ -274,6 +274,7 @@
typedef uint64_t xen_pfn_t;
#define PRI_xen_pfn PRIx64
+#define PRIu_xen_pfn PRIu64
/* Maximum number of virtual CPUs in legacy multi-processor guests. */
/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/include/public/arch-x86/cpufeatureset.h new/xen-4.10.0-testing/xen/include/public/arch-x86/cpufeatureset.h
--- old/xen-4.10.0-testing/xen/include/public/arch-x86/cpufeatureset.h 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/include/public/arch-x86/cpufeatureset.h 2017-11-24 17:28:36.000000000 +0100
@@ -239,8 +239,8 @@
XEN_CPUFEATURE(CLZERO, 8*32+ 0) /*A CLZERO instruction */
/* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
-XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A AVX512 Neural Network Instructions */
-XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A AVX512 Multiply Accumulation Single Precision */
+XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A AVX512 Neural Network Instructions */
+XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A AVX512 Multiply Accumulation Single Precision */
#endif /* XEN_CPUFEATURE */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xen-4.10.0-testing/xen/include/public/arch-x86/xen.h new/xen-4.10.0-testing/xen/include/public/arch-x86/xen.h
--- old/xen-4.10.0-testing/xen/include/public/arch-x86/xen.h 2017-11-02 21:13:35.000000000 +0100
+++ new/xen-4.10.0-testing/xen/include/public/arch-x86/xen.h 2017-11-24 17:28:36.000000000 +0100
@@ -75,6 +75,7 @@
#ifndef __ASSEMBLY__
typedef unsigned long xen_pfn_t;
#define PRI_xen_pfn "lx"
+#define PRIu_xen_pfn "lu"
#endif
#define XEN_HAVE_PV_GUEST_ENTRY 1
++++++ xen2libvirt.py ++++++
--- /var/tmp/diff_new_pack.JSV8D9/_old 2017-11-30 12:41:40.058041574 +0100
+++ /var/tmp/diff_new_pack.JSV8D9/_new 2017-11-30 12:41:40.066041283 +0100
@@ -22,6 +22,7 @@
# Read native Xen configuration format, convert to libvirt domXML, and
# import (virsh define <xml>) into libvirt.
+from __future__ import print_function
import sys
import os
import argparse
@@ -31,7 +32,7 @@
try:
import libvirt
except ImportError:
- print 'Unable to import the libvirt module. Is libvirt-python installed?'
+ print('Unable to import the libvirt module. Is libvirt-python installed?')
sys.exit(1)
parser = argparse.ArgumentParser(description='Import Xen domain configuration into libvirt')
@@ -44,14 +45,14 @@
def print_verbose(msg):
if args.verbose:
- print msg
+ print(msg)
def check_config(path, config):
isbinary = os.system('file -b ' + path + ' | grep text > /dev/null')
if isbinary:
- print('Skipping %s (not a valid Xen configuration file)' % path)
+ print(('Skipping %s (not a valid Xen configuration file)' % path))
return 'unknown'
for line in config.splitlines():
@@ -61,14 +62,14 @@
# XML is not a supported conversion format
break
if line.startswith('(domain'):
- print('Found sexpr formatted file %s' % path)
+ print(('Found sexpr formatted file %s' % path))
return 'sexpr'
if '=' in line:
- print('Found xm formatted file %s' % path)
+ print(('Found xm formatted file %s' % path))
return 'xm'
break
- print('Skipping %s (not a valid Xen configuration file)' % path)
+ print(('Skipping %s (not a valid Xen configuration file)' % path))
return 'unknown'
@@ -103,12 +104,12 @@
print_verbose('Successfully converted Xen domain configuration to '
'libvirt domXML:\n %s' % xml)
if convert_only:
- print xml
+ print(xml)
else:
print_verbose('Importing converted libvirt domXML into libvirt...')
dom = conn.defineXML(xml)
if dom is None:
- print 'Failed to define domain from converted domXML'
+ print('Failed to define domain from converted domXML')
sys.exit(1)
print_verbose('domXML successfully imported into libvirt')
@@ -130,7 +131,7 @@
print_verbose('Processing file %s' % abs_name)
import_domain(conn, abs_name, args.format, args.convert_only)
except IOError:
- print('Failed to open/read path %s' % path)
+ print(('Failed to open/read path %s' % path))
sys.exit(1)
else:
import_domain(conn, args.path, args.format, args.convert_only)
++++++ xenmon-python3-conversion.patch ++++++
Index: xen-4.10.0-testing/tools/xenmon/xenmon.py
===================================================================
--- xen-4.10.0-testing.orig/tools/xenmon/xenmon.py
+++ xen-4.10.0-testing/tools/xenmon/xenmon.py
@@ -23,6 +23,7 @@
# along with this program; If not, see http://www.gnu.org/licenses/.
#####################################################################
+from __future__ import print_function
import mmap
import struct
import os
@@ -248,8 +249,8 @@ def display(scr, row, col, str, attr=0):
scr.keypad(0)
_c.echo()
_c.endwin()
- print "Your terminal screen is not big enough; Please resize it."
- print "row=%d, col=%d, str='%s'" % (row, col, str)
+ print("Your terminal screen is not big enough; Please resize it.")
+ print("row=%d, col=%d, str='%s'" % (row, col, str))
sys.exit(1)
@@ -704,7 +705,7 @@ def main():
try:
writelog()
except:
- print 'Quitting.'
+ print('Quitting.')
stop_xenbaked()
if __name__ == "__main__":
++++++ xenstore-run-in-studomain.patch ++++++
References: fate#323663 - Run Xenstore in stubdomain
Index: xen-4.10.0-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
===================================================================
--- xen-4.10.0-testing.orig/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ xen-4.10.0-testing/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -16,7 +16,7 @@
#
# Changing this requires a reboot to take effect.
#
-#XENSTORETYPE=daemon
+XENSTORETYPE=domain
## Type: string
## Default: xenstored
@@ -67,7 +67,7 @@ XENSTORED_ARGS=
#
# xenstore domain memory size in MiB.
# Only evaluated if XENSTORETYPE is "domain".
-#XENSTORE_DOMAIN_SIZE=8
+XENSTORE_DOMAIN_SIZE=32
## Type: string
## Default: not set, no autoballooning of xenstore domain
@@ -78,7 +78,7 @@ XENSTORED_ARGS=
# - combination of both in form of <val>:<frac> (e.g. 8:1/100), resulting
# value will be the higher of both specifications
# Only evaluated if XENSTORETYPE is "domain".
-#XENSTORE_MAX_DOMAIN_SIZE=
+XENSTORE_MAX_DOMAIN_SIZE=1/100
## Type: string
## Default: ""
++++++ xnloader.py ++++++
--- /var/tmp/diff_new_pack.JSV8D9/_old 2017-11-30 12:41:40.150038229 +0100
+++ /var/tmp/diff_new_pack.JSV8D9/_new 2017-11-30 12:41:40.150038229 +0100
@@ -13,6 +13,7 @@
# Binary patching of xnloader.sys
# For launching NetWare on Xen 4.2 and newer
+from __future__ import print_function
import os, sys, base64
CODE_OFFSET=0x49F5
@@ -34,8 +35,8 @@
try:
fd = os.open(loader, os.O_RDWR)
- except Exception, e:
- print >>sys.stderr, e
+ except Exception as e:
+ print(e, file=sys.stderr)
raise
# Validate minimum size for I/O