Commit Graph
35122 Commits
Author SHA1 Message Date
Ross Lagerwall 0d670cd46c x86/mm: use statically defined locking order
Instead of using a locking order based on line numbers which interacts
poorly with trying to create a live patch, statically define the locking
order.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2017-03-22 12:02:01 +01:00
Ian Jackson 5ca67f7453 QEMU_TAG update 2017-03-21 18:43:44 +00:00
Ian Jackson 03a7c07137 misc/branching-checklist: Call mg-branch-setup in Cambridge too
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2017-03-21 18:41:03 +00:00
Ian Jackson 3979759c9b misc/release-checklist: Split out branching-checklist.txt
This is almost all just motion.  There is one new paragraph in
branching-checklist.txt:

+ Update both new branches according to release-checklist.txt section re
+ README etc.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2017-03-21 18:41:02 +00:00
Ian Jackson 958b30442a misc/release-checklist: Remove pre-4.3 tarball target instructions
4.2 is well out of support and we will never need to make a release of
it again.  Delete all the stuff for making combined tarballs "by hand".

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2017-03-21 18:41:02 +00:00
Ian Jackson 1c739589f0 misc/release-checklist: Remove clearly-obsolete stuff
Remove:

 - Head comment saying not to edit here.  This came from the
   now-no-longer-master xenbits copy which I have deleted.

 - Many old (commented-out) instruction related to hg

 - Many old (commented-out) instruction related to pre-unified
   qemu trees.

 - Many old (commented-out) instruction related to ancient
   locations within Citrix.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2017-03-21 18:41:02 +00:00
Zhongze Liu 27ef1ec55e common: allow a default compiled-in command line using Kconfig
This allows downstreams to set their defaults without modifying the source code
all over the place. Also probably useful for the embedded space.
(See Also: https://xenproject.atlassian.net/browse/XEN-41)

If CMDLINE is set, it will be parsed prior to the bootloader command line.
This order of parsing implies that if any non-cumulative options are set in
both CMDLINE and the bootloader command line, only the ones in the latter will
take effect. Furthermore, if CMDLINE_OVERRIDE is set to y, the whole
bootloader command line will be ignored, which will be useful to work around
broken bootloaders. A wrapper to the original common/kernel.c:cmdline_parse()
was introduced to complete this task.

Signed-off-by: Zhongze Liu <blackskygg@gmail.com>
[jb: fix non-EXPERT build]
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2017-03-21 15:20:30 +01:00
Jan Beulich 0711b59b85 x86emul: correct FPU code/data pointers and opcode handling
Prevent leaking the hypervisor ones (stored by hardware during stub
execution), at once making sure the guest sees correct values there.
This piggybacks on the backout logic used to deal with write faults of
FPU insns.

Deliberately ignore the NO_FPU_SEL feature here: Honoring it would
merely mean extra code with no benefit (once we XRSTOR state, the
selector values will simply be lost anyway).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com> [hvm/emulate.c]
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-21 15:13:42 +01:00
Jan Beulich a8fcd80c8f x86emul: correct handling of FPU insns faulting on memory write
When an FPU instruction with a memory destination fails during the
memory write, it should not affect FPU register state. Due to the way
we emulate FPU (and SIMD) instructions, we can only guarantee this by
- backing out changes to the FPU register state in such a case or
- doing a descriptor read and/or page walk up front, perhaps with the
  stubs accessing the actual memory location then.
The latter would require a significant change in how the emulator does
its guest memory accessing, so for now the former variant is being
chosen.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com> [hvm/emulate.c]
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
2017-03-21 15:12:59 +01:00
Jan Beulich 9b7c3fabbc x86emul: centralize put_fpu() invocations
..., splitting parts of it into check_*() macros. This is in
preparation of making ->put_fpu() do further adjustments to register
state. (Some of the check_xmm() invocations could be avoided, as in
some of the cases no insns handled there can actually raise #XM, but I
think we're better off keeping them to avoid later additions of further
insn patterns rendering the lack of the check a bug.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-21 15:10:25 +01:00
Andrew Cooper 69f4633817 tools/insn-fuzz: Support AFL's afl-clang-fast mode
AFL has an alternative llvm-base instrumentation mode, which has much lower
overhead than the traditional afl-gcc.

One extra ability is to chose exactly where the master process gets
initialised to, before being forked for testing.  This point is chosen after
the call to LLVMFuzzerInitialize(), so the stack isn't being remapped
executable for every test.

Another extra ability is to feed multiple inputs into a single test process,
to reduce the number of fork() calls required overall.  Two caveats are that if
stdin is used for data, it must be unbuffered, and if input is passed via a
command line parameter, the underlying file must be opened and closed on each
iteration.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:21 +00:00
Andrew Cooper 63092064eb tools/insn-fuzz: Make use of LLVMFuzzerInitialize()
libfuzz can perform one-time initialisation by calling LLVMFuzzerInitialize().
Move emul_test_init() into this, to avoid repeating it on every
LLVMFuzzerTestOneInput() call.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:21 +00:00
Andrew Cooper 7dfd103efb tools/insn-fuzz: Accept fuzzing input on stdin
This is rather faster for afl-fuzz to arrange than using an explicit file
parameter.  Also update the README to recommend using a tmpfs for findings_dir
which reduces disk load and is more performant.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Andrew Cooper 6a6f3ff2c1 tools/insn-fuzz: Use getopt() for parsing the command line
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Andrew Cooper 1c98756183 tools/insn-fuzz: Use shorter filenames
Amongst other things, these tab complete more easily.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Andrew Cooper 3a54f72491 tools/fuzz: Include LLVMFuzzerTestOneInput() in the generated .a
Otherwise they are not suitable for use with libfuzz.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Andrew Cooper 264efe24ff tools/fuzz: Use $(CC) for linking the harnesses
This is necessary to make use of compiler features such as UBSAN.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Andrew Cooper cde043c55c tools/fuzz: Remove .d files in clean
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 16:45:20 +00:00
Jan Beulich 8709b10c7f AMD-Vi: allocate root table on demand
This was my originally intended fix for the AMD side of XSA-207:
There's no need to unconditionally allocate the root table, and with
that there's then also no way to leak it when a guest has no devices
assigned.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
2017-03-20 17:00:34 +01:00
Paul Durrant 5f8ce179e2 x86/viridian: update to version 5.0a of the specification
The Hypervisor Top Level Functional Specification v5.0a has many differences
from previous versions and introduces whole new sections.

This patch:

- Updates the URL at the top of the source.
- Fixes up section references accordingly.
- Modifies the MSR naming convention in the code to match the specification.
- Rename the apic_assist page to the vp_assist page to reflect the change
  in the specification.
  (The APIC assist feature itself is inconsistently named in the
  specification so stick wth the current feature name).
- Updates the handling of CPUID leaf 3.

There is one functional change in this patch: The vp_assist page is
mapped (and completely zeroed) regardless of whether the APIC assist
feature is enabled. This reflects its new wider remit and simplifies the
code slightly.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 16:59:54 +01:00
Haozhong Zhang 0bf94483e1 x86/mce: add blank lines between non-fall-through switch case blocks
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 16:59:16 +01:00
Haozhong Zhang e8c437eba5 x86/mce_intel: refine messages of MCA capabilities
... to only print available ones.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 16:58:33 +01:00
Haozhong Zhang 95c2fc5163 x86/mce: switch bool_t/1/0 to bool/true/false
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 16:57:29 +01:00
Wei Liu 2588a12732 x86: remove stale PVHv1 comment from PV domain builder
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Wei Liu a5c0999258 sched.h: remove stale PVHv1 comment
With the removal of PVHv1 this comment is wrong. Just remove it.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Wei Liu 437f0a972c docs: update dmop.markdown
... to match the code after the removal of PVHv1.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Wei Liu 300f06470f x86: clean up header files in dom0_build.c
Remove the ones that are no longer needed and sort them.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 15:39:45 +00:00
Wei Liu 7eb3fc22c7 x86: split PVH dom0 builder to hvm/dom0_build.c
Long term we want to be able to disentangle PV and HVM code. Move
the PVH domain builder to a dedicated file.

Lift function declarations to dom0_build.h and rename them when
necessary.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Wei Liu 674cad0d67 x86: split PV dom0 builder to pv/dom0_builder.c
Long term we want to be able to disentangle PV and HVM code. Move the PV
domain builder to a dedicated file.

This in turn requires exposing a few functions and variables via a new
header dom0_build.h. These functions and variables are now prefixed with
"dom0_" if they weren't already so.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Wei Liu 503b2fb9a7 x86: modify setup_dom0_vcpu to use dom0_cpus internally
We will later move dom0 builders to different directories. To avoid the
need of making dom0_cpus visible outside dom0_builder.c, modify
setup_dom0_vcpus to cycle through dom0_cpus internally instead of
relying on the callers to do that.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 15:39:45 +00:00
Wei Liu d4188929e4 x86: rename domain_build.c to dom0_build.c
To reflect the true nature of this file. No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 15:39:45 +00:00
Zhang Chen 7c2c1763aa libxl/libxl_qmp.c: Update COLO query replication status API
The QEMU community has asked us to change QMP command
xen-get-replication-error to query-xen-replication-status. Modify Xen
side to use the new name.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 15:27:53 +00:00
Zhang Chen 8127374545 libxl/libxl_qmp.c: Update COLO do checkpoint API
The QEMU community has asked us to change the QMP command from
xen-do-checkpoint to xen-colo-do-checkpoint. Modify Xen side to use
the new name.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2017-03-20 15:27:53 +00:00
Boris Ostrovsky 4fc380ac00 x86/time: don't use virtual TSC if host and guest frequencies are equal
Commit 82713ec8d2 ("x86: use native RDTSC(P) execution when guest and
host frequencies are the same") left out optimization for PV guests
when host and guest run at the same frequency.

For such a case we should be able not to use virtual TSC regardless
of whether we are runing before or after a migration (i.e. regardless
of incarnation value).

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
[jb: retain parts of the original comment]
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2017-03-20 09:27:35 +01:00
Jan Beulich e22e1c4795 x86/EFI: avoid Xen image when looking for module/kexec position
When booting straight from EFI, we don't further try to relocate Xen.
As a result, so far we also didn't avoid the area Xen uses when looking
for a location to put modules or the kexec area. Introduce a fake
module slot to deal with that without having to fiddle with a lot of
code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 09:27:12 +01:00
Jan Beulich d522571a40 x86/EFI: avoid IOMMU faults on [_end,__2M_rwdata_end)
Commit c9a4a1c419 ("x86/layout: Correct Xen's idea of its own memory
layout") didn't go far enough with the conversion, causing IOMMU faults
when memory from that range was handed to a domain. We must not make
this memory available for allocation (the change is benign to xen.gz at
this point in time).

Note that the change to tboot_shutdown() is fixing another issue at
once: As it looks, the function so far skipped all memory below the Xen
image.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-20 09:25:36 +01:00
Jan Beulich 02b37b7eff x86/EFI: avoid overrunning mb_modules[]
Commit 436fb462ab ("x86/microcode: enable boot time (pre-Dom0)
loading") added a 4th module without providing an array slot for it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-17 15:45:22 +01:00
Jan Beulich cb4fcf70b2 x86emul: parallelize SIMD test code building
In anticipation of further flavors (AVX, AVX-512) going to be added
(which would make the current situation even worse), facilitate
reduction of build time (and hence latency to availability of test
results) via use of make's -j option.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-17 09:34:38 +01:00
Jan Beulich da091ea2f1 x86emul: correct DECLARE_ALIGNED()
Stop creating an excessively large array on the stack, by properly
taking into account the array element size when establishing its
element count (and of course also when calculating the pointer to
be actually used to access the memory).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2017-03-17 09:33:45 +01:00
Dario Faggioli 182602911c credit2: remove undefined declaration of __dump_execstate()
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2017-03-17 09:31:58 +01:00
Jan Beulich 9685a28f92 Revert "x86/vvmx: correct nested shadow VMCS handling"
This reverts commit dc05c0ceeb,
causing a regression.
2017-03-17 09:31:19 +01:00
Jan Beulich 99df591e3a Revert "x86/vvmx: add a shadow vmcs check to vmlaunch"
This reverts commit b22ee98c4e,
causing a regression.
2017-03-17 09:30:41 +01:00
Wei Liu c6e2216783 libxl/colo: unified exit path for colo_proxy_checkpoint
Slightly refactor the code to have only one exit path for the said
function.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
2017-03-16 18:25:16 +00:00
Roger Pau Monne 0a1b7f4e37 x86/PVHv2: move pvh_setup_e820 together with the other pvh functions
This function is only used by PVHv2 domain build, so move it together with the
other PVH domain build functions.

Just code motion, no functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2017-03-16 14:50:21 +00:00
Roger Pau Monne 12ab91818b x86: remove has_hvm_container_{domain/vcpu}
It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's
point of view.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
2017-03-16 14:50:21 +00:00
Roger Pau Monne 33e5c32559 x86: remove PVHv1 code
This removal applies to both the hypervisor and the toolstack side of PVHv1.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
2017-03-16 14:50:10 +00:00
Ian Jackson 7faae10654 ocaml/gen: fix ocaml type/code generator from IDL
This patch adds support for union members which have their own type name.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: David Scott <dave@recoil.org>
2017-03-16 14:32:11 +00:00
Tim Deegan bfd9a2095f tools/kdd: don't use a pointer to an unaligned field.
The 'val' field in the packet is byte-aligned (because it is part of a
packed struct), but the pointer argument to kdd_rdmsr() has the normal
alignment constraints for a uint64_t *.  Use a local variable to make sure
the passed pointer has the correct alignment.

Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Tested-by: Roger Pau Monné <roger.pau@citrix.com>
2017-03-15 10:57:00 +00:00
Juergen Gross 327f54ed7f tools: remove gntshr support
libgnttab contains the complete gntshr support, but the tools build
infrastructure contains dedicated support for gntshr _and_ gnttab.

Remove the gntshr specific flags and switch their users to gnttab
instead.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2017-03-15 10:31:16 +00:00
Zhang Chen 3528954580 tools/xl/xl_parse.c: Remove blank line.
Address Liu Wei's comments.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2017-03-15 10:26:01 +00:00