100 Commits
Author SHA1 Message Date
Keir Fraser 2a549b9c8a switch to write-biased r/w locks
This is to improve fairness: A permanent flow of read acquires can
otherwise lock out eventual writers indefinitely.

This is CVE-2014-9065 / XSA-114.

Signed-off-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
2014-12-08 14:45:46 +01:00
Keir Fraser 6248dec1b4 x86: Fix __prepare_to_wait() asm test for stack size
Signed-off-by: Keir Fraser <keir@xen.org>
2013-05-02 21:04:08 +01:00
Keir Fraser 5082cc1952 hvm: Clean up vlapic_reg_write() error propagation.
In particular, correctly propagate errors through vlapic_apicv_write()
and hvm_x2apic_msr_write().

Signed-off-by: Keir Fraser <keir@xen.org>
2013-03-28 20:16:37 +00:00
Keir Fraser 7242e0dc2c hvm: Improve APIC INIT/SIPI emulation, fixing it for call paths other than x86_emulate().
In particular, on broadcast/multicast INIT/SIPI, we handle all target
APICs at once in a single invocation of the init/sipi tasklet. This
avoids needing to return an X86EMUL_RETRY error code to the caller,
which was being ignored by all except x86_emulate().

The original bug, and the general approach in this fix, pointed out by
Intel (yang.z.zhang@intel.com).

Signed-off-by: Keir Fraser <keir@xen.org>
2013-03-28 11:44:11 +00:00
Keir Fraser 6c7bb5a198 MAINTAINERS: Remove Jeremy from pv_ops maintainer list.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-02-26 16:51:28 +00:00
Keir Fraser 511278b4e2 gcc4.8 build fix: Add -Wno-unused-local-typedefs to CFLAGS.
Based on a patch by M A Young <m.a.young@durham.ac.uk>

Signed-off-by: Keir Fraser <keir@xen.org>
2013-02-13 17:03:31 +00:00
Keir Fraser 1453984eab vmx: Simplify cr0 update handling by deferring cr4 changes to the cr4 handler.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-30 09:15:39 -08:00
Keir Fraser d0eed336e5 xen: Fix some over-long source lines.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-30 03:04:42 -08:00
Keir Fraser 3b8e11e853 xen: Define debug_build() based on NDEBUG. Use it in a few printk's.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-30 02:51:04 -08:00
Keir Fraser 836f8188f2 xen: Introduce ASSERT_NOT_IN_ATOMIC() to give more info on in_atomic() crash.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-14 16:47:22 +00:00
Keir Fraser bc9ae8b5d1 x86/hvm: Remove 32-/64-bit abstraction macros from asm files.
Not needed now we target 64-bit only.

Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-14 14:06:05 +00:00
Keir Fraser 143c33f1bc x86: Assert !in_atomic() before exiting to guest context.
Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-14 13:55:45 +00:00
Keir Fraser 17ef427485 xsm: Dummy hook functions must be always_inline to ensure constant
propagation and dead-code elimination makes LINKER_BUG_ON() operate
properly.

Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-11 13:45:09 +00:00
Keir Fraser 4b73f651d0 xsm: Move flask policy files into hypervisor (missed from earlier commit).
Signed-off-by: Keir Fraser <keir@xen.org>

--HG--
rename : tools/flask/policy/policy/flask/access_vectors => xen/xsm/flask/policy/access_vectors
rename : tools/flask/policy/policy/flask/initial_sids => xen/xsm/flask/policy/initial_sids
rename : tools/flask/policy/policy/flask/mkaccess_vector.sh => xen/xsm/flask/policy/mkaccess_vector.sh
rename : tools/flask/policy/policy/flask/mkflask.sh => xen/xsm/flask/policy/mkflask.sh
rename : tools/flask/policy/policy/flask/security_classes => xen/xsm/flask/policy/security_classes
2013-01-11 10:36:06 +00:00
Keir Fraser 408a9e5634 hvmloader: Allocate 3 pages for Intel GPU OpRegion passthrough.
The 8kB region may not be page aligned, hence requiring 3 pages to
be mapped through.

Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-10 17:26:24 +00:00
Keir Fraser f6423f77ef x86/hvm: Bind device-model event-channels to registered device-model
domid during vcpu initialisation.

Signed-off-by: Keir Fraser <keir@xen.org>
2013-01-09 15:00:58 +00:00
Keir Fraser fe0f4baccb hvmloader: Reserve FE700000-FE800000 in physical memory map for guest use.
Xen platform promises never to use this physical address region, and
will always mark it as reserved in the physical memory map presented
to the OS (preventing its use by generic OS services such as BAR
remapping).

Linux will use this region for mapping the shared-info page.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-10-25 00:07:16 -07:00
Keir Fraser a902c12ee4 More efficient TLB-flush filtering in alloc_heap_pages().
Rather than per-cpu filtering for every page in a super-page
allocation, simply remember the most recent TLB timestamp across all
allocated pages, and filter on that, just once, at the end of the
function.

For large-CPU systems, doing 2MB allocations during domain creation,
this cuts down the domain creation time *massively*.

TODO: It may make sense to move the filtering out into some callers,
such as memory.c:populate_physmap() and
memory.c:increase_reservation(), so that the filtering can be moved
outside their loops, too.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-10-15 16:38:11 +01:00
Keir Fraser ac25a725ae MAINTAINERS: Move and fix up VTPM entry
Signed-off-by: Keir Fraser <keir@xen.org>
2012-10-03 12:59:30 +01:00
Keir Fraser 8f5f42e36f hvmloader: Do not zero the wallclock fields in shared-info.
These fields need to be valid at all times. Hypervisor ensures this
even across 32/64-bit guest transitions.

This fixes a bug where wallclock time is incorrect for booting 32-bit
HVM guests.

This should be backported to Xen 4.1 and 4.2.

Signed-off-by: Keir Fraser <keir@xen.org>
Tested-and-Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2012-09-14 19:47:57 +01:00
Keir Fraser a050ca848b build: Require GCC 4.1 or later.
Centralise the version check in Config.mk. Any more strict version
requirements can be added to specific subdirs/arches.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-13 20:13:36 +01:00
Keir Fraser 4e11d97bd9 drivers: Remove some CONFIG_X86 ifdef'ery.
Not quite all, but a great deal was to specifically allow ia64 support
to be retrofitted to x86 platform code. Since we no longer support
ia64 we can happily remove the ifdefs. Any new platform which wanted
to share this code would likely need a different set of ifdefs in any
case, making it a brand new porting effort.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 20:54:23 +01:00
Keir Fraser a9c02a0d88 In most of the codebase, use CONFIG_X86 in place of __i386__||__x86_64__
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 20:41:01 +01:00
Keir Fraser fe4ebf84c6 CONFIG_X86_64 -> CONFIG_X86
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 20:32:52 +01:00
Keir Fraser b4423022f6 x86: HYPERVISOR_VIRT_END is always defined. Remove ifdef'ery.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 20:23:10 +01:00
Keir Fraser 5df3f4b7b9 x86: Remove CONFIG_COMPAT ifdef'ery from arch/x86 -- it is always defined.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 20:21:02 +01:00
Keir Fraser 2fcb3c6fc7 x86: Fix 32-bit stubdom build, libelf.h must support __i386__
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 16:12:42 +01:00
Keir Fraser a1bba8211f x86: Remove unused 'sis_apic_bug' variable. It was only used on x86_32.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 15:52:33 +01:00
Keir Fraser 218adf199e x86: We can assume CONFIG_PAGING_LEVELS==4.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 13:59:26 +01:00
Keir Fraser 5d1181a5ea xen: Remove x86_32 build target.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-12 13:29:30 +01:00
Keir Fraser c43b296b69 Update Xen version to 4.3-unstable 2012-09-07 12:55:26 +01:00
Keir Fraser 6065b275d1 Default to debug builds. 2012-09-07 12:54:22 +01:00
Keir Fraser 804a026b4d Added tag 4.2.0-branched for changeset 528f0708b6db 2012-09-07 12:22:44 +01:00
Keir Fraser 18d029873a Added signature for changeset 68640a3c99ce 2012-09-07 12:18:46 +01:00
Keir Fraser 8e8b9c227e Added tag 4.2.0-rc4 for changeset 68640a3c99ce 2012-09-07 12:08:27 +01:00
Keir Fraser d0a2418213 Update Xen version to 4.2.0-rc4 2012-09-07 12:08:10 +01:00
Keir Fraser 23567b1201 Default to non-debug build.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-09-07 11:09:46 +01:00
Keir Fraser 4dd113fd79 x86/i8259: Clean up _mask_and_ack_8259A_irq().
Signed-off-by: Keir Fraser <keir@xen.org>
2012-08-30 18:17:20 +01:00
Keir Fraser 4eae16a077 x86: Prefer multiboot-provided e820 over bios-provided e801 memory info.
Some UEFI systems do not provide e820 information. In this case we
should take the detailed memory map provided by a multiboot-capable
loader, rather than rely on very conservative values from the e801
bios call. Using the latter on any modern system really hardly makes
good sense.

[Excellent candidate for 4.1 backport]

Signed-off-by: Keir Fraser <keir@xen.org>
Tested-by: Jonathan Tripathy <jonnyt@abpni.co.uk>
2012-08-28 22:40:45 +01:00
Keir Fraser fd5729846b Update Xen version to 4.2.0-rc4-pre 2012-08-23 15:06:11 +01:00
Keir Fraser 99fca70a8c Added signature for changeset d44f290e81df 2012-08-23 15:05:48 +01:00
Keir Fraser 8ac26bdec3 Added tag 4.2.0-rc3 for changeset d44f290e81df 2012-08-23 15:05:36 +01:00
Keir Fraser 985d0f2a10 Update Xen version to 4.2.0-rc3 2012-08-23 15:05:30 +01:00
Keir Fraser db8cf0c8e8 x86,cmdline: Fix setting skip_realmode boolean on no-real-mode and tboot options
...effect should be cumulative.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-08-23 15:02:04 +01:00
Keir Fraser 64b135198b libxc: Support save/restore of up to 4096 VCPUs (increase from 64 VCPUs).
Signed-off-by: Keir Fraser <keir@xen.org>
2012-08-22 22:20:42 +01:00
Keir Fraser efaffbc9d6 etherboot: Build fixes for gcc 4.7.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-08-15 09:41:21 +01:00
Keir Fraser 86485a8e38 Update Xen version to 4.2.0-rc3-pre 2012-08-08 18:02:57 +01:00
Keir Fraser 493c146ea1 Added signature for changeset f4c47bcc01e1 2012-08-08 18:02:35 +01:00
Keir Fraser 1b5f23829f Added tag 4.2.0-rc2 for changeset f4c47bcc01e1 2012-08-08 18:02:27 +01:00
Keir Fraser 4f361248f6 Update Xen version to 4.2.0-rc2 2012-08-08 18:02:21 +01:00
Keir Fraser 837b7faae9 Update Xen version to 4.2.0-rc2-pre 2012-07-30 16:16:09 +01:00
Keir Fraser 515f33a484 Added signature for changeset 8e620dc570ce 2012-07-30 16:15:37 +01:00
Keir Fraser 0ed2ab4144 Added tag 4.2.0-rc1 for changeset 8e620dc570ce 2012-07-30 16:15:27 +01:00
Keir Fraser 4432a71f52 Update Xen version to 4.2.0-rc1 2012-07-30 16:15:18 +01:00
Keir Fraser 54d70ad278 Rename: inslen -> insn_len
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-30 13:25:51 +01:00
Keir Fraser a46efde6ff tools/tests/xen-access: INT3 trap type is s/w exception.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-30 13:23:31 +01:00
Keir Fraser 7f3ecbf7fa hvm: Add instruction length to hvm_trap info.
Add documentation notes to vmx_inject_trap() and respect instruiction
length parameter for software-generated exceptions/interrupts.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-30 09:40:44 +01:00
Keir Fraser 284f43f4fd xen: Define new struct hvm_trap and cleanup vmx exception
Define new struct hvm_trap to represent information of trap, and
renames hvm_inject_exception to hvm_inject_trap, then define a couple
of wrappers around that function for existing callers.

Signed-off-by: Keir Fraser <keir@xen.org>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
2012-05-30 09:27:51 +01:00
Keir Fraser 343d66a666 blktap2: Fix naked unchecked uses of read/write/chdir.
These cause warnings under warn_unused_result, and for read/write we
ought to deal with partial io results.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-11 18:30:29 +01:00
Keir Fraser 1be84a9889 Remove bool return code from evtchn_set_pending() and callers.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-10 11:58:33 +01:00
Keir Fraser 60e6552bd5 blktap2: Do not build with -O0
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-10 11:22:18 +01:00
Keir Fraser bb8aee5927 blktap2: Fix uninitialised value error.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-05-10 11:21:59 +01:00
Keir Fraser 0a1e25103a Clean up convoluted hvm_inject_exception() logic.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-04-20 09:33:35 +01:00
Keir Fraser 8db87324fc x86: Unify direct-apic and hiprio irq vector allocations.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-30 10:01:15 +01:00
Keir Fraser bdc31d56d8 x86: Allow direct vectored interrupts to be dynamically allocated.
Use this for Intel's CMCI and thermal interrupts.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-30 09:14:25 +01:00
Keir Fraser 33c4b1044d Remove single use of fastcall from hypervisor common code.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-30 08:52:19 +01:00
Keir Fraser b57458c1d0 x86: All vectored interrupts go through do_IRQ().
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-30 08:50:33 +01:00
Keir Fraser ebe5e56248 x86_emulate: Do not push an error code onto a #UD exception stack
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-23 20:51:48 +00:00
Keir Fraser 269f543ea7 Introduce system_state variable.
Use it to replace x86-specific early_boot boolean variable.

Also use it to detect suspend/resume case during cpu offline/online
to avoid unnecessarily breaking vcpu and cpupool affinities.

Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2012-03-22 12:20:13 +00:00
Keir Fraser 69b701b237 low-mem virq: Parentheses around ternary operator in check_low_mem_virq()
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-09 09:58:41 +00:00
Keir Fraser 5e65338b20 Revert 24987:42afd4d1669b
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-08 12:30:03 +00:00
Keir Fraser 450f664f73 hvm: Print support/enable status of HAP superpage mappings.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-08 09:43:49 +00:00
Keir Fraser 8a058bcef7 Revert 24973:50a70b652b43 "x86: Use deep C states for off-lined CPUs"
applied already

Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-07 09:12:23 +00:00
Keir Fraser c933085d09 lowmemd: Fix build when xs.h has not been previously installed.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-03-01 16:43:46 +00:00
Keir Fraser d04b4856b5 Revert 24897:f25e5785327e "Export configure variables to hypervisor build"
Signed-off-by: Keir Fraser <keir@xen.org>
2012-02-29 15:11:31 +00:00
Keir Fraser c5d88f34ce Update autoconf-generated configure script.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-02-29 13:43:44 +00:00
Keir Fraser f20e5f80da Revert 24875:a59c1dcfe968 "blkif.h: Define and document the request number/size/segments extension"
Breaks the build.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-02-27 12:10:29 +00:00
Keir Fraser 3b56a0ae59 .hgignore/.gitignore: Add some tools/tests binaries
Signed-off-by: Keir Fraser <keir@xen.org>
2012-02-06 13:15:03 -08:00
Keir Fraser c9929dfe10 public/physdev.h: Fix __XEN_INTERFACE_VERSION__ typo.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-31 11:37:03 +00:00
Keir Fraser 8311d176ea docs: Remove outdated LaTex documentation.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-25 15:52:47 +00:00
Keir Fraser f67b958f10 Revert 24538:5bb22a6871f6 "xenoprof: Make the escape code consistent across 32 and 64-bit xen"
Breaks 32-bit build.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-23 15:10:43 +00:00
Keir Fraser 9346f6cfbf x86/hvm: No need to arch_set_info_guest() before restoring per-vcpu HVM state.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-22 10:20:03 +00:00
Keir Fraser acbae3dcf6 tools/libvchan: Beef up the CPU barriers in libvchan.
Although they were sufficient for x86, they weren't safe more generally.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-21 17:15:40 +00:00
Keir Fraser 8d3f757328 libxc: Update rmb/wmb for x86.
Only the compiler needs to see the barriers; not the CPU.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-21 17:14:37 +00:00
Keir Fraser cd95bce19e libxl: libxl_qmp.c should use libxl's own list macros, since they
exist. Also, older Linux versions do not have SIMPLEQ macros in
sys/queue.h.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-21 16:47:00 +00:00
Keir Fraser e510f6c58d x86/hvm: Fix earlier hvm_load_cpu_ctxt() breakage.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-20 18:17:59 +00:00
Keir Fraser 3852f2a6da x86/hvm: Remove unnecessary packed attribute from hvm_hw_cpu_xsave struct.
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-20 10:26:57 +00:00
Keir Fraser 2d7d54adfd xen: Simplify callers of boot_vcpu(). In VCPUOP_up, check
is_initialised under the per-domain lock.

Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-20 10:13:55 +00:00
Keir Fraser a2c9c2f9f0 x86: Make asmlinkage explicitly a no-op, and avoid usage in arch/x86
Signed-off-by: Keir Fraser <keir@xen.org>
2012-01-15 22:02:35 +00:00
Keir Fraser 96e9e02033 tools/libxc: Fix x86_32 build breakage in previous changeset.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-12-02 08:40:02 -08:00
Keir Fraser 51b4edac54 tools/x86_64: Fix cpuid() inline asm to not clobber stack's red zone
Pushing stuff onto the stack on x86-64 when we do not specify
-mno-red-zone is unsafe. Since the complicated asm is due to register
pressure on i386, we simply implement an all-new simpler alternative
for x86-64.

Signed-off-by: Keir Fraser <keir@xen.org>
Acked-by: Jan Beulich <jbeulich@novell.com>
2011-12-02 06:31:14 -08:00
Keir Fraser b6cf65cf7a xenpaging: Fix c/s 23507:0a29c8c3ddf7 ("update machine_to_phys_mapping[] during page deallocation")
This patch clobbers page owner in free_heap_pages() before we are
finished using it. This means that a subsequent test to determine
whether it is safe to avoid safety TLB flushes incorrectly always
determines that it is safe to do so.

The fix is simple: we can defer the original patch's work until after
we are done with the page-owner field.

Thanks to Christian Limpach for spotting this one.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-30 16:59:58 -08:00
Keir Fraser a9f743f88c Free d->mem_event on domain destruction.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-30 07:12:41 -08:00
Keir Fraser d93b583113 waitqueue: Hold a reference to a domain on a waitqueue.
Also allow waitqueues to be dynamically destroyed.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-25 20:32:05 +00:00
Keir Fraser 6eb91524ed waitqueue: Implement wake_up_{nr,one,all}.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-25 20:27:11 +00:00
Keir Fraser 5e0f79980e atomic: Define {read,write}_atomic() for reading/writing memory atomically.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-25 13:31:58 +00:00
Keir Fraser 44fc6177ee x86/waitqueue: Because we have per-cpu stacks, we must wake up on teh
same cpu that we slept on. Otherwise stack references are bogus on
wakeup.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-24 15:50:08 +00:00
Keir Fraser 9333781f50 waitqueue: Reorder prepare_to_wait() so that vcpu is definitely on the
queue on exit, even after a wakeup.

Otherwise, when we go round the loop in wait_event(), we may not
actually sleep after the first iteration, as we do not put ourselves
back on the queue on wakeup.

Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-24 15:49:25 +00:00
Keir Fraser 7d798b7c99 waitqueue: Detect saved-stack overflow and crash the guest.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-24 15:48:10 +00:00
Keir Fraser acbd69baab debug: Add domain/vcpu pause_count info to 'd' key.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-22 15:35:26 +00:00