]> xenbits.xensource.com Git - xtf.git/log
xtf.git
8 years agoDocs: Fix the generated advisory links
Andrew Cooper [Mon, 19 Dec 2016 17:47:17 +0000 (17:47 +0000)]
Docs: Fix the generated advisory links

The ./make-new-test.sh script was failing to write the correct URL.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoImplement exec_user_param()
Andrew Cooper [Tue, 23 Aug 2016 14:55:22 +0000 (15:55 +0100)]
Implement exec_user_param()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoDocument the interaction of x32 ABI support and hvm64 tests
Andrew Cooper [Wed, 14 Dec 2016 13:41:15 +0000 (13:41 +0000)]
Document the interaction of x32 ABI support and hvm64 tests

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agodon't require x32 support in binutils
Jan Beulich [Wed, 14 Dec 2016 13:31:25 +0000 (13:31 +0000)]
don't require x32 support in binutils

Older binutils don't have this at all, and newer may not have it
configured in.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
8 years agoXSA-196 PoC
Andrew Cooper [Thu, 27 Oct 2016 10:33:32 +0000 (11:33 +0100)]
XSA-196 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-195 PoC
Andrew Cooper [Wed, 2 Nov 2016 18:44:43 +0000 (18:44 +0000)]
XSA-195 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-194 PoC
Andrew Cooper [Tue, 15 Nov 2016 17:40:45 +0000 (17:40 +0000)]
XSA-194 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-193 PoC
Andrew Cooper [Tue, 25 Oct 2016 11:00:45 +0000 (12:00 +0100)]
XSA-193 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-192 PoC
Andrew Cooper [Thu, 27 Oct 2016 10:53:46 +0000 (11:53 +0100)]
XSA-192 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-191 PoC
Andrew Cooper [Thu, 3 Nov 2016 11:27:15 +0000 (11:27 +0000)]
XSA-191 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoDocs: Minor grammar improvements
Andrew Cooper [Mon, 21 Nov 2016 17:22:36 +0000 (17:22 +0000)]
Docs: Minor grammar improvements

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-170 PoC
Andrew Cooper [Sat, 9 Jan 2016 15:25:14 +0000 (15:25 +0000)]
XSA-170 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd a Live Patch privilege check test
Ross Lagerwall [Mon, 21 Nov 2016 09:24:22 +0000 (09:24 +0000)]
Add a Live Patch privilege check test

Add a test to check that Live Patch operations cannot be called from an
unprivileged domain.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fix build with clang

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUniformly enable WP for HVM environments
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>
8 years agoPrint test titles earlier during startup
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>
8 years agoInclude an optional local Makefile by default
Andrew Cooper [Wed, 16 Nov 2016 13:07:12 +0000 (13:07 +0000)]
Include an optional local Makefile by default

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoImprovements to the cpuid utility
Andrew Cooper [Mon, 14 Nov 2016 10:03:58 +0000 (10:03 +0000)]
Improvements to the cpuid utility

 * Enable viridian for HVM guests to expose more leaves
 * Identify the Xen leaves, and add subleaf logic

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-186: Work around suspected Broadwell TLB erratum
Andrew Cooper [Fri, 28 Oct 2016 10:34:53 +0000 (11:34 +0100)]
XSA-186: Work around suspected Broadwell TLB erratum

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce exinfo_t to formalise the existing ad-hoc exception encapsulation
Andrew Cooper [Mon, 3 Oct 2016 13:12:00 +0000 (13:12 +0000)]
Introduce exinfo_t to formalise the existing ad-hoc exception encapsulation

Set the top bit to distinguish a DivideError from no exception.  Add
x86_decode_exinfo() to assist printing an exinfo_t.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce mnemonics for x86 selectors
Andrew Cooper [Thu, 6 Oct 2016 16:52:39 +0000 (17:52 +0100)]
Introduce mnemonics for x86 selectors

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix the build with Clang 3.9
Andrew Cooper [Fri, 21 Oct 2016 14:32:33 +0000 (14:32 +0000)]
Fix the build with Clang 3.9

Clang 3.9 complains that `fild` is ambiguous with respect to the size of its
memory operand.  Specify `fildq` explicitly.

Drop "-no-integrated-as" from the docs, as both Clang 3.5 and 3.9 work fine
with or without it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMinor docs corrections
Andrew Cooper [Fri, 21 Oct 2016 12:49:13 +0000 (13:49 +0100)]
Minor docs corrections

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUnify and shorten the I/L/GDT paths in x86_exc_decode_ec()
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>
8 years agoCPUID Faulting tests
Andrew Cooper [Fri, 14 Oct 2016 12:32:36 +0000 (13:32 +0100)]
CPUID Faulting tests

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRun double faults on a separate stack
Andrew Cooper [Fri, 14 Oct 2016 14:51:18 +0000 (14:51 +0000)]
Run double faults on a separate stack

For 64bit, use interrupt stack tables.  For 32bit, use a task gate referring
to a dedicated double fault TSS.

This allows some situations to print error information rather than falling
into a triple fault.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce cr3_target as an alias of the pagetable pointed to by %cr3
Andrew Cooper [Mon, 17 Oct 2016 17:24:55 +0000 (18:24 +0100)]
Introduce cr3_target as an alias of the pagetable pointed to by %cr3

Use the new alias to simplify the pagetable setup in in head_hvm.S

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide library {rdmsr,wrmsr}_safe() functions
Andrew Cooper [Mon, 17 Oct 2016 09:36:45 +0000 (10:36 +0100)]
Provide library {rdmsr,wrmsr}_safe() functions

Replace a local implementation in the MSR utility.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRename ex_record_fault to ex_record_fault_eax
Andrew Cooper [Fri, 14 Oct 2016 12:38:23 +0000 (13:38 +0100)]
Rename ex_record_fault to ex_record_fault_eax

It is more descriptive, and future work will introduce equivalent handlers
which use different registers.

While making this change, improve the asm constraints at ex_record_fault()'s
current callsites.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoImplement write_cs() to match the existing read_cs()
Andrew Cooper [Fri, 14 Oct 2016 15:37:02 +0000 (16:37 +0100)]
Implement write_cs() to match the existing read_cs()

%cs can't be directly written to, so this is implemented using lret.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoExtend TOK_OR() to work with up to 11 parameters
Andrew Cooper [Thu, 13 Oct 2016 13:31:08 +0000 (14:31 +0100)]
Extend TOK_OR() to work with up to 11 parameters

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoModify exec_user() to pass a return value back from the called function
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>
8 years agoIntroduce static inline helpers for {l,s}{gdt,idt,ldt,tr}()
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>
8 years agoRefer some XSAs back to the functional tests which identify them
Andrew Cooper [Tue, 11 Oct 2016 09:56:47 +0000 (10:56 +0100)]
Refer some XSAs back to the functional tests which identify them

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFPU Exception Emulation
Andrew Cooper [Wed, 28 Sep 2016 13:11:36 +0000 (14:11 +0100)]
FPU Exception Emulation

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce common extable helper functions
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>
8 years agoAllow ./make-new-test.sh to determine the default category more cleverly
Andrew Cooper [Wed, 28 Sep 2016 11:37:53 +0000 (12:37 +0100)]
Allow ./make-new-test.sh to determine the default category more cleverly

When making an XSA proof of concept test, automatically generate the standard
documentation template.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAllow ./make-new-test.sh to take the test name as $1
Andrew Cooper [Wed, 28 Sep 2016 10:57:51 +0000 (11:57 +0100)]
Allow ./make-new-test.sh to take the test name as $1

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMakefile: introduce gtags target
Wei Liu [Mon, 26 Sep 2016 15:07:33 +0000 (16:07 +0100)]
Makefile: introduce gtags target

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCorrect the documentation for the XSA-186 PoC
Andrew Cooper [Fri, 9 Sep 2016 17:48:43 +0000 (18:48 +0100)]
Correct the documentation for the XSA-186 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-185 PoC
Andrew Cooper [Fri, 5 Aug 2016 17:25:07 +0000 (17:25 +0000)]
XSA-185 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-182 PoC
Andrew Cooper [Wed, 13 Jul 2016 20:51:11 +0000 (21:51 +0100)]
XSA-182 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-186 PoC
Andrew Cooper [Fri, 5 Aug 2016 15:34:46 +0000 (16:34 +0100)]
XSA-186 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix test fallout from recent Xen change
Andrew Cooper [Thu, 8 Sep 2016 15:33:16 +0000 (16:33 +0100)]
Fix test fallout from recent Xen change

A recent Xen change switched some use of -ENOSYS to -EOPNOTSUPP.  Treat them
equivelently where relevent.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-188 PoC
David Vrabel [Fri, 2 Sep 2016 12:39:36 +0000 (13:39 +0100)]
XSA-188 PoC

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAppropriately mask out the address and flags parameters when constructing a pte
Andrew Cooper [Thu, 8 Sep 2016 11:46:05 +0000 (12:46 +0100)]
Appropriately mask out the address and flags parameters when constructing a pte

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix the use of ./xtf-runner on Python 2.4
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>
8 years agoxtf-runner: Introduce logfile mode for obtaining results
Wei Liu [Mon, 15 Aug 2016 14:55:22 +0000 (15:55 +0100)]
xtf-runner: Introduce logfile mode for obtaining results

Add --results-mode=logfile as an alternative method of obtaining test results.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUpdate XSA-173 to use newer helpers
Andrew Cooper [Fri, 2 Sep 2016 12:26:00 +0000 (13:26 +0100)]
Update XSA-173 to use newer helpers

Use pte_from_*() and PF_SYM() rather than opencoding them.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd helpers to fold and unfold a pv32pae guest cr3
Andrew Cooper [Tue, 30 Aug 2016 16:29:51 +0000 (17:29 +0100)]
Add helpers to fold and unfold a pv32pae guest cr3

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUpdate the documentation to point at XTF's canonical location
Andrew Cooper [Thu, 18 Aug 2016 16:19:23 +0000 (17:19 +0100)]
Update the documentation to point at XTF's canonical location

Add a note concerning OSSTest, pointing elsewhere

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix Clang build following c/s 9f35dbe0
Andrew Cooper [Fri, 12 Aug 2016 12:32:01 +0000 (13:32 +0100)]
Fix Clang build following c/s 9f35dbe0

Clang objects to macros altering the prototypes in string.c, and redefining
the __builtin_*() varients.  Reduce the include to just <xen/types.h>.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce a binary representation of the Force Emulation Prefix
Andrew Cooper [Fri, 5 Aug 2016 17:20:16 +0000 (17:20 +0000)]
Introduce a binary representation of the Force Emulation Prefix

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce xtf_set_idte() to allow tests to add extra IDT entries
Andrew Cooper [Fri, 15 Jul 2016 16:02:56 +0000 (16:02 +0000)]
Introduce xtf_set_idte() to allow tests to add extra IDT entries

Add an extra entry to the selftests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIDT Vector allocation and infrastructure
Andrew Cooper [Fri, 15 Jul 2016 15:31:58 +0000 (15:31 +0000)]
IDT Vector allocation and infrastructure

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd `./xtf-runner --list --environments` to obtain the full environment list
Andrew Cooper [Wed, 3 Aug 2016 14:28:41 +0000 (15:28 +0100)]
Add `./xtf-runner --list --environments` to obtain the full environment list

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd CONFIG_{32,64}BIT to config.h
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>
8 years agoAudit the use of the skip result
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>
8 years agoIntroduce test_needs_fep to help uniform handling of fep being unavailable
Andrew Cooper [Wed, 3 Aug 2016 11:33:52 +0000 (12:33 +0100)]
Introduce test_needs_fep to help uniform handling of fep being unavailable

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Fix the install rule for configuration files
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>
8 years agomkinfo: Fix JSON damage from splitting an empty string
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>
8 years agoRework the pv-iopl test using variations
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>
8 years agoAdd an implementation of strcmp()
Andrew Cooper [Tue, 2 Aug 2016 17:07:18 +0000 (18:07 +0100)]
Add an implementation of strcmp()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-183 PoC
Andrew Cooper [Thu, 14 Jul 2016 12:07:16 +0000 (13:07 +0100)]
XSA-183 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce GFN terminology to memory management
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>
8 years agorunner: Add --all and --non-default options to help with category selection
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>
8 years agoMisc documentation improvements
Andrew Cooper [Fri, 29 Jul 2016 16:22:13 +0000 (16:22 +0000)]
Misc documentation improvements

 * Update the test running examples to use ./xtf-runner
 * Correct two descriptions of issues fixed in Xen 4.7

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce 'hap' and 'shadow' variations
Andrew Cooper [Wed, 27 Jul 2016 12:24:01 +0000 (13:24 +0100)]
Introduce 'hap' and 'shadow' variations

Used for HVM-based tests pertaining to pagetable behaviour, which want running
both against both paging modes.

Modify the invlpg tests to run in both shadow and hap paging modes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce test variations
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>
8 years agorunner: Rework test selection logic
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>
8 years agorunner: Introduce TestInstance to wrap an individual test
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>
8 years agorunner: Introduce TestInfo to wrap the raw test json
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>
8 years agorunner: Cache the combined test json
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>
8 years agorunner: Switch --host to being a real parameter
Andrew Cooper [Thu, 28 Jul 2016 11:47:00 +0000 (11:47 +0000)]
runner: Switch --host to being a real parameter

This avoids having extra magic parameters in the mix of categories,
environments and test names

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce .gitattributes
Andrew Cooper [Fri, 29 Jul 2016 13:02:42 +0000 (13:02 +0000)]
Introduce .gitattributes

This allows `git diff` and friends to be slightly more clever about generating
hunks for specific files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Generate xl configurations with a python script rather than by hand
Andrew Cooper [Tue, 26 Jul 2016 18:55:26 +0000 (19:55 +0100)]
build: Generate xl configurations with a python script rather than by hand

It is about to get more complicated.  Additionally, specify a dependency on
$(TEST-EXTRA-CFG) if specified by a test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agomkinfo: Assign names to command line parameters
Andrew Cooper [Tue, 26 Jul 2016 18:53:18 +0000 (19:53 +0100)]
mkinfo: Assign names to command line parameters

This is easier to read, and has a side effect of bailing with a hard error if
the wrong number of parameters are passed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRename test-info.json to just info.json
Andrew Cooper [Mon, 25 Jul 2016 16:37:09 +0000 (17:37 +0100)]
Rename test-info.json to just info.json

There are enough files starting with test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Add move-if-changed helper
Andrew Cooper [Tue, 26 Jul 2016 15:33:43 +0000 (15:33 +0000)]
build: Add move-if-changed helper

And use it in preference to repeated opencoding

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCorrect the usage of $(DESTDIR) and $(PREFIX)
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>
8 years agoIntroduce $(INSTALL_DIR) and use it in preference to mkdir
Andrew Cooper [Thu, 21 Jul 2016 11:37:15 +0000 (12:37 +0100)]
Introduce $(INSTALL_DIR) and use it in preference to mkdir

Include the -p parameters by default for $(INSTALL*) variables rather than
opencoding them everywhere.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce zeroptr[] for accessing virtual address 0
Andrew Cooper [Mon, 25 Jul 2016 15:29:03 +0000 (16:29 +0100)]
Introduce zeroptr[] for accessing virtual address 0

There are some times when access to 0 is really needed.  Use the linker to
work around NULL pointer logic in the compiler.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: regularise runner exit code
Wei Liu [Mon, 13 Jun 2016 14:06:48 +0000 (15:06 +0100)]
xtf-runner: regularise runner exit code

The script now returns the most severe result. Document the exit code in
help string.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: provide a set of exit codes for different results
Wei Liu [Thu, 21 Jul 2016 15:06:19 +0000 (16:06 +0100)]
xtf-runner: provide a set of exit codes for different results

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: sync all test results
Wei Liu [Mon, 13 Jun 2016 14:30:10 +0000 (15:30 +0100)]
xtf-runner: sync all test results

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agogitignore: ignore vim swp file
Wei Liu [Fri, 22 Jul 2016 09:17:29 +0000 (10:17 +0100)]
gitignore: ignore vim swp file

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoExport ROOT, DESTDIR and PREFIX to all makefiles
Andrew Cooper [Wed, 20 Jul 2016 17:05:45 +0000 (18:05 +0100)]
Export ROOT, DESTDIR and PREFIX to all makefiles

Rather than regenerating them from defaults each time.  Drop the MAKEFLAGS
lines, as MAKEFLAGS are automatically inherited by sub-makes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce makefile variable for commands in use per the GNU coding standards
Andrew Cooper [Wed, 20 Jul 2016 15:26:33 +0000 (16:26 +0100)]
Introduce makefile variable for commands in use per the GNU coding standards

Use the suggested defaults, and replace all open-coded examples.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix the handling of errors in the all/build targets
Andrew Cooper [Wed, 20 Jul 2016 15:26:33 +0000 (16:26 +0100)]
Fix the handling of errors in the all/build targets

Currently a build error will be eaten by the shell for loop, causing the
makefile not to stop.  Use `set -e;` to prevent this behaviour

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopv32pae: Probe for leaked SMEP/SMAP before switching to user mappings
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>
8 years agoIntroduce more pagetable helpers
Andrew Cooper [Tue, 19 Jul 2016 15:05:23 +0000 (16:05 +0100)]
Introduce more pagetable helpers

Symbolic constants for expressing pte flags in a short way, and helpers to
construct a pagetable entry from a frame and flags.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agohvm: Honour test_wants_user_mappings
Andrew Cooper [Tue, 19 Jul 2016 13:51:30 +0000 (14:51 +0100)]
hvm: Honour test_wants_user_mappings

Fewer tests overall need user mappings, so construct the identity pagetables
without _PAGE_USER set in leaf entries by default.

Before loading paging settings, check whether a test has opted-in to user
mappings, and re-add _PAGE_USER to the l1 and l2 pagetable entries.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide PTE_SIZE and PTE_ORDER appropriate for the in-use paging mode
Andrew Cooper [Tue, 19 Jul 2016 12:38:01 +0000 (13:38 +0100)]
Provide PTE_SIZE and PTE_ORDER appropriate for the in-use paging mode

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopv: Honour test_wants_user_mappings
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>
8 years agoIntroduce a per-test opt-in for using user mappings
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>
8 years agoIntroduce more memory management helpers
Andrew Cooper [Tue, 19 Jul 2016 12:36:27 +0000 (13:36 +0100)]
Introduce more memory management helpers

These are still simply, relying on identity mappings and state provided by the
domain builder for PV guests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd Xen ABI for update_va_mapping flags, and replace opencoded constants
Andrew Cooper [Fri, 15 Jul 2016 09:02:29 +0000 (10:02 +0100)]
Add Xen ABI for update_va_mapping flags, and replace opencoded constants

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoReplace @sa with @see in all documentation
Andrew Cooper [Fri, 15 Jul 2016 13:02:37 +0000 (14:02 +0100)]
Replace @sa with @see in all documentation

They are identical as far as Doxygen is concerned, but more intuitive when
reading the raw text.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce invlpg() helper
Andrew Cooper [Wed, 1 Jun 2016 13:40:21 +0000 (14:40 +0100)]
Introduce invlpg() helper

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelpers to pack and unpack a frame in a PSE36 superpage
Andrew Cooper [Wed, 1 Jun 2016 13:34:41 +0000 (14:34 +0100)]
Helpers to pack and unpack a frame in a PSE36 superpage

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCreate aliases of the live L1 and L2 pagetables
Andrew Cooper [Sun, 5 Jun 2016 17:18:35 +0000 (18:18 +0100)]
Create aliases of the live L1 and L2 pagetables

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>