Andrew Cooper [Fri, 18 Nov 2016 13:21:34 +0000 (13:21 +0000)]
Uniformly enable WP for HVM environments
This brings them in line with PV environments (which have no choice in the
matter), and better matches usual expectations for the behaviour of read-only
pages.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Thu, 17 Nov 2016 17:21:35 +0000 (17:21 +0000)]
Print test titles earlier during startup
Certain conditions, such as failing the test_needs_fep check, result in the
framework exiting before calling test_main(). Logs from such runs are
impossible to distinguish.
Require tests to provide a test_title string, and print it as part of the
startup banner.
Update make-new-test.sh and the introductory docs to match
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 21 Oct 2016 13:17:19 +0000 (14:17 +0100)]
Unify and shorten the I/L/GDT paths in x86_exc_decode_ec()
The split between L/GDT selector (in hex) and IDT index (in decimal) is
awkward to read when both types of errors are seen together. Furthermore, the
vec/sel text adds unncessary length to the message.
Switch to uniformally reporting the table index in C array syntax which is
shorter to express.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 14 Oct 2016 13:18:35 +0000 (14:18 +0100)]
Modify exec_user() to pass a return value back from the called function
This turns out to be rather more useful in general, and the only changes
required to make it work is not to clobber %eax on the return back to kernel.
A compatability exec_user_void() is introduced to wrap exec_user() for
existing users with void functions. The exec_user selftest is updated to use
the new functionality, instead of passing a result back via a static variable.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 7 Oct 2016 15:03:03 +0000 (16:03 +0100)]
Introduce static inline helpers for {l,s}{gdt,idt,ldt,tr}()
And replace existing opencoded examples. The m16 forms of str/sldt are awkard
to encode in a way which doesn't impact the more common reg encoding. Leave
the asm constraints as reg only, which causes the processor to zero-extend the
selector into the destination register.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 23 Aug 2016 14:55:22 +0000 (15:55 +0100)]
Introduce common extable helper functions
It is turning out to be a common pattern to use extable handlers to catch a
fault at an instruction under test. Introduce a common extable handler to
return fault information in %eax.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 5 Sep 2016 16:49:10 +0000 (17:49 +0100)]
Fix the use of ./xtf-runner on Python 2.4
* subprocess has no check_output(). Opencode it.
* {} set notation doesn't exist. Call the set() constructor explicitly.
* tuple has no .index(). Switch all_results to being a list.
* OptionParser() has no epilog option. Monkeypatch it into the parser object.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Wed, 3 Aug 2016 14:20:45 +0000 (15:20 +0100)]
Add CONFIG_{32,64}BIT to config.h
To allow the use of IS_DEFINED() in preference to #ifdef __x86_64__/__i386__
to reduce the likelihood of bitrot.
In turn, modify page.h and pagetable.h sufficiently to compile for unpaged
enviroments. This leaves a link error if dead-code-elimination doesn't manage
to elide the reference.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Wed, 3 Aug 2016 11:48:39 +0000 (12:48 +0100)]
Audit the use of the skip result
Report a skip for swint-emulation if the main purpose of the test is unable to
be performed. However, run the first half of the tests against real hardware
to confirm that the algorithm is correct
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 2 Aug 2016 18:43:12 +0000 (19:43 +0100)]
build: Fix the install rule for configuration files
install-$(env) should only depend on the $(env) subset of all configuration
files, and all configuration files should be installed, rather than just the
first listed.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 2 Aug 2016 18:08:43 +0000 (19:08 +0100)]
mkinfo: Fix JSON damage from splitting an empty string
In python, splitting an empty string results in a single-entry list containing
an empty string. This causes the variations list to be wrong when no
variations are in use.
It is only by chance that doesn't cause an issue for ./xtf-runner
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 2 Aug 2016 16:30:41 +0000 (17:30 +0100)]
Rework the pv-iopl test using variations
The hypercall and vmassist tests are logically separate, and while the
hypercall version has been around for a very long time, vmassist was only
introduced in Xen 4.7.
To be able to sensibly test the hypercall part on older versions of Xen, they
should be treated separately, so the skip from vmassist detection doesn't
influence the results from the hypercall test.
To test them independently, introduce variations which alter the cmdline
passed to the guest.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 2 Aug 2016 15:09:00 +0000 (16:09 +0100)]
Introduce GFN terminology to memory management
which allows for common code to use gfn_to_virt()/virt_to_gfn() without
needing to worry whether it is a PV or HVM guest.
Add a pte_from_virt() helper to construct a pagetable entry pointing at a data
item linked into the test microkernel. To avoid inclusion problems, split the
independent pagetable modification functions out into a separate header file.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 2 Aug 2016 09:46:45 +0000 (10:46 +0100)]
runner: Add --all and --non-default options to help with category selection
This allows calling software to easily find all tests to run without needing
to name categories, environments or tests specifically.
--all is expected to cover the usual case, while --non-default is provided
just in case. It is not expected to be running the non-default category tests
in bulk.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Wed, 27 Jul 2016 12:23:29 +0000 (13:23 +0100)]
Introduce test variations
In certain cases it will be useful to run the same test binary with different
configurations, providing logically separate results.
Introduce the concept of a test variation, which generates a different set of
configuraiton files referring to the same binary. xtf-runner is updated to
understand variations.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 29 Jul 2016 16:28:49 +0000 (16:28 +0000)]
runner: Rework test selection logic
The existing logic for test selection was awkward to use and somewhat
non-intuitive. It also had an annoying habit of accidentially running the msr
utility and causing excessive logspam.
First of all, switch the all_{categories,environments} tuples to sets, which
allows for cleaner logic during selection. Split all_categories into default
and non-default subsets, where the non-default subset is not available unless
explicitly referenced.
Introduce interpret_selection() with the purpse of interpreting a collection
of string parameter, and returning the commplete list of TestInstances covered
by the selection.
interpret_selection() is now called before action selection, and replaces the
existing ad-hoc logic in the list and run calls. As a result, selections are
now identical for the list and run paths.
The --help documentation is also updated to reflect the new behaviour.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 1 Aug 2016 10:20:02 +0000 (11:20 +0100)]
runner: Introduce TestInstance to wrap an individual test
Implement vm_name() and cfg_path() methods to move those details out of the
test running logic.
Introduce parse_test_instance_string() as a single location tasked with
parsing the string representation of a test instance, and verifying the
provided information.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 29 Jul 2016 15:31:26 +0000 (15:31 +0000)]
runner: Introduce TestInfo to wrap the raw test json
The constructor now performs appropriate verification on the json
configuration, rather than open-coding it in get_all_test_info(). Users of
the dictionary-like json are altered to use attributes.
An all_instances() method is added to return test instances for all suitable
environments, optionally with a subset filter. This is used in preference to
three open-coded loops, generating instance names.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Thu, 28 Jul 2016 11:54:26 +0000 (11:54 +0000)]
runner: Cache the combined test json
To avoid rereading the same data from the disk. Later it will be needed on
several paths. Additionally, rename 'test_info' to 'info_file' to make its
use more clear.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Wed, 20 Jul 2016 17:43:13 +0000 (18:43 +0100)]
Correct the usage of $(DESTDIR) and $(PREFIX)
The GNU coding standards expect $(DESTDIR) to be the root of everything
installed, and for $(PREFIX) to then be added to the path. This is not how
XTF previously behaved.
XTF is not a typical package, and doesn't meet the usual semantics; it expects
to arrange all files under a single directory. Drop the use of $(PREFIX)
entirely (to avoid the expectation that it behaves as $(prefix) usually
behaves) and introduce $(xtfdir) instead.
$(DESTDIR) now works as intended for staged installes, and $(xtfdir) is the
single selected directy containing all installed content.
The intended way to install XTF now:
$ make install DESTDIR=/path/to/staging/area xtfdir=/local/scratch/xtf
Reported-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Sun, 17 Jul 2016 16:45:33 +0000 (17:45 +0100)]
pv32pae: Probe for leaked SMEP/SMAP before switching to user mappings
This allows XTF to panic() with a useful error message, rather than crashing
with an obscure error on the hypervisor console because of Xen failing to
create a bounce frame on the (now-user) stack.
Update the documentation, as Xen 4.7 no longer leaks SMEP/SMAP into guests.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 19 Jul 2016 13:58:46 +0000 (14:58 +0100)]
pv: Honour test_wants_user_mappings
32bit PV guests start on supervisor mappings, and previously unilaterally
switched to user mappings. Now, only switch to user mappings if a test has
opted in.
64bit PV guests run at cpl3, must use user mappings and architecturally have
no choice in the matter.
This change is best reviewed with `git show --ignore-all-space`
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 19 Jul 2016 13:51:04 +0000 (14:51 +0100)]
Introduce a per-test opt-in for using user mappings
The choice of user or supervisor mappings is currently chosen for the
test, and is inflexible for a test needing to run in situations where
Xen leaks SMEP/SMAP into the guest, or where the test specifically wants
to use SMEP/SMAP itself.
As it turns out, fewer tests require user mappings than not. For the
tests which don't require user mappings, allowing them to run on
supervisor mappings is quicker to set up, and allows the test to run
even if Xen leaks paging state.
Introduce test_wants_user_mappings and default it to false. Tests which
want user mappings can opt-in by overriding the weak reference to true.
Explicit set the opt-in for the three tests which currently require
them.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>