]> xenbits.xensource.com Git - xen.git/log
xen.git
11 years agolibxl: doc comment: clarify SIGCHLD demultiplexing requirements
Ian Jackson [Mon, 25 Nov 2013 11:53:28 +0000 (11:53 +0000)]
libxl: doc comment: clarify SIGCHLD demultiplexing requirements

Update the comment to clarify that libxl_sigchld_owner_libxl_always
implies having only one libxl_ctx, and that
libxl_sigchld_owner_mainloop requires one call to
libxl_childproc_exited per ctx.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agofirmware/vgabios: Fix incorrect formatting string
Andrew Cooper [Mon, 25 Nov 2013 11:04:21 +0000 (11:04 +0000)]
firmware/vgabios: Fix incorrect formatting string

bios_len is an long, so requires %ld rather than %d.

Coverity ID: 1055813

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agofirmware/tcgbios: Prevent integer truncation in the return value
Andrew Cooper [Mon, 25 Nov 2013 11:04:20 +0000 (11:04 +0000)]
firmware/tcgbios: Prevent integer truncation in the return value

rc inside the function is uint32_t.  None of the callers check the return
value.

Coverity ID: 1055442

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoxl: fixes for do_daemonize
Roger Pau Monne [Fri, 22 Nov 2013 11:54:09 +0000 (12:54 +0100)]
xl: fixes for do_daemonize

Fix usage of CHK_ERRNO in do_daemonize and also remove the usage of a
bogus for(;;).

Coverity-ID: 1130516 and 1130520
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: fix fd check in libxl__spawn_local_dm
Roger Pau Monne [Fri, 22 Nov 2013 11:54:08 +0000 (12:54 +0100)]
libxl: fix fd check in libxl__spawn_local_dm

Checking the logfile_w fd for -1 on failure is no longer true, because
libxl__create_qemu_logfile will now return ERROR_FAIL on failure which
is -3.

While there also add an error check for opening /dev/null.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agopvh support for gdbsx
Mukesh Rathor [Sat, 23 Nov 2013 00:48:06 +0000 (16:48 -0800)]
pvh support for gdbsx

Add pvh support to gdbsx so it can be used to debug pvh domUs.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
11 years agox86/hvm: clean up segment validation
Jan Beulich [Tue, 26 Nov 2013 08:54:48 +0000 (09:54 +0100)]
x86/hvm: clean up segment validation

Use _SEGMENT_* instead of plain numbers where feasible.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86/hvm: fix segment validation
Tim Deegan [Tue, 26 Nov 2013 08:54:21 +0000 (09:54 +0100)]
x86/hvm: fix segment validation

Also Coverity CID 1055180.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Use _SEGMENT_* instead of plain numbers and adjust a comment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86/pvh: set only minimal cr0 and cr4 flags in order to use paging
Roger Pau Monné [Tue, 26 Nov 2013 08:52:47 +0000 (09:52 +0100)]
x86/pvh: set only minimal cr0 and cr4 flags in order to use paging

Right now Xen sets the WP and NE flags on cr0 for PVH, which are not
needed in order to boot with paging enabled. The same happens with
cr4, at least on my system OSFXSR, OSXMMEXCPT and MCE are enabled by
default when there's no need.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
11 years agotools/libxl: Fix memory leak in sched_domain_output()
Andrew Cooper [Mon, 25 Nov 2013 11:16:48 +0000 (11:16 +0000)]
tools/libxl: Fix memory leak in sched_domain_output()

Coverity ID: 1055904

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
11 years agotools/libxl: Fix integer overflows in sched_sedf_domain_set()
Andrew Cooper [Mon, 25 Nov 2013 11:12:51 +0000 (11:12 +0000)]
tools/libxl: Fix integer overflows in sched_sedf_domain_set()

Coverity ID: 1055662 1055663 1055664

Widen from int to uint64_t before multiplcation, rather than afterwards.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/libxl: Avoid deliberate NULL pointer dereference
Andrew Cooper [Mon, 25 Nov 2013 11:12:50 +0000 (11:12 +0000)]
tools/libxl: Avoid deliberate NULL pointer dereference

Coverity ID: 1055290

Calling LIBXL__LOG_ERRNO(ctx,) with a ctx pointer we have just failed to
allocate is going to end badly.  Opencode a suitable use of xtl_log() instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xenstored: Don't leak a file handle when creating the pidfile
Andrew Cooper [Mon, 25 Nov 2013 11:07:44 +0000 (11:07 +0000)]
tools/xenstored: Don't leak a file handle when creating the pidfile

Coverity ID: 1055849

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xenstore-rm: Fix memory leaks
Andrew Cooper [Mon, 25 Nov 2013 11:07:42 +0000 (11:07 +0000)]
tools/xenstore-rm: Fix memory leaks

Coverity ID: 1055935

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xenstore: Fix 15 potential resource leaks in build()
Andrew Cooper [Mon, 25 Nov 2013 11:07:41 +0000 (11:07 +0000)]
tools/xenstore: Fix 15 potential resource leaks in build()

Coverity ID: 1055933 1055934

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/xenconsoled: Fix file handle leaks
Andrew Cooper [Mon, 25 Nov 2013 11:06:39 +0000 (11:06 +0000)]
tools/xenconsoled: Fix file handle leaks

Coverity ID: 715218 1055876 1055877

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xenconsole: Use xc_domain_getinfo() correctly
Andrew Cooper [Mon, 25 Nov 2013 11:06:38 +0000 (11:06 +0000)]
tools/xenconsole: Use xc_domain_getinfo() correctly

Coverity ID: 1055018

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xen-mfndump: Avoid using -ERROR as an upper loop bound
Andrew Cooper [Mon, 25 Nov 2013 11:05:51 +0000 (11:05 +0000)]
tools/xen-mfndump: Avoid using -ERROR as an upper loop bound

Coverity ID: 1090375

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xen-mfndump: Avoid munmap(NULL, PAGE_SIZE) on certain error paths
Andrew Cooper [Mon, 25 Nov 2013 11:05:50 +0000 (11:05 +0000)]
tools/xen-mfndump: Avoid munmap(NULL, PAGE_SIZE) on certain error paths

Coverity ID 1090361 1090362 1090363

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/libxc: Improve xc_dom_malloc_filemap() error handling
Andrew Cooper [Mon, 25 Nov 2013 11:05:49 +0000 (11:05 +0000)]
tools/libxc: Improve xc_dom_malloc_filemap() error handling

Coverity ID 1055563

In the original function, mmap() could be called with a length of -1 if the
second lseek failed and the caller had not provided max_size.

While fixing up this error, improve the logging of other error paths.  I know
from personal experience that debugging failures function is rather difficult
given only "xc_dom_malloc_filemap: failed (on file <somefile>)" in the logs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/xenctx: Prevent leaking a file handle on error paths
Andrew Cooper [Mon, 25 Nov 2013 11:05:48 +0000 (11:05 +0000)]
tools/xenctx: Prevent leaking a file handle on error paths

Coverity ID: 1126110

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/xc_restore: Initialise console and store mfns
Andrew Cooper [Mon, 25 Nov 2013 11:05:47 +0000 (11:05 +0000)]
tools/xc_restore: Initialise console and store mfns

If the console or store mfn chunks are not present in the migration stream,
stack junk gets reported for the mfns.

XenServer had a very hard to track down VM corruption issue caused by exactly
this issue.  Xenconsoled would connect to a junk mfn and incremented the ring
pointer if the junk happend to look like a valid gfn.

Coverity ID: 1056093 1056094

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agox86/pvh: change epte_get_entry_emt() for pvh mem types
Mukesh Rathor [Mon, 25 Nov 2013 10:20:06 +0000 (11:20 +0100)]
x86/pvh: change epte_get_entry_emt() for pvh mem types

For pvh guests, epte_get_entry_emt() is incorrectly returning WB for
all mem types because of the following check:
    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
Skip the check for pvh guests.

Also note, MTRR ranges are not maintained for pvh, and a solution is
being contrived using PAT.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Reviewed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/xsave: fix nonlazy state handling
Liu Jinsong [Mon, 25 Nov 2013 10:19:04 +0000 (11:19 +0100)]
x86/xsave: fix nonlazy state handling

Nonlazy xstates should be xsaved each time when vcpu_save_fpu.
Operation to nonlazy xstates will not trigger #NM exception, so
whenever vcpu scheduled in it got restored and whenever scheduled
out it should get saved.

Currently this bug affects AMD LWP feature, and later Intel MPX
feature. With the bugfix both LWP and MPX will work fine.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Furthermore, during restore we also need to set nonlazy_xstate_used
according to the incoming accumulated XCR0.

Also adjust the changes to i387.c such that there won't be a pointless
clts()/stts() pair.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/pvh: clearly specify used parameters in vcpu_guest_context
Roger Pau Monné [Mon, 25 Nov 2013 10:17:03 +0000 (11:17 +0100)]
x86/pvh: clearly specify used parameters in vcpu_guest_context

The aim of this patch is to define a stable way in which PVH is
going to do AP bringup.

Since we are running inside of a HVM container, PVH should only need
to set flags, cr3 and user_regs in order to bring up a vCPU, the rest
can be set once the vCPU is started using the bare metal methods.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoevtchn/fifo: only set READY for new heads
David Vrabel [Mon, 25 Nov 2013 10:15:05 +0000 (11:15 +0100)]
evtchn/fifo: only set READY for new heads

Setting a queue's READY bit for every event added to the queue
introduces a race.

If an event is added to the tail of a queue, the guest may consume the
newly added event and leave an empty queue before the READY is set.
The guest may then see a stale HEAD value and if the event at the
stale head became linked onto a different queue, the guest would
consume events from the wrong queue (corrupting it).

As noted in section 4.1.2 of the design document, only set READY if a
new HEAD is set.  This ensures that if the guest sees a READY bit set
the corresponding HEAD is valid.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
11 years agoxen: arm: early logging of command line
Ian Campbell [Fri, 22 Nov 2013 16:24:27 +0000 (16:24 +0000)]
xen: arm: early logging of command line

Helpful for diagnosis of bad console= parameters.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoxen: arm: correct name of the dt node passed around when building dom0 DT
Ian Campbell [Fri, 22 Nov 2013 15:25:18 +0000 (15:25 +0000)]
xen: arm: correct name of the dt node passed around when building dom0 DT

In the case of the GIC, timer and write_properties the argument is the node,
not the parent. Rename the argument to "node" in this case.

I think this stems from the use of the name "np" in other places (confusing
"node parent" for "node pointer").  Therefore replace all uses of "np" with
"node".

In addition in write_properties now that np=>node the name pp makes no sense.
Rename it to "prop".

No semantic change.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: remove /xen-core-devices node from dom0 dtb
Ian Campbell [Fri, 22 Nov 2013 15:07:01 +0000 (15:07 +0000)]
xen: arm: remove /xen-core-devices node from dom0 dtb

The intention of adding this node to contain the GIC, timer and memory nodes
(in 1c08d6004ea7) was to allow us to control the #address-cells and

However in the case of the memory node the #*-cells are always taken from the
root node (see ePAPR 3.1, "the following nodes shall be present at the root...
memory node"). This caused breakage on the arndale platform.

In addition it is not valid to just create sub-nodes like this. Unless they
declare themselves as a bus then they will not necessarily be enumerated
(although Linux currently does so in practice).

Therefore:
 - Move the memory node back to the top level.
 - Insert the timer and primary gic nodes in the same location as the host
   DTB, replacing the originals. Note that the nodes here may be marked as in
   use by Xen and therefore the check must be before we discard nodes used by
   Xen.
 - Drop any secondary gics.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Julien Grall <julien.grall@linaro.org>
11 years agoMerge branch 'for-4.4.tmem' of git://xenbits.xen.org/people/konradwilk/xen into staging
Jan Beulich [Fri, 22 Nov 2013 14:27:19 +0000 (15:27 +0100)]
Merge branch 'for-4.4.tmem' of git://xenbits.xen.org/people/konradwilk/xen into staging

11 years agox86/crash: disable the watchdog NMIs on the crashing cpu
David Vrabel [Fri, 22 Nov 2013 13:48:12 +0000 (14:48 +0100)]
x86/crash: disable the watchdog NMIs on the crashing cpu

nmi_shootdown_cpus() is called during a crash to park all the other
CPUs.  This changes the NMI trap handlers which means there's no point
in having the watchdog still running.

This also disables the watchdog before executing any crash kexec image
and prevents the image from receiving unexpected NMIs.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
PVOps Linux as a kexec image shoots itself in the foot otherwise.

On a Core2 system, Linux declares a firmware bug and tries to invert some bits
in the performance counter register.  It ends up setting the number of retired
instructions to generate another NMI to fewer instructions than the NMI
interrupt path itself, and ceases to make any useful progress.

The call to disable_lapic_nmi_watchdog() must be this late into the kexec path
to be sure that this cpu is the one which will execute the kexec image.
Otherwise there are race conditions where the NMIs might be disabled on the
wrong cpu, resulting in the kexec image still receiving NMIs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86/hvm: reset TSC to 0 after domain resume from S3
Tomasz Wroblewski [Fri, 22 Nov 2013 13:47:24 +0000 (14:47 +0100)]
x86/hvm: reset TSC to 0 after domain resume from S3

Host S3 implicitly resets the host TSC to 0, but the tsc offset for hvm
domains is not recalculated when they resume, causing it to go into
negative values. In Linux guest using tsc clocksource, this results in
a hang after wrap back to positive values since the tsc clocksource
implementation expects it reset.

Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
11 years agox86/stack: change show_stack_overflow() to use frame pointers if available
Andrew Cooper [Fri, 22 Nov 2013 12:38:44 +0000 (13:38 +0100)]
x86/stack: change show_stack_overflow() to use frame pointers if available

Pass a full set of cpu_user_regs, and defer the hand-coded stack printing to
_show_trace(), which will correctly use frame pointers if available.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/stack: adjust boundary conditions for printed stacks
Andrew Cooper [Fri, 22 Nov 2013 12:37:25 +0000 (13:37 +0100)]
x86/stack: adjust boundary conditions for printed stacks

Move the boundary into current.h along with the other stack manipulation code.
The boundary is now the word adjacent to a struct cpu_info on the stack.

This also fixes the somewhat spurious bounds for the case with frame pointers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/stack: refactor show_trace()
Andrew Cooper [Fri, 22 Nov 2013 12:36:47 +0000 (13:36 +0100)]
x86/stack: refactor show_trace()

Before, show_trace() had two implementations depending on
CONFIG_FRAME_POINTER.  Some parts were common, while the loops to wander up
the stack were different.

The version aided by frame pointers had a special case for function calls on
wild function pointers, but this doesn't need to be a special case.

After the refactoring, there are now two implementations of _show_trace()
which differ depending on CONFIG_FRAME_POINTER, and a single show_trace()
with the common bits, including the logic for wild function pointers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years ago.gitignore: Ignore tools/ocaml/libs/xentoollog/ build outputs
Ian Jackson [Thu, 21 Nov 2013 18:59:22 +0000 (18:59 +0000)]
.gitignore: Ignore tools/ocaml/libs/xentoollog/ build outputs

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: event system: properly register the SIGCHLD self-pipe
Ian Jackson [Tue, 5 Nov 2013 17:32:06 +0000 (17:32 +0000)]
libxl: event system: properly register the SIGCHLD self-pipe

An application which uses libxl_osevent_register_hooks, and doesn't
use libxl_sigchld_owner_mainloop, would never properly experience the
deaths of its (libxl) children.

This is because the SIGCHLD self pipe would be handled using ad-hoc
code in beforepoll_internal and afterpoll_internal.  However, this is
no good if application is using the fd registration system instead; in
that case these functions would not be called and nothing would deal
with readability of the self pipe.

Fix this as follows:

The SIGCHLD self pipe now is now dealt with by a standard libxl__ev_fd
handler, which is registered and deregistered along with the SIGCHLD
handler itself.  The handler function subsumes the ad-hoc response
code removed from beforepoll_internal, and the functionality of
libxl__fork_selfpipe_woken.

This is also tidier as the SIGCHLD self pipe is no longer touched
outside libxl_fork.c other than in ctx initialisation and teardown.

(The ad-hoc arrangements for poller->wakeup_pipe in
beforepoll_internal and afterpoll_internal are OK because the
libxl__poller mechanism exists to wake up threads which are sitting
inside libxl's poll loop, so is not applicable to the application's
event loop.)

Reported-by: Bamvor Jian Zhang <bjzhang@suse.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Bamvor Jian Zhang <bjzhang@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
11 years agolibxl: event system: Make libxl_sigchld_owner_libxl_always work
Ian Jackson [Tue, 5 Nov 2013 16:43:59 +0000 (16:43 +0000)]
libxl: event system: Make libxl_sigchld_owner_libxl_always work

Previously, libxl_sigchld_owner_libxl_always was mishandled.  It would
result in libxl paying no attention to the sigchld self pipe.

Fix this by fixing chldmode_ours so that it returns true iff we are
supposed to be handling SIGCHLD.

Additionally, we arrange to use chldmode_ours everywhere where we are
installing/removing signal handlers and/or deciding whether to check
the self pipe, etc.  This means it needs a new "creating" flag
argument for the benefit of libxl__ev_child_fork, which needs to
install the signal handler in libxl_sigchld_owner_libxl even if there
are not currently any children.

ctx->childproc_hooks->chldowner is now interpreted only by
chldmode_ours.

Reported-by: Bamvor Jian Zhang <bjzhang@suse.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Bamvor Jian Zhang <bjzhang@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
---
v2: Get sense of chldmode test right in perhaps_removehandler (!)

11 years agolibxl: event system: pass gc, not just ctx, to internal sigchld manipulators
Ian Jackson [Tue, 5 Nov 2013 16:17:42 +0000 (16:17 +0000)]
libxl: event system: pass gc, not just ctx, to internal sigchld manipulators

We are going to want the gc for libxl__ev_fd_register.

No functional change in this patch.  Simply change the argument types,
and the actual arguments from ctx to gc.  Inside these functions, use
CTX (the macro which uses gc) rather than the old formal parameter
ctx.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
11 years agohotplug/Linux: update to new ip command syntax.
Mike [Fri, 16 Aug 2013 14:31:43 +0000 (15:31 +0100)]
hotplug/Linux: update to new ip command syntax.

The current usage prevents naming a vif "dev". Although the current syntax is
documented in Squeeze's ip(8) it appears that this was a documentation bug.
Newer versions of the man page describe the new syntax used here and Squeeze's
implementation accepts it as well.

This is Debian bug #705659.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705659

Mike provided the initial patch to tools/hotplug/Linux/xen-network-common.sh
and Ian extended it to catch some cases in vif-* too.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Mike <debian@good-with-numbers.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agolibxl: fix use of aodev->dev after free
Roger Pau Monne [Thu, 21 Nov 2013 16:18:00 +0000 (17:18 +0100)]
libxl: fix use of aodev->dev after free

Coverity-ID: 1130521
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: arm: ensure DTB is page aligned
Ian Campbell [Wed, 20 Nov 2013 09:45:32 +0000 (09:45 +0000)]
libxl: arm: ensure DTB is page aligned

xc_dom_alloc_segment requires this. Since rambase and ramend are both page
aligned, rounding up the DTB is sufficient.

Reported-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: Check if the range is valid in init_domheap_pages
Julien Grall [Wed, 13 Nov 2013 13:37:50 +0000 (13:37 +0000)]
xen: Check if the range is valid in init_domheap_pages

On ARM, when an initrd is given to xen by U-boot, it will reserve the memory
in the device tree.
In this case, when xen decides to free unused memory, dt_unreserved_regions
will call init_domheap_pages with the start and the end of range equals. But
the latter assumes that (start > end), if not Xen will hang because the
number of pages is equals to (unsigned)-1.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Ian Campbell <Ian.campbell@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
11 years agoxen/arm: gic: don't use dom0 variable in gicv_setup
Julien Grall [Tue, 19 Nov 2013 17:55:45 +0000 (17:55 +0000)]
xen/arm: gic: don't use dom0 variable in gicv_setup

The commit 99bf30a "xen: arm: define guest virtual platform in API headers"
modifies gicv_setup to either use harcoded addresses for guest or hardware
addresses for dom0. In the latter case, the variable dom0 is not yet
initialized. dom0 receives assignment by the return of domain_create which
calls gicv_setup.
Use the ID to know whether the domain is dom0 or not.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoMerge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging
Ian Campbell [Tue, 19 Nov 2013 16:41:28 +0000 (16:41 +0000)]
Merge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging

11 years agolibxl: build a device tree for ARM guests
Ian Campbell [Tue, 19 Nov 2013 13:00:24 +0000 (13:00 +0000)]
libxl: build a device tree for ARM guests

Uses xc_dom_devicetree_mem which was just added. The call to this needs to be
carefully sequenced to be after xc_dom_parse_image (so we can tell which kind
of guest we are building, although we don't use this yet) and before
xc_dom_mem_init which tries to decide where to place the FDT in guest RAM.

Removes libxl_noarch which would only have been used by IA64 after this
change. Remove IA64 as part of this patch.

There is no attempt to expose this as a configuration setting for the user.

Includes a debug hook to dump the dtb to a file for inspection.

On v7 the CPU compat is currently hardcoded to cortex-a15. This likely wants
to change at some point.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agolibxc: arm64 vcpu initialisation
Ian Campbell [Tue, 19 Nov 2013 13:00:23 +0000 (13:00 +0000)]
libxc: arm64 vcpu initialisation

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agolibxc: support for arm64 Image format
Ian Campbell [Tue, 19 Nov 2013 13:00:22 +0000 (13:00 +0000)]
libxc: support for arm64 Image format

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agolibxc: arm: allow passing a device tree blob to the guest
Ian Campbell [Tue, 19 Nov 2013 13:00:21 +0000 (13:00 +0000)]
libxc: arm: allow passing a device tree blob to the guest

Placement of the blob in guest RAM is simplistic but will do for now.

This operation is only supported on ARM.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agolibxc: allow caller to specify guest rambase rather than hardcoding
Ian Campbell [Tue, 19 Nov 2013 13:00:20 +0000 (13:00 +0000)]
libxc: allow caller to specify guest rambase rather than hardcoding

It's still hardcoded but it could now be plausibly be made variable.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxc: arm: rename various bits of zimage load with 32 suffix
Ian Campbell [Tue, 19 Nov 2013 13:00:19 +0000 (13:00 +0000)]
libxc: arm: rename various bits of zimage load with 32 suffix

Making room for a 64 bit implementation.

Also fix a typo and stop refering to it as a bzImage, which is an x86-ism.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: define guest virtual platform in API headers
Ian Campbell [Tue, 19 Nov 2013 13:00:18 +0000 (13:00 +0000)]
xen: arm: define guest virtual platform in API headers

The tools and the hypervisor need to agree on various aspects of the guest
environment, such as interrupt numbers, memory layout, initial register values
for registers which are implementation defined etc. Therefore move the
associated defines into the public interface headers, or create them as
necessary.

This just exposes the current de-facto standard guest layout, which may be
subject to change in the future. This deliberately does not make the guest
layout dynamic since there is currently no need.

These values should not be exposed to guests, they should find these things
out via device tree or should not be relying on implementation defined
defaults.

Various bits of the hypervisor needed to change to configure dom0 with the real
platform values while using the virtual platform configuration for guests.
Arrange for this where appropriate and plumb through as needed.

We also need to expose some 64-bit values (e.g. PSR_GUEST64_INIT) for the
benefit of 32 bit toolstacks building 64 bit guests.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agotools: check for libfdt when building for ARM
Ian Campbell [Tue, 19 Nov 2013 13:00:17 +0000 (13:00 +0000)]
tools: check for libfdt when building for ARM

libxl is going to want this to aid in the creation of guest device tree blobs.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoxen: arm: implement arch_set_info_guest for 64-bit vcpus
Ian Campbell [Tue, 19 Nov 2013 13:00:16 +0000 (13:00 +0000)]
xen: arm: implement arch_set_info_guest for 64-bit vcpus

This all seems too easy...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: implement XEN_DOMCTL_set_address_size
Ian Campbell [Tue, 19 Nov 2013 13:00:15 +0000 (13:00 +0000)]
xen: arm: implement XEN_DOMCTL_set_address_size

This is subarch specific to plumb through to arm32 and arm64 versions.

The toolstack uses this to select 32- vs 64-bit guests (or rather it does on
x86 and soon will for arm too).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: include header for for arch_do_{sys, dom}ctl prototype
Ian Campbell [Tue, 19 Nov 2013 13:00:14 +0000 (13:00 +0000)]
xen: arm: include header for for arch_do_{sys, dom}ctl prototype

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoxen: arm: add enable-method to cpu nodes for arm64 guests.
Ian Campbell [Tue, 19 Nov 2013 13:00:13 +0000 (13:00 +0000)]
xen: arm: add enable-method to cpu nodes for arm64 guests.

This is required by the Linux arm64 boot protocol.

We use PSCI.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: allocate dom0 memory separately from preparing the dtb
Ian Campbell [Tue, 19 Nov 2013 13:00:12 +0000 (13:00 +0000)]
xen: arm: allocate dom0 memory separately from preparing the dtb

Mixing these two together is a pain, it forces us to prepare the dtb before
processing the kernel which means we don't know whether the guest is 32- or
64-bit while we construct its DTB.

Instead split out the memory allocation (including 1:1 workaround handling)
and p2m setup into a separate phase and then create a memory node in the DTB
based on the result.

This allows us to move kernel parsing before DTB setup.

As part of this it was also necessary to rework where the decision regarding
the placement of the DTB and initrd in RAM was made. It is now made when
loading the kernel, which allows it to make use of the zImage/ELF specific
information and therefore to make decisions based on complete knowledge and do
it right rather than guessing in prepare_dtb and relying on a later check to
see if things worked.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: move dom0 gic and timer device tree nodes under /xen-core-devices/
Ian Campbell [Tue, 19 Nov 2013 13:00:11 +0000 (13:00 +0000)]
xen: arm: move dom0 gic and timer device tree nodes under /xen-core-devices/

Julien observed that we were relying on the provided host DTB supplying
suitable #address-cells and #size-cells values to allow us to represent these
addresses, which may not reliably be the case. Moving these under our own
known (somewhat analogous to the use of /soc/ or /motherboard/ on some
platforms) allows us to control these sizes.

Since the new node is created out of thin air it does not have a corresponding
struct dt_device_node and therefore we cannot use dt_n_addr_cells or
dt_n_size_cells, we can use hardcoded constants instead. For the same reason
we define and use set_xen_range instead of dt_set_range.

The hypervisor, cpus and psci node all either defined #foo-cells for their
children or do not contain reg properties and therefore can remain at the top
level.

The logging in make_gic_node was inconsistent. Fix it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: Add comment regard arm64 zImage v0 vs v1
Ian Campbell [Tue, 19 Nov 2013 13:00:10 +0000 (13:00 +0000)]
xen: arm: Add comment regard arm64 zImage v0 vs v1

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: Report aarch64 capability.
Ian Campbell [Tue, 19 Nov 2013 13:00:09 +0000 (13:00 +0000)]
xen: arm: Report aarch64 capability.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen/arm: Panic if we are unable to initialize platform timer
Julien Grall [Fri, 15 Nov 2013 15:27:37 +0000 (15:27 +0000)]
xen/arm: Panic if we are unable to initialize platform timer

The caller of xen_init_time, start_xen, doesn't check the return value
of the function. Xen will silently ignore the error and continue.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Panic if platform initialization failed
Julien Grall [Fri, 15 Nov 2013 15:27:36 +0000 (15:27 +0000)]
xen/arm: Panic if platform initialization failed

Actually, if an error occurs, Xen will silently ignore it and continue.
Convert platform_init to a void function and panic if we fail to
correctly initialize the platform.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: ioremap_attr: return NULL is __vmap failed
Julien Grall [Mon, 18 Nov 2013 13:08:23 +0000 (13:08 +0000)]
xen/arm: ioremap_attr: return NULL is __vmap failed

Most of ioremap_* caller check if ioremap returns NULL. Actually, if the
physical address is non-aligned, Xen will return the pointer given by
__vmap plus the offset in the page. So if ioremap_* fails, the caller
will retrieve an non-NULL address and continue as if there was no error.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agox86: fix emulation of indirect far calls and jumps
Jan Beulich [Tue, 19 Nov 2013 15:59:49 +0000 (16:59 +0100)]
x86: fix emulation of indirect far calls and jumps

Commit 86781624 ("x86_emulate: PUSH <mem> must read source operand
just once") corrected the operands of those of the operations of opcode
extension group 5 that only read memory from SrcMem to DstMem, but
failed to also switch the use of "dst" here to "src".

Reported-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Anthony Perard <anthony.perard@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoarinc: whitespace and formatting fixes
Nathan Studer [Tue, 19 Nov 2013 15:58:32 +0000 (16:58 +0100)]
arinc: whitespace and formatting fixes

Remove the excessive amount of trailing whitespace in the
arinc653 scheduler file and add a local variables block.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Nathan Studer <nate.studer@dornerworks.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoxen/arm: correct duplicate MPIDR check to actually skip the node
Matthew Daley [Fri, 8 Nov 2013 00:32:03 +0000 (13:32 +1300)]
xen/arm: correct duplicate MPIDR check to actually skip the node

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen/arm: p2m: flush TLB by VMID when a new domain is creating
Julien Grall [Thu, 14 Nov 2013 17:00:34 +0000 (17:00 +0000)]
xen/arm: p2m: flush TLB by VMID when a new domain is creating

Once the VMID is marked unused, a new domain can reuse the VMID for its
own. If the TLB is not flushed, entries can contain wrong translation.
When a new p2m is allocated, switch to the new VMID and flush TLB on
every physical CPUs.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoopw: libxl: use CTX macro in libxl_utils.c
Kelley Nielsen [Mon, 11 Nov 2013 23:24:00 +0000 (15:24 -0800)]
opw: libxl: use CTX macro in libxl_utils.c

The new coding style uses the convenience macro CTX as declared in
libxl_internal.h. Substitute an invocation of this macro for its
body at the two places it occurs in libxl_utils.c.

Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: use LOG instead of LIBXL__LOG in libxl_utils.c
Kelley Nielsen [Mon, 11 Nov 2013 23:23:56 +0000 (15:23 -0800)]
libxl: use LOG instead of LIBXL__LOG in libxl_utils.c

To conform to the new coding style, replace the invocation of
LIBXL__LOG in the function libxl_pipe() in the file libxl_utils.c
with an invocation of LOG. Create a local libxl__gc gc* for LOG
to use by invoking GC_INIT(ctx) at the top of the function, and
clean it up by invoking GC_FREE at the exit. Create a variable,
ret, to consolidate exits in one place and avoid invoking GC_FREE
twice.

Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: use LOG and LOGE instead of LIBXL__LOG* in libxl_utils.c
Kelley Nielsen [Mon, 11 Nov 2013 23:23:55 +0000 (15:23 -0800)]
libxl: use LOG and LOGE instead of LIBXL__LOG* in libxl_utils.c

Code cleanup - no functional changes

The convenience macros LOG and LOGE have been written to take the
place of the old macros in the LIBXL__LOG* family. Replace the
invocations of the old macros in the function libxl_read_file_contents()
with invocations of the corresponding new ones. Create a local
libxl__gc gc* for the new macros to use by invoking GC_INIT(ctx) at the
top of the function, and clean it up by invoking GC_FREE at the two
exit points.

Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: use LOGE instead of LIBXL__LOG_ERRNO in libxl_utils.c
Kelley Nielsen [Fri, 15 Nov 2013 01:50:43 +0000 (17:50 -0800)]
libxl: use LOGE instead of LIBXL__LOG_ERRNO in libxl_utils.c

Code cleanup - no functional changes

The convenience macro LOGE has been written to take the place of
LIBXL__LOG_ERRNO. LOGE depends on the existence of a local libgl__gc
*gc. Replace two invocations of LIBXL__LOG_ERRNO, which are in
functions that already have a libxl__gc *gc present, to invocations
of the new macro.

Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
11 years agolibxl: use GCSPRINTF instead of libxl__sprintf
Kelley Nielsen [Mon, 11 Nov 2013 23:23:53 +0000 (15:23 -0800)]
libxl: use GCSPRINTF instead of libxl__sprintf

Code cleanup - no functional changes

The convenience macro GCSPRINTF has been written to be used in place
of libxl__sprintf(). Replace all calls to libxl__sprintf() in
libxl_utils.c with invocations of the new macro.

Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: use GCSPRINTF in place of libxl_sprintf() in libxl_qmp.c
Kelley Nielsen [Mon, 11 Nov 2013 23:23:52 +0000 (15:23 -0800)]
libxl: use GCSPRINTF in place of libxl_sprintf() in libxl_qmp.c

Code cleanup -- no functional changes

The convenience macro GCSPRINTF has been written to be used in place of
libxl_sprintf. Change all calls to libxl_sprintf() in libxl_qmp.c to
invocations of the new macro.

Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: Use new macro LOGE() in libxl_qmp.c
Kelley Nielsen [Mon, 11 Nov 2013 23:23:51 +0000 (15:23 -0800)]
libxl: Use new macro LOGE() in libxl_qmp.c

Code cleanup -- no functional changes

Coding style has recently been changed for libxl. The convenience
macro LOGE() has been introduced, and invocations of the old macro
LIBXL__LOG_ERROR() are to be replaced with it. Change all occurences
of the old macro (in functions that have a local libxl_gc *gc) except
the one in register_serials_chardev_callback() to the new one. (This
function lacks a local libxl__gc *gc, which LOGE() requires.)

Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c
Kelley Nielsen [Fri, 15 Nov 2013 01:41:07 +0000 (17:41 -0800)]
libxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c

Coding style has recently been changed for libxl. The convenience
macro LOG() has been introduced, and invocations of the old macro
LIBXL__LOG() are to be replaced with it. Change occurences of the
old macro to the new one in the functions qmp_handle_response()
and qmp_handle_error_response(). The new macros need access to a
local libxl__gc *gc, so add it as a parameter to both these functions,
and pass the instance in qmp_next() down the call chain to
qmp_handle_response() and in turn to qmp_handle_error_response().

Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
[ijc -- reverted one unintential w/s change]

11 years agoget_maintainer.pl: Adjust to Xen workflow
Don Slutz [Tue, 5 Nov 2013 14:11:51 +0000 (09:11 -0500)]
get_maintainer.pl: Adjust to Xen workflow

Based on feedback from reviewers:
* Disable git fallback by default: it has a tendency to mail
  anyone who did a single oneline change and should not be
  necessary for a project of Xen's size.
* Disable rolestats: Makes cut-and-paste from the output into the
  commit message easy.
* Drop "THE REST" fallback: Don't spam Keir *too* much.

Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ijc -- expanded the changelog]

11 years agoget_maintainer.pl: Convert to Xen tree
Don Slutz [Tue, 5 Nov 2013 14:11:50 +0000 (09:11 -0500)]
get_maintainer.pl: Convert to Xen tree

Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoAdd linux version of get_maintainer.pl
Don Slutz [Tue, 5 Nov 2013 14:11:49 +0000 (09:11 -0500)]
Add linux version of get_maintainer.pl

This is get_maintainer.pl from linux commit bbbe96ed899e8ebde1a12d28f10461eb8bef1074

Tag at time of commit: v3.9-2313-gbbbe96e
Was released as: v3.10-0-g8bb495e

Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: add device backend listener in order to launch backends
Roger Pau Monne [Fri, 13 Sep 2013 08:53:58 +0000 (10:53 +0200)]
libxl: add device backend listener in order to launch backends

Add the necessary logic in libxl to allow it to act as a listener for
launching backends in a driver domain, replacing udev (like we already
do on Dom0). This new functionality is acomplished by watching the
domain backend path (/local/domain/<domid>/backend) and reacting to
device creation/destruction.

The way to launch this listener daemon is from xl, using the newly
introduced "devd" command. The command will daemonize by default,
using "xldevd.log" as it's logfile. Optionally the user can force the
execution of the listener in the foreground by passing the "-F"
option to the devd command.

Current backends handled by this daemon include Qdisk, vbd and vif
device types.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: revert 326a7b74
Roger Pau Monne [Fri, 20 Sep 2013 15:55:32 +0000 (17:55 +0200)]
libxl: revert 326a7b74

When running libxl from a driver domain there's no xenstore pid file
(because xenstore is not running on the driver domain). Also, at that
point in libxl initialization there's no way to know wether libxl is
running on a domain different than Dom0, so just revert the change in
order to allow libxl to work on driver domains.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoxl: put daemonize code in it's own function
Roger Pau Monne [Fri, 20 Sep 2013 15:14:09 +0000 (17:14 +0200)]
xl: put daemonize code in it's own function

Move the daemonizer code from create_domain into it's own function
that can be called from other places different than create_domain.
This will be used to daemonize the driver domain backend handler.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: add Qdisk backend launch helper
Roger Pau Monne [Thu, 19 Sep 2013 13:33:59 +0000 (15:33 +0200)]
libxl: add Qdisk backend launch helper

Current Qemu launch functions in libxl require the usage of data
structures only avaialbe on domain creation. All this information is
not need in order to launch a Qemu instance to serve Qdisk backends,
so introduce a new simplified helper that can be used to launch
Qemu/Qdisk, that will be used to launch Qdisk in driver domains.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: don't launch Qemu on Dom0 for Qdisk devices on driver domains
Roger Pau Monne [Thu, 19 Sep 2013 09:17:45 +0000 (11:17 +0200)]
libxl: don't launch Qemu on Dom0 for Qdisk devices on driver domains

In libxl__need_xenpv_qemu check that the backend domain of the Qdisk
device is Dom0 before launching a Qemu instance in the toolstack
domain.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: remove the Qemu bodge for driver domain devices
Roger Pau Monne [Wed, 18 Sep 2013 15:35:00 +0000 (17:35 +0200)]
libxl: remove the Qemu bodge for driver domain devices

When Qemu is launched from a driver domain to act as a PV disk
backend we can make sure that Qemu is running before detaching
devices, so there's no need for the bodge there.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: synchronize device removal when using driver domains
Roger Pau Monne [Fri, 27 Sep 2013 09:37:04 +0000 (11:37 +0200)]
libxl: synchronize device removal when using driver domains

Synchronize the clean up of the backend from the toolstack domain when
the driver domain has actually finished closing the backend for the
device.

This is accomplished by waiting for the driver domain to  remove the
directory containing the backend keys, then the toolstack domain will
finish the cleanup by removing the empty folders on the backend path.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: don't remove device frontend path from driver domains
Roger Pau Monne [Wed, 18 Sep 2013 11:15:14 +0000 (13:15 +0200)]
libxl: don't remove device frontend path from driver domains

A domain different than LIBXL_TOOLSTACK_DOMID should not try to remove
the frontend paths of a device.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: create a local xenstore libxl and device-model dir for guests
Roger Pau Monne [Wed, 18 Sep 2013 10:42:47 +0000 (12:42 +0200)]
libxl: create a local xenstore libxl and device-model dir for guests

If libxl is executed inside a guest domain it needs write access to
the local libxl xenstore dir (/local/<domid>/libxl) to store internal
data. This also applies to Qemu which needs a
/local/<domid>/device-model xenstore directory.

This patch creates the mentioned directories for each guest launched
from libxl.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agox86: consider modules when cutting off memory
Jan Beulich [Mon, 18 Nov 2013 12:57:20 +0000 (13:57 +0100)]
x86: consider modules when cutting off memory

The code in question runs after module ranges got already removed from
the E820 table, so when determining the new maximum page/PDX we need to
explicitly take them into account.

Furthermore we need to round up the ending addresses here, in order to
fully cover eventual partial trailing pages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoVT-d: fix TLB flushing in dma_pte_clear_one()
Jan Beulich [Mon, 18 Nov 2013 12:55:55 +0000 (13:55 +0100)]
VT-d: fix TLB flushing in dma_pte_clear_one()

The third parameter of __intel_iommu_iotlb_flush() is to indicate
whether the to be flushed entry was a present one. A few lines before,
we bailed if !dma_pte_present(*pte), so there's no need to check the
flag here again - we can simply always pass TRUE here.

This is XSA-78.

Suggested-by: Cheng Yueqiang <yqcheng.2008@phdis.smu.edu.sg>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agonested VMX: don't ignore mapping errors
Jan Beulich [Mon, 18 Nov 2013 08:39:01 +0000 (09:39 +0100)]
nested VMX: don't ignore mapping errors

Rather than ignoring failures to map the virtual VMCS as well as MSR or
I/O port bitmaps, convert those into failures of the respective
instructions (avoiding to dereference NULL pointers). Ultimately such
failures should be handled transparently (by using transient mappings
when they actually need to be accessed, just like nested SVM does).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
11 years agofix leaking of v->cpu_affinity_saved on domain destruction
Dario Faggioli [Fri, 15 Nov 2013 16:43:28 +0000 (17:43 +0100)]
fix leaking of v->cpu_affinity_saved on domain destruction

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agocredit: Update other parameters when setting tslice_ms
Nate Studer [Fri, 15 Nov 2013 16:38:10 +0000 (17:38 +0100)]
credit: Update other parameters when setting tslice_ms

Add a utility function to update the rest of the timeslice
accounting fields when updating the timeslice of the
credit scheduler, so that capped CPUs behave correctly.

Before this patch changing the timeslice to a value higher
than the default would result in a domain not utilizing
its full capacity and changing the timeslice to a value
lower than the default would result in a domain exceeding
its capacity.

Signed-off-by: Nate Studer <nate.studer@dornerworks.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agox86/VT-x: Disable MSR intercept for SHADOW_GS_BASE
Paul Durrant [Fri, 15 Nov 2013 10:02:17 +0000 (11:02 +0100)]
x86/VT-x: Disable MSR intercept for SHADOW_GS_BASE

Intercepting this MSR is pointless - The swapgs instruction does not cause a
vmexit, so the cached result of this is potentially stale after the next guest
instruction.  It is correctly saved and restored on vcpu context switch.

Furthermore, 64bit Windows writes to this MSR on every thread context switch,
so interception causes a substantial performance hit.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
11 years agox86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2)
Jan Beulich [Fri, 15 Nov 2013 10:01:49 +0000 (11:01 +0100)]
x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2)

Just spotted a counterpart of what commit 9d89100b (same title) dealt
with.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agokexec: fail image loads if the page tables cannot be built
David Vrabel [Fri, 15 Nov 2013 10:00:46 +0000 (11:00 +0100)]
kexec: fail image loads if the page tables cannot be built

CID 1128566

If an image source page is allocated in kimage_alloc_page() but the
machine_kexec_add_page() fails, the image may appear to load
succesfully but it will not execute.  The relocation will fault
(rebooting the host) when trying to copy the source page, as it is not
mapped.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agokexec: fix kexec_lock use in kexec_swap_images()
David Vrabel [Fri, 15 Nov 2013 09:59:41 +0000 (10:59 +0100)]
kexec: fix kexec_lock use in kexec_swap_images()

CID 1128573

If a bad image type is supplied in a KEXECOP_unload hypercall, the
kexec_lock in kexec_swap_images() was left locked, causing a deadlock
on a subsequent image load or unload.

The kexec_lock is only required to serialize the swap operation
itself.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agoPVH dom0: allow all physdev ops
Mukesh Rathor [Wed, 13 Nov 2013 08:53:30 +0000 (09:53 +0100)]
PVH dom0: allow all physdev ops

Allow a PVH dom0 access to all PHYSDEVOP_* ops.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Convert flow and adjust indentation.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agoPVH dom0: set eflags resvd bit #1
Mukesh Rathor [Wed, 13 Nov 2013 08:52:18 +0000 (09:52 +0100)]
PVH dom0: set eflags resvd bit #1

In this patch the eflags resv bit #1 is set in vmx_vmenter_helper. If
the bit is not set, the vmlaunch/resume will fail with guest state
invalid.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
For consistency (i.e. even if perhaps not strictly needed) also do the
same on SVM.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agopvh tools: libxl changes to create a PVH guest
George Dunlap [Wed, 13 Nov 2013 08:42:51 +0000 (09:42 +0100)]
pvh tools: libxl changes to create a PVH guest

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Eddie Dong <eddie.dong@intel.com>