Skip to content

Nested SVM: Common infra with testcases for VMRUN,SAVE,LOAD, STGI/CLGI#16

Open
bernhardkaindl wants to merge 19 commits into
andyhhp:masterfrom
xen-incubator:nested-svm-vmrun-vmload-vmsave-0.4
Open

Nested SVM: Common infra with testcases for VMRUN,SAVE,LOAD, STGI/CLGI#16
bernhardkaindl wants to merge 19 commits into
andyhhp:masterfrom
xen-incubator:nested-svm-vmrun-vmload-vmsave-0.4

Conversation

@bernhardkaindl

Copy link
Copy Markdown
Contributor

No description provided.

Bernhard Kaindl added 10 commits June 6, 2026 12:20
Replace the loop with explicit top-level per-test targets so GNU make
can parallelise recursive sub-makes across the selected test set.

This cuts the parallel build time for the full test suite from 30s to 1.5s
by enabling GNU make to schedule work across test directories. Before:

time make clean all -j16 >/tmp/make.log
real    0m14.743s
user    0m29.195s
sys     0m17.121s

After:

real    0m3.136s
user    0m26.483s
sys     0m14.107s

The parallel empty build time is reduced from 6s to about 0.5s.

Because the sub-makes rebuild shared objects under common/ and arch/,
add a one-time bootstrap build before the parallel fan-out when more
than one test is selected.

Single-test builds skip the bootstrap so `TESTS=...` works like before.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Update the Makefile to build and install targets from the top-level
directory, rather than from within each test directory.

This helps ensure the relative paths in the build output match the
source file paths, making it easier to navigate from the build output
to the source files when diagnosing build errors. Before:

main.c: In function ‘test_main’:
main.c:17:11: error: ‘cpu_has_intel_vmx’ undeclared
              (first use in this function); did you mean ‘cpu_has_vmx’?
   17 |     if ( !cpu_has_intel_vmx )
      |           ^~~~~~~~~~~~~~~~~
      |           cpu_has_vmx

After:

tests/nested-vmx/main.c: In function ‘test_main’:
tests/nested-vmx/main.c:17:11: error: ‘cpu_has_intel_vmx’ undeclared
              (first use in this function); did you mean ‘cpu_has_vmx’?
   17 |     if ( !cpu_has_intel_vmx )
      |           ^~~~~~~~~~~~~~~~~
      |           cpu_has_vmx

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
…ting)

The reorder-python-imports hook removes an empty line which breaks
black formatting (black is a standard, widely-used Python formatter).

It also unconditionally forces to split all imports using "from"
imports into one line per "from" which is non-standard in Python.

Removing it makes room for the standard Python isort hook and allows
to ensure PEP8-compliant formatting using the Python black formatter.

While at it, also add brief installation notes for using pre-commit.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Fix this warning by pre-commit: top-level `default_stages` uses deprecated
stage names (commit, push) which will be removed in a future version.
run: `pre-commit migrate-config` to automatically fix this.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Update the build system to use Ninja for builds when available.
This reduces the minimal incremental build time from 0.5s to 0.15s.

This reduction helps when auto-rebuilding XTF based on inotify-watches,
enabling a quick turnaround of changes.

Recursive make remains available as a fallback if ninja is not available
and when USE_MAKE=1 is set for explicit override.

When USE_MAKE is not enabled, the top-level Makefile emits a Ninja
graph from the existing test metadata and drives it with Ninja. The
test Makefiles are parsed as metadata by defining XTF_METADATA_ONLY.
A Python generator turns the captured metadata into a Ninja graph for
binaries, cfg files, info.json, and install targets. The generated Ninja
graph also preserves the existing DESTDIR install layout, including
xtf-runner and all selected test artifacts under $(xtftestdir).

As before, the build system is designed to be portable and does not
require Ninja to be installed, but it can take advantage of it when
available. When ninja is used, the output of the build is also more
concise and focused on the actual build steps, without the noise of
make's recursive invocation and command echoing.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
With the new test category, all nested SVM tests can be run using:
./xtf-runner nested-svm

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
The empty placeholder nested-svm test is obsoleted by the
tests for VMRUN, VMLOAD and VMSAVE, and should be removed.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
@bernhardkaindl bernhardkaindl changed the title https://github.com/andyhhp/xtf/compare/master...xen-incubator:xtf-bernhard-svm:nested-svm-vmrun-vmload-vmsave-0.4 Nested SVM: Common infra with testcases for VMRUN,SAVE,LOAD, STGI/CLGI Jul 20, 2026
@bernhardkaindl
bernhardkaindl force-pushed the nested-svm-vmrun-vmload-vmsave-0.4 branch 4 times, most recently from fa6d88b to 200ccdb Compare July 20, 2026 17:31
Bernhard Kaindl added 7 commits July 21, 2026 11:27
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Move the existing xtf-runner implementation from the top-level executable
to xtf.runner.cli, fully update it to Python 3 syntax and style and
fix all pylint warnings to enable pylint in CI.

The implementation can now also be imported directly by new Python code.

Add a selftest for the extracted runner.  The test builds a temporary
XTF metadata tree and mocks the Xen toolstack boundary, covering list
selection output, run summary and exit-code mapping, and the console
execution sequence used to create, attach to and unpause a guest.

While at it, add support for detecting expected crashes with XFAIL in
the test's console output and show them as pass with expected fail.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Based on an initial experiment by Ross to run a minimal L2.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Based on an initial experiment by Ross to run a minimal L2.

PS: Use the category nested-svm to run all nested SVM tests:
./xtf-runner nested-svm

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
The test assert the error handling of using a test matrix
of execution of VMLOAD and VMSAVE in a matrix of contexts:
- User and Kernel context
- EFER.SVME enabled and disabled
- EAX VMCB register aligned, unaligned, or outside of physical range
- CPL0 and CPL3

PS: Use the category nested-svm to run all nested SVM tests:
./xtf-runner nested-svm

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
@bernhardkaindl
bernhardkaindl force-pushed the nested-svm-vmrun-vmload-vmsave-0.4 branch from 200ccdb to b97eeeb Compare July 21, 2026 11:30
@bernhardkaindl
bernhardkaindl force-pushed the nested-svm-vmrun-vmload-vmsave-0.4 branch from 6fbe4c3 to c4defe4 Compare July 21, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant