Skip to content

kvm-unit-tests: set of fixes and new tests

Maxim Levitsky kvm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest27 patches 28 repliesIn review
  2. v116 patches 34 repliesSuperseded

V2 from the cover letter

- addressed review feedback, and futher cleaned up the svm tests
set to use less global variables
(the patches are large, but each changes one thing all over the tests, so hopefully not hard to review).

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27x86: replace irq_{enable|disable}() with sti()/cli()lib/x86/processor.h lib/x86/smp.c x86/apic.c +14 more+98 -1053 replies
2/27x86: introduce sti_nop() and sti_nop_cli()lib/x86/processor.h x86/apic.c x86/eventinj.c +3 more+46 -641 reply
3/27x86: add few helper functions for apic local timerlib/x86/apic.c lib/x86/apic.h+44 -00 replies
4/27svm: remove nop after stgi/clgix86/svm_tests.c+1 -70 replies
5/27svm: make svm_intr_intercept_mix_if/gif test a bit more robustx86/svm_tests.c+2 -00 replies
6/27svm: use apic_start_timer/apic_stop_timer instead of open coding itx86/svm_tests.c+13 -160 replies
7/27x86: Add test for #SMI during interrupt windowx86/Makefile.common x86/Makefile.x86_64 x86/smm_int_window.c +1 more+126 -10 replies
8/27x86: Add a simple test for SYSENTER instruction.x86/Makefile.x86_64 x86/sysenter.c x86/unittests.cfg+210 -00 replies
9/27svm: add simple nested shutdown test.x86/svm_tests.c+17 -02 replies
10/27SVM: add two tests for exitintinto on exceptionx86/svm_tests.c+148 -00 replies
11/27lib: Add random number generatorMakefile README.md lib/prng.c +5 more+119 -25 replies
12/27x86: add IPI stress testx86/Makefile.common x86/ipi_stress.c x86/unittests.cfg+179 -10 replies
13/27svm: remove get_npt_pte externx86/svm.h+0 -11 reply
14/27svm: move svm spec definitions to lib/x86/svm.hlib/x86/svm.h x86/svm.h+366 -3581 reply
15/27svm: move some svm support functions into lib/x86/svm_lib.hlib/x86/svm_lib.h x86/svm.c x86/svm.h +2 more+56 -532 replies
16/27svm: move setup_svm() to svm_lib.clib/x86/svm.h lib/x86/svm_lib.c lib/x86/svm_lib.h +4 more+138 -991 reply
17/27svm: correctly skip if NPT not supportedlib/x86/svm_lib.c lib/x86/svm_lib.h x86/svm.c+13 -80 replies
18/27svm: move vmcb_ident to svm_lib.clib/x86/svm_lib.c lib/x86/svm_lib.h x86/svm.c +1 more+58 -552 replies
19/27svm: rewerite vm entry macroslib/x86/svm_lib.h x86/svm.c x86/svm.h +1 more+106 -1172 replies
20/27svm: move v2 tests run into test_runx86/svm.c+19 -141 reply
21/27svm: cleanup the default_preparex86/svm.c x86/svm_tests.c+0 -192 replies
22/27svm: introduce svm_vcpulib/x86/svm_lib.c lib/x86/svm_lib.h x86/svm.c +3 more+401 -3800 replies
23/27svm: introduce struct svm_test_contextx86/svm.c x86/svm.h x86/svm_npt.c +1 more+343 -3350 replies
24/27svm: use svm_test_context in v2 testsx86/svm.c x86/svm.h x86/svm_npt.c +1 more+152 -1511 reply
25/27svm: move nested vcpu to test contextx86/svm.c x86/svm.h x86/svm_npt.c +1 more+486 -3522 replies
26/27svm: move test_guest_func to test contextx86/svm.c x86/svm.h x86/svm_npt.c +1 more+20 -241 reply
27/27x86: ipi_stress: add optional SVM supportx86/ipi_stress.c+78 -10 replies

Reviews trailers per patch

9 of 27 patches have a Reviewed-by or Acked-by.

PatchEmanuele Giuseppe Esposito
1/27R-b
2/27R-b
3/27
4/27
5/27
6/27
7/27
8/27
9/27
10/27
11/27
12/27
13/27R-b
14/27R-b
15/27
16/27R-b
17/27
18/27R-b
19/27
20/27R-b
21/27
22/27
23/27
24/27R-b
25/27
26/27R-b
27/27

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [kvm-unit-tests PATCH v3 00/27] kvm-unit-tests: set of fixes and new tests

This is set of fixes and new unit tests that I developed for the KVM unit tests.

I also did some work to separate the SVM code into a minimal support library so that you could use it from an arbitrary test.

V2:

- addressed review feedback, and futher cleaned up the svm tests
set to use less global variables
(the patches are large, but each changes one thing all over the tests, so hopefully not hard to review).

Best regards,
Maxim Levitsky

Maxim Levitsky (27):
x86: replace irq_{enable|disable}() with sti()/cli()
x86: introduce sti_nop() and sti_nop_cli()
x86: add few helper functions for apic local timer
svm: remove nop after stgi/clgi
svm: make svm_intr_intercept_mix_if/gif test a bit more robust
svm: use apic_start_timer/apic_stop_timer instead of open coding it
x86: Add test for #SMI during interrupt window
x86: Add a simple test for SYSENTER instruction.
svm: add simple nested shutdown test.
SVM: add two tests for exitintinto on exception
lib: Add random number generator
x86: add IPI stress test
svm: remove get_npt_pte extern
svm: move svm spec definitions to lib/x86/svm.h
svm: move some svm support functions into lib/x86/svm_lib.h
svm: move setup_svm() to svm_lib.c
svm: correctly skip if NPT not supported
svm: move vmcb_ident to svm_lib.c
svm: rewerite vm entry macros
svm: move v2 tests run into test_run
svm: cleanup the default_prepare
svm: introduce svm_vcpu
svm: introduce struct svm_test_context
svm: use svm_test_context in v2 tests
svm: move nested vcpu to test context
svm: move test_guest_func to test context
x86: ipi_stress: add optional SVM support

 Makefile                  |    3 +-
 README.md                 |    1 +
 lib/prng.c                |   41 ++
 lib/prng.h                |   23 +
 lib/x86/apic.c            |   38 ++
 lib/x86/apic.h            |    6 +
 lib/x86/processor.h       |   39 +-
 lib/x86/random.c          |   33 +
 lib/x86/random.h          |   17 +
 lib/x86/smp.c             |    2 +-
 lib/x86/svm.h             |  367 +++++++++++
 lib/x86/svm_lib.c         |  179 ++++++
 lib/x86/svm_lib.h         |  151 +++++
 scripts/arch-run.bash     |    2 +-
 x86/Makefile.common       |    5 +-
 x86/Makefile.x86_64       |    5 +
 x86/apic.c                |    6 +-
 x86/asyncpf.c             |    6 +-
 x86/eventinj.c            |   22 +-
 x86/hyperv_connections.c  |    2 +-
 x86/hyperv_stimer.c       |    4 +-
 x86/hyperv_synic.c        |    6 +-
 x86/intel-iommu.c         |    2 +-
 x86/ioapic.c              |   15 +-
 x86/ipi_stress.c          |  244 +++++++
 x86/pmu.c                 |    4 +-
 x86/smm_int_window.c      |  118 ++++
 x86/svm.c                 |  341 ++--------
 x86/svm.h                 |  495 +-------------
 x86/svm_npt.c             |   81 ++-
 x86/svm_tests.c           | 1278 ++++++++++++++++++++++---------------
 x86/sysenter.c            |  203 ++++++
 x86/taskswitch2.c         |    4 +-
 x86/tscdeadline_latency.c |    4 +-
 x86/unittests.cfg         |   20 +
 x86/vmexit.c              |   18 +-
 x86/vmx_tests.c           |   47 +-
 37 files changed, 2454 insertions(+), 1378 deletions(-)
 create mode 100644 lib/prng.c
 create mode 100644 lib/prng.h
 create mode 100644 lib/x86/random.c
 create mode 100644 lib/x86/random.h
 create mode 100644 lib/x86/svm.h
 create mode 100644 lib/x86/svm_lib.c
 create mode 100644 lib/x86/svm_lib.h
 create mode 100644 x86/ipi_stress.c
 create mode 100644 x86/smm_int_window.c
 create mode 100644 x86/sysenter.c
Signature · 1 line
2.34.3