Ian Jackson [Fri, 17 Jul 2015 17:00:48 +0000 (18:00 +0100)]
xl: Command line: Remove maximum argument limit for network-attach
This limit of 11 has been in this function since it was written, but
serves no purpose. The extra arguments are fed one by one to
parse_nic_config, and it is possible to have as many as you like.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Ian Jackson [Fri, 17 Jul 2015 17:00:47 +0000 (18:00 +0100)]
xl: Command line: Adjust "Fix segfaults from `xl psr-cat-cbm-set`..."
This adjust commit a49077e5 "Fix segfaults from `xl psr-cat-cbm-set`
command line handling":
* Do not use the constant `required_argument' here (we simply use 1
everywhere else).
* Fix the minimum required arguments argument to SWITCH_FOREACH_OPT.
Leave the separate check on optind, because it checks for too many as
well as too few arguments.
(There are many things in xl which fail to check for too many
arguments. I do not intend to drain that swamp now: I started but
decided a complete overhaul of most of xl's command line argument
processing would be best.)
This is just a code cleanup with no ultimate functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Chao Peng <chao.p.peng@linux.intel.com> CC: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ian Campbell [Tue, 21 Jul 2015 15:00:19 +0000 (16:00 +0100)]
tools: libxl: Refix "Initialise the fd of the unused half of a datacopier"
Applying the series out of order led to d72befc35f31 "tools/libxl:
Identify copywhat in stream v2 datacopiers" unintentionally reverting
part of 21d9b079e538 "tools/libxl: Initialise the fd of the unused
half of a datacopier".
Put this back.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Andrew Cooper [Fri, 17 Jul 2015 16:51:17 +0000 (17:51 +0100)]
tools/libxl: Identify copywhat in stream v2 datacopiers
This is an aid to debugging
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Fri, 17 Jul 2015 16:51:16 +0000 (17:51 +0100)]
tools/libxl: Log the subject fd in datacopier messages
This is a substantial aid to debugging
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Fri, 17 Jul 2015 16:51:15 +0000 (17:51 +0100)]
tools/libxc: Identify the path of the kernel image which cannot be found
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
nr_mods is set in add_boot_module() to the number of module
array elements used. This function also ensures that nr_mods
never exceeds MAX_MODULES (the size of the array). When looping
through the array, the correct maximum index is "nr_mods-1",
not "nr_mods". If the array is full, using the latter will in
fact access beyond the end of the array.
This was done correctly in boot_module_find_by_kind() and
consider_modules() but incorrectly in discard_initial_modules()
and next_module().
Signed-off-by: Chris Brand <chris.brand@broadcom.com> Reviewed-by: Julien Grall <julien.grall@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
hotplugpath.sh by default is located in /usr/local/etc/xen/scripts on
FreeBSD. Instead of hardcoding it's location use the XEN_SCRIPT_DIR variable
like it's used on the xencommons rc.d script.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
be64toh and friends are declared in sys/endian.h on FreeBSD, so include it
as part of libxl_osdeps.h.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Yang Hongyang [Mon, 13 Jul 2015 08:45:45 +0000 (16:45 +0800)]
tools/libxl: Update libxl_domain_unpause() to support qemu-xen
Currently, libxl_domain_unpause() only supports
qemu-xen-traditional. Update it to support qemu-xen.
We use libxl__domain_resume_device_model to unpause guest dm.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Yang Hongyang [Mon, 13 Jul 2015 08:43:30 +0000 (16:43 +0800)]
tools/libxl: check QEMU state before resume dm
check QEMU state before resume dm on QEMU_XEN_TRADITIONAL.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Yang Hongyang [Fri, 10 Jul 2015 07:11:38 +0000 (15:11 +0800)]
libxl/remus: introduce libxl__remus_teardown
introduce libxl__remus_teardown to teardown Remus devices.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Yang Hongyang [Fri, 10 Jul 2015 06:57:52 +0000 (14:57 +0800)]
libxl/remus: introduce libxl__remus_setup
Refactoring Remus setup by introducing libxl__remus_setup API.
All Remus setup work are done in this function.
There is a subtle behavioural change here, which is that if anything
which is now done in _setup fails then the result is a call to
dss->callback( ..,..,ERROR_FAIL) rather than _start returning
AO_CREATE_FAIL(ERROR_FAIL). But this is correct and intended.
Also remove the libxl__ prefix for static functions.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Yang Hongyang [Fri, 10 Jul 2015 06:12:10 +0000 (14:12 +0800)]
tools/libxl: rename remus checkpoint callbacks
There are 2 remus checkpoint callbacks(save/restore), currently, they
both called libxl__remus_domain_checkpoint_callback in different
files, so it is ok. But in the following patch, we will move all of the
remus callback code into a separate file, the name should be different.
So rename them to:
libxl__remus_domain_{save/restore}_checkpoint_callback
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Yang Hongyang [Fri, 10 Jul 2015 04:11:54 +0000 (12:11 +0800)]
tools/libxl: move domain resume code into libxl_dom_suspend.c
move domain resume code into libxl_dom_suspend.c.
pure code move.
libxl__domain_resume_device_model() will be used later by COLO,
so we are not making this func static.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Yang Hongyang [Mon, 13 Jul 2015 02:24:30 +0000 (10:24 +0800)]
tools/libxl: move domain suspend code into libxl_dom_suspend.c
Move domain suspend code into a separate file libxl_dom_suspend.c.
Add an API libxl__domain_suspend() which wraps the static
function domain_suspend_callback_common() for internal use.
Export the existing API libxl__domain_suspend_callback() used by
libxc to suspend the guest during migration.
Note that the newly added file libxl_dom_suspend.c is used for
suspend/resume code.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Yang Hongyang [Wed, 3 Jun 2015 02:57:28 +0000 (10:57 +0800)]
tools/libxl: rename libxl__domain_suspend to libxl__domain_save
The suspend/save terminology used by libxc is more consistent.
"suspend" refers to quiescing the VM, so pausing qemu, making a
remote_shutdown(SHUTDOWN_suspend) hypercall etc.
"save" refers to the actions involved in actually shuffling the
state of the VM, so xc_domain_save() etc.
libxl currently uses "suspend" to encapsulate both. The patch
Rename libxl__domain_suspend() to libxl__domain_save() since it
actually refers to shuffling the state of the VM.
This results in some strangeness in that some functions called *save*
are now passed a struct called *suspend*, this is temporary and is all
fixed up later by the refactoring of the suspend_state.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Some comments, commit messages: Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
Andrew Cooper [Fri, 17 Jul 2015 16:59:09 +0000 (17:59 +0100)]
tools/libxl: Initialise the fd of the unused half of a datacopier
This bug causes a spurious failure if stdin happens to be an
appropriately readable/writeable pipe which receives a POLLHUP
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ian Campbell [Thu, 16 Jul 2015 16:58:27 +0000 (17:58 +0100)]
tools/hotplug: Add an initscript to start "xl devd" in a driver domain
The removal of the udev rules highlighted that although it has been
replaced by "xl devd" there isn't an initscript to replace it.
To enable this add a --pidfile option to xl devd.
Tested on Linux by running the script in dom0 and checking the daemon
was started/stopped, but not in an actual driver domain environment
since I don't have one conveniently available. I also checked that
running without the --pidfile option still works.
Scripts mainly cribbed from the xencommons for each platform.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad@darnok.org> Cc: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Thu, 16 Jul 2015 19:32:45 +0000 (20:32 +0100)]
tools/xl: Fix segfaults from `xl psr-cat-cbm-set` command line handling
The socket option takes a mandatory argument. Mark it as such, so
optarg isn't NULL when passed to trim(), which unconditionally
dereference it.
Range check optind against argc before blindly assuming that
argv[optind] and argv[optind+1] exist.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Chao Peng <chao.p.peng@linux.intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andrew Cooper [Thu, 16 Jul 2015 19:18:31 +0000 (20:18 +0100)]
tools/xl: Fix trim() following c/s e316316 "xl: Rewrite trim()"
c/s e316316 "xl: Rewrite trim()" uses the wrong indirection of
'output', causing memory corruption for all callers.
Introduce a new local variable, making the code more obviously
correct.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Mon, 15 Jun 2015 14:51:23 +0000 (15:51 +0100)]
xl: Rewrite trim()
This function would produce a NULL output pointer if the input was an
empty string, leading to a crash.
I don't think this is likely to be a security problem, as the two call
sites involve configuration options which callers are unlikely to
expose to other-than-fully-trusted input.
Also, the function would needlessly copy the input string (which I
care about not for performance reasons but because it makes the memory
handling more confusing), and would mishandle strings which contained
only predicate-true characters.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Ian Jackson [Mon, 15 Jun 2015 15:18:38 +0000 (16:18 +0100)]
xl: Do not ignore unparseable PCI BDFs
If xlu_pci_parse_bdf fails, abandon the domain creation, rather than
blundering on.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
---
v2: Print the offending supposed-BDF too.
Ian Campbell [Thu, 16 Jul 2015 08:50:07 +0000 (09:50 +0100)]
xen: arm: bootfdt: Avoid reading off the front of *_cells array
In device_tree_for_each_node the call to the callback was using
{address,size}_cells[depth - 1], which at depth 0 could read off the
front of the array.
We already handled this correctly in the rest of the loop so fixup
this instance as well.
Reported-by: Chris (Christopher) Brand <chris.brand@broadcom.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Chris (Christopher) Brand <chris.brand@broadcom.com> Reviewed-by: Julien Grall <julien.grall@citrix.com>
Eric Shelton [Sat, 11 Jul 2015 21:30:42 +0000 (17:30 -0400)]
libxl: set stub domain size based on VRAM size
Allocate additional memory to the stub domain for qemu-traditional if
more than 4 MB is assigned to the video adapter to avoid out of memory
condition for QEMU.
For LIBXL_VGA_INTERFACE_TYPE_STD + CIRRUS video_memkb is always at
least 4MB. However if LIBXL_VGA_INTERFACE_TYPE_STD is selected the
video_memkb defaults to 0, resulting in a stubdom which is 4MB smaller
than before. It seems unlikely that VGA disable would require more
memory then the other options, so this should be ok.
Signed-off-by: Eric Shelton <eshelton@pobox.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- added second paragraph of commit message ]
Ian Jackson [Wed, 15 Jul 2015 13:35:56 +0000 (14:35 +0100)]
libxl: events: Do not abort remus with ERROR_TIMEOUT
When the timeout set for prompting the next remus iteration fires, we
should not treat the ERROR_TIMEDOUT as an error.
Bug in 31c836f4 "libxl: events: Permit timeouts to signal ao abort".
Reported-by: Yang Hongyang <yanghy@cn.fujitsu.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Paul Durrant [Thu, 16 Jul 2015 09:50:41 +0000 (11:50 +0200)]
x86/hvm: unconditionally buffer writes to VRAM
When c/s 3bbaaec09 "unify stdvga mmio intercept with standard mmio
intercept" was added, a small semantic change was made. Prior to
this patch the hypervisor unconditionally sent all guest writes
to the VGA aperture as buffered ioreqs, whereas after the patch it
only does this when the VGA model is in 'stdvga' mode (sequencer
register #7 == 0).
When installing Windows 7 (64-bit) using the default QEMU VGA model
(== cirrus), Windows leaves 'stdvga' mode early in boot and hence
all further writes to the VGA aperture are done using synchronous
ioreqs which slows down boot by several orders of magnitude (thanks
to the elaborate splash screen that Windows presents). This can be
viewed as a regression and so this patch re-instates previous
buffering behaviour.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Tested-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
Elena Ufimtseva [Thu, 16 Jul 2015 09:50:07 +0000 (11:50 +0200)]
dmar: device scope mem leak fix
Release memory allocated for scope.devices dmar units on various
failure paths and when disabling dmar. Set device count after
sucessfull memory allocation, not before, in device scope parsing function.
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Yang Zhang <yang.z.zhang@intel.com>
Jan Beulich [Wed, 15 Jul 2015 16:05:02 +0000 (18:05 +0200)]
sysctl: adjust XEN_SYSCTL_numainfo behavior
... to match XEN_SYSCTL_cputopoinfo, allowing the caller to get what it
needs (if e.g. it's after the data for just one specific node) with
just one hypercall, without caring about the total number of nodes in
the system.
Suggested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Wed, 15 Jul 2015 16:04:00 +0000 (18:04 +0200)]
sysctl: adjust XEN_SYSCTL_cputopoinfo behavior
The new function's implementation, unlike the original one of
XEN_SYSCTL_topologyinfo, didn't allow the caller to get what it needs
(if e.g. it's after the data for just one specific CPU) with just one
hypercall, without caring about the total number of CPUs in the system.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ian Jackson [Wed, 15 Jul 2015 14:38:27 +0000 (15:38 +0100)]
libxl: event tests: Fix `=' vs `==' in fdderegrace
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jan Beulich [Wed, 15 Jul 2015 14:11:42 +0000 (16:11 +0200)]
make rangeset_report_ranges() report all ranges
find_range() returns NULL when s is below the lowest range, so we have
to use first_range() here (which is as good performance wise), or else
no range gets reported at all in that case.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
vm_event: deny register writes if refused by vm_event reply
Deny register writes if a vm_client subscribed to mov_to_msr or
control register write events forbids them. Currently supported for
MSR, CR0, CR3 and CR4 events.
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Tamas K Lengyel <tlengyel@novetta.com> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Added support for a new class of vm_events: VM_EVENT_REASON_REQUEST,
sent via HVMOP_request_vm_event. The guest can request that a
generic vm_event (containing only the vm_event-filled guest registers
as information) be sent to userspace by setting up the correct
registers and doing a VMCALL. For example, for a 32-bit guest, this
means: EAX = 34 (hvmop), EBX = 24 (HVMOP_guest_request_vm_event),
ECX = 0 (NULL required for the hypercall parameter, reserved).
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com> Acked-by: Tamas K Lengyel <tlengyel@novetta.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
This patch adds support for memory-content hiding, by modifying the
value returned by emulated instructions that read certain memory
addresses that contain sensitive data. The patch only applies to
cases where VM_FLAG_ACCESS_EMULATE has been set to a vm_event
response.
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com> Acked-by: Tamas K Lengyel <tlengyel@novetta.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Ian Campbell [Wed, 15 Jul 2015 11:43:00 +0000 (12:43 +0100)]
tools: libxc: Add nomigrate stubs for xc_domain_(save|restore)2.
Fixes the build on ARM after the switch to migration v2 in 210b4817529d "tools/libxc+libxl+xl: Save v2 streams" and 3a9ace0147d4 "tools/libxc+libxl+xl: Restore v2 streams".
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Wed, 15 Jul 2015 11:09:40 +0000 (12:09 +0100)]
tools/python: Correct the install path of the python scripts
c/s 74a7c7a was actually written long before c/s 2c96ecb "Use
configure --libexecdir=BASEDIR to set LIBEXEC", and I didn't notice
during development because of the method I was using to run a legacy
and migration v2 libxl toolstack side-by-side.
The result is that the conversion script gets installed in the root of
the output tree, rather than in the location libxl is expecting to
find it.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ian Jackson [Thu, 9 Jul 2015 16:24:25 +0000 (17:24 +0100)]
libxl: event tests: Introduce `fdderegrace' test
This exercises the potential race between fd deregistration and
poll(). (Because we have control of the individual steps, we can do
the whole test in a single thread and ensure that the pessimal order
is always reached.)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
Ian Jackson [Thu, 9 Jul 2015 17:25:25 +0000 (18:25 +0100)]
libxl: event tests: Contemplate separate tests
Split LIBXL_TESTS into two variables, each of which gets all of
LIBXL_TESTS, so that we can have tests which do use generic test
helper inside functions, rather than test-specific ones.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
It can happen that an fd is deregistered, and closed, and then a new
fd opened, and reregistered, all while another thread is in poll().
If this happens poll might report POLLNVAL, but the event loop would
think that the fd was supposed to have been valid, and then fail an
assertion:
libxl_event.c:1183: afterpoll_check_fd: Assertion `poller->fds_changed || !(fds[slot].revents & 0x020)' failed.
We can't simply ignore POLLNVAL because if we have bugs which cause
messed-up fds, it is a serious problem which we really need to detect.
Instead, add extra tracking to spot when this possibility arises, and
abort on POLLNVAL if we are sure that it is unexpected.
Reported-by: Jim Fehlig <jfehlig@suse.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Jim Fehlig <jfehlig@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Tested-by: Jim Fehlig <jfehlig@suse.com>
Ian Jackson [Thu, 9 Jul 2015 16:05:07 +0000 (17:05 +0100)]
libxl: poll: Use poller_get and poller_put for poller_app
This makes the code more regular. We are going to want to do some
more work in poller_get and poller_put, which work also wants to be
done for poller_app.
Two very minor functional changes:
* We call malloc an extra time since poller_app is now a pointer
* ERROR_FAIL on poller_get failing for poller_app is generated in
libxl_ctx_init rather than passed through by libxl_poller_init
from libxl__pipe_nonblock.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Jim Fehlig <jfehlig@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Tested-by: Jim Fehlig <jfehlig@suse.com>
Ian Jackson [Thu, 9 Jul 2015 15:52:02 +0000 (16:52 +0100)]
libxl: poll: Make libxl__poller_get have only one success return path
In preparation for doing some more work on successful exit.
No functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Jim Fehlig <jfehlig@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Tested-by: Jim Fehlig <jfehlig@suse.com>
Andrew Cooper [Sun, 14 Jun 2015 21:11:57 +0000 (22:11 +0100)]
tools/libxl: Drop all knowledge of toolstack callbacks
Libxl has now been fully adjusted not to need them.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Sun, 14 Jun 2015 19:14:01 +0000 (20:14 +0100)]
tools/libxc: Drop all XG_LIBXL_HVM_COMPAT code from libxc
Libxl has now been fully adjusted not to need it.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Sun, 14 Jun 2015 21:04:04 +0000 (22:04 +0100)]
tools/libxl: Handle checkpoint records in a libxl migration v2 stream
This is the final bit of untangling for Remus.
When libxc issues a checkpoint callback, start reading and buffering
all libxl records from the stream. Once a CHECKPOINT_END record is
encountered, start processing all records.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v4: Adjustments in line with review for earlier patches in the series
v3: Simplify, use named constants for API
And call it when a checkpoint record is found in the libxc stream.
Some parts of this patch have been based on patches from the COLO
series.
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v3: Named constants for the API
v2: Borrow sufficient fragments from several COLO patches to get
BROKEN_CHANNEL and checkpoint failover to function.
Andrew Cooper [Sun, 14 Jun 2015 20:29:15 +0000 (21:29 +0100)]
tools/libxl: Write checkpoint records into the stream
when signalled to do so by libxl__remus_domain_checkpoint_callback()
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v4: Adjustments in line with review for earlier patches in the series
v3: Corrections to comments
This patch has changed substantially in v2 as a result of changes earlier in
the series. No behavioural difference from v1.
Andrew Cooper [Sun, 14 Jun 2015 20:31:56 +0000 (21:31 +0100)]
docs/libxl: Introduce CHECKPOINT_END to support migration v2 remus streams
In a remus scenario, libxc will write a CHECKPOINT record, then hand
ownership of the fd to libxl. Libxl then writes any records required
and finishes with a CHECKPOINT_END record, then hands ownership of the
fd back to libxc.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Sun, 14 Jun 2015 15:36:11 +0000 (16:36 +0100)]
tools/libxc+libxl+xl: Save v2 streams
This is a complicated set of changes which must be done together for
bisectability.
* libxl-save-helper is updated to unconditionally use libxc migration v2.
* libxl compatibility workarounds in libxc are disabled for save operations.
* libxl__stream_write_start() is logically spliced into the event location
where libxl__xc_domain_save() used to reside.
* Ownership of the helper state moves into stream_write_state.
* xl is updated to indicate that the stream is now v2
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v4:
* Don't use _init() needlessly
v3: Many small changes, follwing similar review to the restore side
Ross Lagerwall [Sun, 14 Jun 2015 14:59:28 +0000 (15:59 +0100)]
tools/libxl: Infrastructure for writing a v2 stream
This contains the event machinery and state machines to write
non-checkpointed migration v2 stream (with the exception of the
xc_domain_save() handling which is spliced later in a bisectable way).
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Don't make _init() mandatory, use FILLZERO(), adjust stream_success()
v3: Similar changes to the read side, following the read side review.
Andrew Cooper [Fri, 12 Jun 2015 16:21:41 +0000 (17:21 +0100)]
tools/libxc+libxl+xl: Restore v2 streams
This is a complicated set of changes which must be done together for
bisectability.
* libxl-save-helper is updated to unconditionally use libxc migration
v2.
* libxl compatibility workarounds in libxc are disabled for restore
operations.
* libxl__stream_read_start() is logically spliced into the event
location where libxl__xc_domain_restore() used to reside.
* Ownership of the save_helper_state moves to stream_read_state.
The parameters 'hvm', 'pae', and 'superpages' were previously
superfluous, and are completely unused in migration
v2. callbacks->toolstack_restore is handled via a migration v2 record
now, rather than via a callback from libxc.
NB: this change breaks Remus. Further untangling needs to happen
before Remus will function.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v4:
* Don't use _init() needlessly
v3:
* Simplify from v2.
* Alter the ownership of save_helper_state
v2:
* Drop "legacy_width" from the IDL
* Gain a LIBXL_HAVE_ to signify support of migration v2 streams
Andrew Cooper [Sat, 13 Jun 2015 13:34:42 +0000 (14:34 +0100)]
tools/libxl: Convert a legacy stream if needed
For backwards compatibility, a legacy stream needs converting before
it can be read by the v2 stream logic.
This causes the v2 stream logic to need to juggle two parallel tasks.
check_all_finished() is introduced for the purpose of joining the
tasks in both success and error cases.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Alter logic layout in check_all_finished()
v3: Simplified greatly from v2. No practical change.
Andrew Cooper [Mon, 8 Sep 2014 14:24:59 +0000 (15:24 +0100)]
tools/libxl: Infrastructure to convert a legacy stream
Provide a thin wrapper around exec()ing the python conversion utility,
and a stub implementation for cases where conversion is not wanted
(i.e. not x86).
One complication is that the caller of this interface needs to assume
ownership of the output fd, to prevent it being closed while still in
use in a datacopier.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Formatting tweaks, description of the width field.
v3: Trimmed down massively from v2, provide libxl_no_convert_callout.c
Ross Lagerwall [Fri, 12 Jun 2015 17:19:00 +0000 (18:19 +0100)]
tools/libxl: Infrastructure for reading a libxl migration v2 stream
This contains the event machinery and state machines to read an act on
a non-checkpointed migration v2 stream (with the exception of the
xc_domain_restore() handling which is spliced later in a bisectable
way).
It also contains some boilerplate to help support checkpointed
streams, which shall be introduced in a later patch.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4:
* Don't make _init() mandatory
* Don't unilaterally clobber rc from datacopier callback
* Comment adjustments
* More assertions
v3: More descriptions of the internal state, shuffle function order, add
an _init() call, condense error handling
Ross Lagerwall [Mon, 1 Sep 2014 15:57:59 +0000 (16:57 +0100)]
tools/libxl: Migration v2 stream format
C structures describing the Libxl migration v2 stream format
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v2: Move into libxl__ namespace
Andrew Cooper [Mon, 18 May 2015 15:20:19 +0000 (16:20 +0100)]
tools/python: Conversion utility for legacy migration streams
This utility will take a legacy stream as in input, and produce a v2
stream as an output. It is exec()'d by libxl to provide backwards
compatibility.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Mon, 18 May 2015 15:08:17 +0000 (16:08 +0100)]
tools/python: Verification utility for v2 stream spec compliance
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
This is exceedingly useful for development, but not of practical use being
installed into a production dom0.
Andrew Cooper [Sun, 5 Jul 2015 18:52:21 +0000 (19:52 +0100)]
tools/python: Other migration infrastructure
Contains:
* Reverse-engineered notes of the legacy format from xg_save_restore.h
* Python implementation of the legacy format
* Public HVM Params used in the legacy stream
* XL header format
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
New in v2 - removes various many magic numbers from subsequent scripts
Andrew Cooper [Mon, 18 May 2015 14:56:10 +0000 (15:56 +0100)]
tools/python: Libxl migration v2 infrastructure
Contains:
* Python implementation of the libxl migration v2 records
* Verification code for spec compliance
* Unit tests
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Mon, 18 May 2015 14:55:57 +0000 (15:55 +0100)]
tools/python: Libxc migration v2 infrastructure
Contains:
* Python implementation of the libxc migration v2 records
* Verification code for spec compliance
* Unit tests
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Fri, 22 Aug 2014 12:15:32 +0000 (13:15 +0100)]
docs: Libxl migration v2 stream specification
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v3: Spelling fixes
Andrew Cooper [Fri, 5 Jun 2015 19:26:22 +0000 (20:26 +0100)]
tools/xl: Mandatory flag indicating the format of the migration stream
Introduced at this point so the python stream conversion code has a
concrete ABI to use. Later when libxl itself starts supporting a v2
stream, it will be added to XL_MANDATORY_FLAG_ALL.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
v2: Expand commit message
Andrew Cooper [Tue, 14 Jul 2015 09:38:46 +0000 (10:38 +0100)]
tools/libxl: Fix libxl__carefd_opened() to be more useful with an invalid fd
In the case that fd is -1, preserve errno and don't attempt to set
CLOEXEC.
Note that the implementation can still fail, as it ignores fcntl()
errors and may not set CLOEXEC properly. Update the documentation
accordingly until it is fixed.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> CC: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Fixing the fnctl() error issue involves more TUITs than I currently
have.
Andrew Cooper [Sat, 11 Jul 2015 13:05:35 +0000 (14:05 +0100)]
tools/libxl: Add save_helper_state pointers to libxl__xc_domain_{save,restore}()
Currently, libxl__xc_domain_{save,restore}() have specific knowledge
of where the libxl__save_helper_state lives inside a
libxl__domain_{create,save}_state object.
In later changes, the logical ownership of the
libxl__save_helper_state will change and will no longer be
d{c,s}s->shs.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
New in v3
Andrew Cooper [Tue, 9 Jun 2015 11:41:06 +0000 (12:41 +0100)]
tools/libxl: Extra management APIs for the save helper
With migration v2, there are several moving parts needing to be
juggled at once. This requires the error handling logic to be able to
query the state of each moving part, possibly before they have been
started, and be able to cancel them.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Don't force _init() to be mandatory
v3: Adjust helper_{stop,failed,done} to use libxl__save_helper_inuse()
v2: Add an _init() function which allows _inuse() to be safe to call even
before the save helper has started.
Andrew Cooper [Fri, 12 Jun 2015 20:12:40 +0000 (21:12 +0100)]
tools/libxl: Split libxl__domain_create_state.restore_fd in two
In a future patch, we shall support automatically converting a legacy
stream to a v2 stream, in which case libxc needs to read from a
different fd.
Simply overwriting restore_fd does not work; the two fd's have
different circumstances. The restore_fd needs to be returned to its
original state before libxl_domain_create_restore() returns, while in
the converted case, the fd needs allocating and deallocating
appropriately.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
New in v2
Andrew Cooper [Fri, 12 Jun 2015 18:23:45 +0000 (19:23 +0100)]
tools/libxl: Stash all restore parameters in domain_create_state
Shortly more parameters will appear, and this saves unboxing each one.
libxl_domain_restore_params is mandatory for restore streams, and
ignored for plain creation. The old 'checkpointed_stream' was
incorrectly identified as a private parameter when it was infact
public.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> Reviewed-by: Yang Hongyang <yanghy@cn.fujitsu.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
---
Since v1:
* Gate validity on restore_fd being valid.
Andrew Cooper [Tue, 30 Jun 2015 19:39:02 +0000 (20:39 +0100)]
tools/libxl: Introduce libxl__kill()
as a wrapper to kill(2), and use it in preference to sendsig in
libxl_save_callout.c.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v3: Fix typo, add _hidden
Logically new in v2 - split out from a v1 change which was itself a
cherrypick-and-modify from the AO Abort series
Andrew Cooper [Sat, 6 Jun 2015 14:46:54 +0000 (15:46 +0100)]
tools/libxl: Introduce ROUNDUP()
This is the same as is used by libxc.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Wed, 10 Jun 2015 13:55:18 +0000 (14:55 +0100)]
tools/libxc: Always compile the compat qemu variables into xc_sr_context
This is safe (as the variables will simply be unused), and is required
for correct compilation when midway through untangling the libxc/libxl
interaction.
The #define is left in place to highlight that the variables can be
removed once the untangling is complete.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com>
Ian Jackson [Thu, 9 Jul 2015 17:06:02 +0000 (18:06 +0100)]
bsd-sys-queue-h-seddery: Massage `offsetof'
For some reason BSD's queue.h uses `__offsetof'. It expects it to
work just like offsetof. So use offsetof.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Wei Liu [Tue, 14 Jul 2015 16:41:05 +0000 (17:41 +0100)]
libxl: turn two malloc's to libxl__malloc
One is to combine malloc + libxl__alloc_failed. The other is to avoid
dereferencing NULL pointer in case of malloc failure. Also use gc for
memory allocation and remove free() in second case.
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Mon, 13 Jul 2015 12:31:23 +0000 (13:31 +0100)]
tools: libxl: Handle failure to create qemu dm logfile
If libxl_create_logfile fails for some reason then
libxl__create_qemu_logfile previously just carried on and dereferenced
the uninitialised logfile.
Check for the error from libxl_create_logfile, which has already
logged for us.
This was reported as Debian bug #784880.
Reported-by: Russell Coker <russell@coker.com.au> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: 784880@bugs.debian.org Acked-by: Wei Liu <wei.liu2@citrix.com>
Jan Beulich [Tue, 14 Jul 2015 13:20:15 +0000 (15:20 +0200)]
x86/HVM: drop now wrong ASSERT() from hvm_broadcast_ioreq()
The function is now also being used for IOREQ_TYPE_TIMEOFFSET.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
phys_proc_id is invalidated in remove_siblinginfo() which gets called
before cpu_smpboot_free(). This means calling cpu_to_socket(cpu) in
cpu_smpboot_free() is not possible to be correct.
This patch moves the invalidating of phys_proc_id from
remove_siblinginfo() to cpu_smpboot_free() so that cpu_to_socket(cpu)
can be used in cpu_smpboot_free().
The same is done for cpu_core_id/compute_unit_id and due to that
cpu_sibling_setup_map is private to the file so it's moved as well.
Tamas K Lengyel [Mon, 13 Jul 2015 11:46:31 +0000 (13:46 +0200)]
MAINTAINERS: support for xen-access and email change
Add tools/tests/xen-acess to the supported list under VM EVENT/MEM ACCESS.
Also, changing my e-mail to the preferred one, as it is in many of the headers
already.
Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com> Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ben Catterall [Mon, 13 Jul 2015 10:27:29 +0000 (12:27 +0200)]
convert map_domain_page() to use the new mfn_t type
Reworked the internals and declaration, applying (un)boxing
where needed. Converted calls to map_domain_page() to
provide mfn_t types, boxing where needed.
Signed-off-by: Ben Catterall <Ben.Catterall@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
The problem here is the call to hvm_mmio_internal() being made by
__hvm_copy().
When the emulated VRAM access was originally started by
hvm_io_intercept() a few frames up the stack, it would have called
stdvga_mem_accept() which would then have acquired the per-domain
stdvga lock. Unfortunately the call to hvm_mmio_internal(), to avoid
a costly P2M walk, speculatively calls stdvga_mem_accept() again to
see if the page handed to __hvm_copy() is actually an internally
emulated page and hence the vcpu deadlocks.
The fix is to do the range-check in stdvga_mem_accept() without taking
the stdvga lock. This is safe because the range is constant and we know
the I/O will never actually be accepted by the stdvga device model
because hvmemul_do_io_addr() makes sure that the source of the I/O is
actually RAM.
Reported-by: Razvan Cojocaru <rcojocaru@bitdefender.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>