Commit Graph
73 Commits
Author SHA1 Message Date
Tim Deegan 90b6e6c889 Tools: After a helper maps a ring, yank it from the guest physmap
This limits the ability of the guest to play around with its own rings, and DoS
itself.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2012-03-08 16:40:05 +00:00
Tim Deegan 770d1e858d Use a reserved pfn in the guest address space to store mem event rings
This solves a long-standing issue in which the pages backing these rings were
pages belonging to dom0 user-space processes. Thus, if the process would die
unexpectedly, Xen would keep posting events to a page now belonging to some
other process.

We update all API-consumers in tree (xenpaging and xen-access).

This is an API/ABI change, so please speak up if it breaks your accumptions.

The patch touches tools, hypervisor x86/hvm bits, and hypervisor x86/mm bits.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2012-03-08 16:40:05 +00:00
Tim Deegan 08d6219815 Tools: Remove shared page from mem_event/access/paging interfaces
Don't use the superfluous shared page, return the event channel directly as
part of the domctl struct, instead.

In-tree consumers (xenpaging, xen-access) updated. This is an ABI/API change,
so please voice any concerns.

Known pending issues:
- pager could die and its ring page could be used by some other process, yet
  Xen retains the mapping to it.
- use a saner interface for the paging_load buffer.

This change also affects the x86/mm bits in the hypervisor that process the
mem_event setup domctl.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2012-03-08 16:40:05 +00:00
Andres Lagar-Cavilla c13b827e66 x86/mm: New sharing audit memop
Remove costly mem_sharing audits from the inline path, and instead make them
callable as a memop.

Have the audit function return the number of errors detected.

Update memshrtool to be able to trigger audits.

Set sharing audits as enabled by default.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2012-02-10 16:07:07 +00:00
Andres Lagar-Cavilla 59a36d66a5 Use memops for mem paging, sharing, and access, instead of domctls
Per page operations in the paging, sharing, and access tracking subsystems are
all implemented with domctls (e.g. a domctl to evict one page, or to share one
page).

Under heavy load, the domctl path reveals a lack of scalability. The domctl
lock serializes dom0's vcpus in the hypervisor. When performing thousands of
per-page operations on dozens of domains, these vcpus will spin in the
hypervisor. Beyond the aggressive locking, an added inefficiency of blocking
vcpus in the domctl lock is that dom0 is prevented from re-scheduling any of
its other work-starved processes.

We retain the domctl interface for setting up and tearing down
paging/sharing/mem access for a domain. But we migrate all the per page
operations to use the memory_op hypercalls (e.g XENMEM_*).

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2012-02-10 16:07:07 +00:00
Andres Lagar-Cavilla 94a1eb5ac8 Tools: Make xen-access test compile in 32 bits mode
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Keir Fraser <keir@xen.org>
2012-02-09 06:28:53 -08:00
Andres Lagar-Cavilla 953953cc5a Tools: build tests
Build tests as part of the tools build.

It is enabled with CONFIG_TESTS in Config.mk

Currently disabled build of tests/regressions and tests/xen-access (in
32-bit mode) as they fail.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
2012-02-06 13:12:58 -08:00
Andres Lagar-Cavilla 1da3983b7d tools: memshrtool: tool to test and exercise the sharing subsystem
This is demo code meant to showcase how to perform sharing
operations. It is useful for testing.

[ Added appropriate lines to .hgignore and .gitignore -iwj ]

Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2012-01-27 18:23:42 +00:00
Liu, Jinsong 9ff59ff119 X86-MCE: fix a bug of xen-mceinj tool
Fix a bug of xen-mceinj tool which used to test mce by software way.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
2011-12-18 14:40:00 +00:00
Jan Beulich a1b22e625d x86/emulator: workaround for AMD erratum 573
The only cases where we might end up emulating fsincos (as any other
x87 operations without memory operands) are
- when a HVM guest is in real mode (not applicable on AMD)
- between two half page table updates in PAE mode (unlikely, and not
  doing the emulation here does affect only performance, not
  correctness)
- when a guest maliciously (or erroneously) modifies an (MMIO or page
  table update) instruction under emulation (unspecified behavior)

Hence, in order to avoid the erratum to cause harm to the entire host,
don't emulate fsincos on the affected AMD CPU families.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-12-16 15:45:40 +01:00
Jan Beulich 316af62170 x86/emulator: add emulation of SIMD FP moves
Clone the existing movq emulation to also support the most fundamental
SIMD FP moves.

Extend the testing code to also exercise these instructions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-12-01 08:49:31 +01:00
Jan Beulich 11c35f84b5 x86/emulator: generalize movq emulation (SSE2 and AVX variants)
Extend the existing movq emulation to also support its SSE2 and AVX
variants, the latter implying the addition of VEX decoding. Fold the
read and write cases (as most of the logic is identical), and add
movntq and variants (as they're very similar).

Extend the testing code to also exercise these instructions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2011-12-01 08:48:14 +01:00
Jan Beulich 373ac54141 test_x86_emulator: add a "run" target to the test code makefile
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
2011-11-16 15:50:55 +00:00
Keir Fraser b0198fc3f0 x86_emulate: Define and use BUG() and bool_t.
Original patch by Jan Beulich <jbeulich@suse.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-16 15:48:49 +00:00
Keir Fraser 3e3422bb01 test_x86_emulate: Get public Xen headers via tools/include.
Signed-off-by: Keir Fraser <keir@xen.org>
2011-11-16 15:28:55 +00:00
Jan Beulich 5d6a9065b8 x86-64/test_x86_emulate: fix blowfish test
Incorrect register usage in the _start() wrapper caused the 64-bit
execution emulation to fail.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
2011-11-16 15:20:25 +00:00
Olaf Hering 2c36185d44 mem_event: use different ringbuffers for share, paging and access
Up to now a single ring buffer was used for mem_share, xenpaging and
xen-access.  Each helper would have to cooperate and pull only its own
requests from the ring.  Unfortunately this was not implemented. And
even if it was, it would make the whole concept fragile because a crash
or early exit of one helper would stall the others.

What happend up to now is that active xenpaging + memory_sharing would
push memsharing requests in the buffer. xenpaging is not prepared for
such requests.

This patch creates an independet ring buffer for mem_share, xenpaging
and xen-access and adds also new functions to enable xenpaging and
xen-access. The xc_mem_event_enable/xc_mem_event_disable functions will
be removed. The various XEN_DOMCTL_MEM_EVENT_* macros were cleaned up.
Due to the removal the API changed, so the SONAME will be changed too.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
2011-09-16 12:19:26 +01:00
Aravindh Puthiyaparambil b14b2f0063 tools/tests/xen-access: minor bug fixes
Fix a couple of minor bugs in xen-access test program:
 * Fix -m option handling.
 * Fix a segfault that was occurring during program exit.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
2011-05-09 09:56:39 +01:00
Ian Campbell 9ac650d825 tools: remove pattern matched linking rules
Most subdirs only build a single tool to start with and those which
build multiple tools often have different linkage requirements.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:34:56 +01:00
Ian Campbell 61d0fe74c6 tools: Remove $(CFLAGS) from links lines.
The relevant variable in these circumstances is called $(LDFLAGS).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:32:18 +01:00
Ian Campbell ca366c33f3 tools: consistently use $({CFLAGS,LDLIBS}_libxenctrl) instead of open coding.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-21 18:05:49 +00:00
Ian Campbell 3531dea6fd tools: consistently use $(CFLAGS_xeninclude) instead of open coding.
Renamed from the slightly ambiguous CFLAGS_include.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-21 18:04:59 +00:00
Ian Campbell b936e4c617 tools: Drop XEN_XC variable
There is nothing to include in the python bindings source directory
and likely never was/will be ...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-21 18:00:17 +00:00
Ian Campbell 3135307760 tools: Drop use of $(INCLUDES)
Several places include it in CFLAGS even though it is never defined. A
few others use it as nothing more than a gathering point for
CFLAGS. Get rid of it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-21 17:45:50 +00:00
Keir Fraser 547cb1849c build: Make XEN_ROOT an absolute path.
Otherwise make can search the path relative to certain standard paths
such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in
Config.mk suffers from this).

Signed-off-by: Keir Fraser <keir@xen.org>
2011-03-17 10:36:25 +00:00
Joe Epstein cc8ad39c1f mem_access test tool: xen-access
Added a test tool to let the memory access APIs be tested.  This tool
logs to stdout the memory accesses that the domain given is performing.

Signed-off-by: Joe Epstein <jepstein98@gmail.com>
Signed-off-by: Keir Fraser <keir@xen.org>
2011-01-08 11:06:18 +00:00
Keir Fraser e7803f184a tools/tests: Move x86 emulator tests into a subdir
Signed-off-by: Keir Fraser <keir@xen.org>

--HG--
rename : tools/tests/Makefile => tools/tests/x86_emulator/Makefile
rename : tools/tests/blowfish.c => tools/tests/x86_emulator/blowfish.c
rename : tools/tests/blowfish.mk => tools/tests/x86_emulator/blowfish.mk
rename : tools/tests/test_x86_emulator.c => tools/tests/x86_emulator/test_x86_emulator.c
rename : tools/tests/x86_emulate.c => tools/tests/x86_emulator/x86_emulate.c
2011-01-08 10:59:13 +00:00
Keir Fraser 1fe3155693 Xen MCE test: all test cases
Implement the test cases. Each of cases will call the common function,
then call mce inject tool. README for Xen MCE test suite, include the
framwork and test instruction.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Haicheng Li<haicheng.li@intel.com>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
2010-12-24 10:23:08 +00:00
Keir Fraser bb400f3043 Xen MCE test: common functions to be used for test cases
Implement some common shell functions and variable definitions are
defined to be used by test cases Verify fuctions include domain0 user
space tool mcelog, Xen dmesg and guest kernel log verification.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Haicheng Li<haicheng.li@intel.com>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
2010-12-24 10:22:23 +00:00
Keir Fraser b6982669e8 Xen MCE test: utilities to inject fake MCE for X86
A software MCE injection tool, which is based on Xen MCE injection
mechanism. It fake MCE error and inject this error to a assigned
Domain Physical Address.  Makefile make sure the tool can be built on
Xen.  A README explain the usage for this tool.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Haicheng Li<haicheng.li@intel.com>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
2010-12-24 10:21:27 +00:00
Keir Fraser cfb53841a5 tools/tests: Test 64-bit x86 emulation in test_x86_emulate.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-10-11 10:22:24 +01:00
Keir Fraser 55a2e36cbc x86: Add -fno-exceptions to list of possibly-supported CFLAGS for embedded targets.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-07-25 22:20:47 +01:00
Keir Fraser 1b14383998 xend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel
and PV/ramdisk

Add support for 'file:' and 'data:' URI schemes for the parameters
'PV/kernel' and 'PV/ramdisk' in the VM.create() call. The 'data:'
scheme handling enables using a file which is stored inside the
management system (from where the XenAPI call is send) as kernel or
ramdisk.

Notes:
o all included: a detailed description can be found in the xenapi
documentation
o bumped up the version of the API document to 1.0.8 (because of
(minimal) interface extension)
o Future enhancements (like http:, ftp: schemes) fit seamlessly into
the current design / classes
o Unittest cases and xm-test case included

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-25 14:56:54 +01:00
Keir Fraser c88b1e06d5 x86: miscellaneous emulator adjustments
Defer fail_if()-s as much as possible (in favor of possibly generating
exceptions), and avoid generating exceptions when not strictly
necessary.

Avoid fail_if()-s for simple return code checks (making the code that
used them consistent with other, longer existing code).

Eliminate redundant generate_exception_if()-s checking lock_prefix
(which is already covered by the general check prior to decoding
operands).

Also fix the testing code to add PROT_EXEC for the mapping that is
intended to have instruction executed from.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-19 13:02:31 +01:00
Keir Fraser 00ee63bf97 tools/tests/regression/: Fix some paths and scripts.
o scripts and Makefile are mostly location independent now
  (exception XEN_ROOT in Makefile)
o use of $() instead of ${} in Makefile

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <Keir.Fraser@eu.citrix.com>
2009-08-02 12:22:03 +01:00
Keir Fraser 59efc1880b tools/tests: Add syntax check for different versions of python
From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-07-28 16:38:08 +01:00
Keir Fraser 6b1ce5497d build: Define cc-option-add to immediately add options to CFLAGS
without deferring the test execution of CC. This avoids extra
executions of CC every time CFLAGS is expanded.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-13 08:59:49 +00:00
Keir Fraser bd3358a451 tools: Don't turn CFLAGS into a := (immediate evaluation) variable as
this breaks 'CFLAGS += -MMD -MF .$(@F).d'

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-01-12 16:39:07 +00:00
Keir Fraser 1be51142f1 x86_emulate: read/write/insn_fetch emulation hooks now all take a
pointer to emulator data buffer, and an arbitrary byte count (up to
the size of a page of memory).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-06-30 14:19:09 +01:00
Keir Fraser dfff66aee9 x86_emulate: Support CMPXCHG16B.
Also clean up cmpxchg() callback handling so we can get rid of teh
specific cmpxchg8b handler.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-22 14:34:16 +01:00
Keir Fraser a6836b4fdd x86_emulate: Implement a more dynamic interface for handling FPU
exceptions, which will allow emulation stubs to be built dynamically
in a future patch.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-16 16:10:41 +01:00
Keir Fraser 0080a146fc x86 firmware: Consolidate firmware common build rules.
Also avoid overriding global optimisation default (-O1, -O2, etc.)

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-02 10:42:27 +01:00
Keir Fraser c0b0636f38 x86_emulate: Remove environment-specific definitions from core
emulator source files.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-03-31 14:21:13 +01:00
Keir Fraser 2bd0e7b965 x86_emulate: Allow writeback-avoidance optimisation to be defeated by
the caller. This is used in cases where the writeback may be to an
MMIO region with side effects (the APIC EOI register is the main
example of this).

Also fix up build of the x86_emulate user-space test harness.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-02-21 14:50:27 +00:00
Keir Fraser ad703ba167 tools: Avoid -nostdlib argument to $(LD).
This interacts badly with GNU ld on Solaris.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-11-13 17:57:22 +00:00
Keir Fraser bc0389d051 solaris: Fix Solaris tools build.
Signed-off-by: John Levon <john.levon@sun.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-11-02 10:16:37 +00:00
kfraser@localhost.localdomain fffb99beab x86: Extend emulator return codes.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-02-21 19:58:58 +00:00
kfraser@localhost.localdomain 12d473893b [XEN] Allow stack-address-size to be specified differently from
regular address-size in the emulator.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-01-15 15:43:20 +00:00
kaf24@localhost.localdomain 6d675a4ad8 [XEN] Emulate MUL/DIV. Tweak test suite build.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-01-14 12:03:31 +00:00
kaf24@localhost.localdomain ab5c6b8f11 [TESTS] Fix native jump to 1MB absolute address in emulator test.
Fix typo in emulator comment.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-01-13 21:36:31 +00:00