Skip to content

selftests: kvm: s390: Add s390x ucontrol selftests

Christoph Schlameuss kvm linux-kselftest linux-s390 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest10 patches 3 repliesIn review
  2. v410 patches 5 repliesSuperseded
  3. v310 patches 9 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches9 repliesSuperseded
v19 patches11 repliesSuperseded

Changes in v5 from the cover letter

- PATCH 7: Simplify segment and page table generation
- PATCH 8: Remove irrelevant code in skey test Add some comments to skey test

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10selftests: kvm: s390: Define page sizes in shared headertools/testing/selftests/kvm/include/s390x/processor.h tools/testing/selftests/kvm/lib/s390x/processor.c tools/testing/selftests/kvm/s390x/cmma_test.c +2 more+17 -140 replies
2/10selftests: kvm: s390: Add kvm_s390_sie_block definition for userspace teststools/testing/selftests/kvm/include/s390x/sie.h tools/testing/selftests/kvm/s390x/debug_test.c+242 -20 replies
3/10selftests: kvm: s390: Add s390x ucontrol test suite with hpage testtools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/s390x/config +1 more+80 -00 replies
4/10selftests: kvm: s390: Add test fixture and simple VM setup teststools/testing/selftests/kvm/s390x/ucontrol_test.c+131 -00 replies
5/10selftests: kvm: s390: Add debug print functionstools/testing/selftests/kvm/include/s390x/debug_print.h+69 -00 replies
6/10selftests: kvm: s390: Add VM run test casetools/testing/selftests/kvm/s390x/ucontrol_test.c+126 -00 replies
7/10selftests: kvm: s390: Add uc_map_unmap VM test casetools/testing/selftests/kvm/s390x/ucontrol_test.c+166 -12 replies
8/10selftests: kvm: s390: Add uc_skey VM test casetools/testing/selftests/kvm/s390x/ucontrol_test.c+78 -00 replies
9/10selftests: kvm: s390: Verify reject memory region operations for ucontrol VMstools/testing/selftests/kvm/s390x/ucontrol_test.c+22 -00 replies
10/10s390: Enable KVM_S390_UCONTROL config in debug_defconfigarch/s390/configs/debug_defconfig+1 -00 replies

Reviews trailers per patch

8 of 10 patches have a Reviewed-by or Acked-by.

PatchJanosch FrankClaudio Imbrenda
1/10R-b R-b
2/10R-b
3/10R-b
4/10R-b
5/10A-b
6/10R-b
7/10
8/10
9/10R-b
10/10R-b

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

Read the v5 thread

Cover letter [PATCH v5 00/10] selftests: kvm: s390: Add s390x ucontrol selftests

This patch series adds a selftest suite to validate the s390x architecture specific ucontrol KVM interface.

When creating a VM on s390x it is possible to create it as userspace controlled VM or in short ucontrol VM.
These VMs delegates the management of the VM to userspace instead of handling most events within the kernel. Consequently the userspace has to manage interrupts, memory allocation etc.

Before this patch set this functionality lacks any public test cases. It is desirable to add test cases for this interface to be able to reduce the risk of breaking changes in the future.

In order to provision a ucontrol VM the kernel needs to be compiled with the CONFIG_KVM_S390_UCONTROL enabled. The users with sys_admin capability can then create a new ucontrol VM providing the KVM_VM_S390_UCONTROL parameter to the KVM_CREATE_VM ioctl.

The kernels existing selftest helper functions can only be partially be reused for these tests.

The test cases cover existing special handling of ucontrol VMs within the implementation and basic VM creation and handling cases:
* Reject setting HPAGE when VM is ucontrol
* Assert KVM_GET_DIRTY_LOG is rejected
* Assert KVM_S390_VM_MEM_LIMIT_SIZE is rejected
* Assert state of initial SIE flags setup by the kernel
* Run simple program in VM with and without DAT
* Assert KVM_EXIT_S390_UCONTROL exit on not mapped memory access
* Assert functionality of storage keys in ucontrol VM
* Assert that memory region operations are rejected for ucontrol VMs

Running the test cases requires sys_admin capabilities to start the ucontrol VM.
This can be achieved by running as root or with a command like:

    sudo setpriv --reuid nobody --inh-caps -all,+sys_admin \
      --ambient-caps -all,+sys_admin --bounding-set -all,+sys_admin \
      ./ucontrol_test

The patch set does also contain some code cleanup / consolidation of architecture specific defines that are now used in multiple test cases.

---

v5:
- PATCH 7: Simplify segment and page table generation
- PATCH 8: Remove irrelevant code in skey test Add some comments to skey test

v4:
- PATCH 5: Remove not yet used include for debug print functions
- PATCH 6: Add include for debug print functions (removed from patch 5) Remove no longer needed code since stopped but is reset before starting since v3 (thanks Janosch)
Adjust test output to use leading zeros instead of spaces in sieic
- PATCH 7: Rename constant to PGM_SEGMENT_TRANSLATION (thanks Janosch) Put comments on their own lines

v3:
- Remove stopped bit before starting the VM (no initial stop in multiple test cases) (thanks Janosch)
- PATCH 2: Clarified SIE control block vs SIE instruction (thanks Janosch)
- PATCH 3: Make use of CAP_TO_MASK(CAP_SYS_ADMIN) instead of custom define (thanks Janosch)
Removed Reviewed-By: Claudio
- PATCH 4: Remove erroneous 1MB offset from self->base_hva (thanks Janosch)
- PATCH 6-8: Change name of test program _pgm to _asm to prevent confusion
- PATCH 10: Move KVM_S390_UCONTROL default option to actual debug config (thanks Christian)

v2:
- add ucontrol to s390 debug config (new patch)
- PATCH 2: changed atomic_t to __u32 (thanks Claudio)
- PATCH 4: reformatted comment in FIXTURE_SETUP(uc_kvm)
- PATCH 5: refactored to display 8 byte blocks + more internal reuse (thanks Claudio)
- PATCH 7: make use of more declarative defines instead of magic values
- PATCH 8: make use of more declarative defines instead of magic values (thanks Claudio)
- PATCH 9: add reference to fix verified by the test case

Christoph Schlameuss (10):
selftests: kvm: s390: Define page sizes in shared header
selftests: kvm: s390: Add kvm_s390_sie_block definition for userspace
tests
selftests: kvm: s390: Add s390x ucontrol test suite with hpage test
selftests: kvm: s390: Add test fixture and simple VM setup tests
selftests: kvm: s390: Add debug print functions
selftests: kvm: s390: Add VM run test case
selftests: kvm: s390: Add uc_map_unmap VM test case
selftests: kvm: s390: Add uc_skey VM test case
selftests: kvm: s390: Verify reject memory region operations for
ucontrol VMs
s390: Enable KVM_S390_UCONTROL config in debug_defconfig

 arch/s390/configs/debug_defconfig             |   1 +
 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/include/s390x/debug_print.h |  69 ++
 .../selftests/kvm/include/s390x/processor.h   |   5 +
 .../testing/selftests/kvm/include/s390x/sie.h | 240 +++++++
 .../selftests/kvm/lib/s390x/processor.c       |  10 +-
 tools/testing/selftests/kvm/s390x/cmma_test.c |   7 +-
 tools/testing/selftests/kvm/s390x/config      |   2 +
 .../testing/selftests/kvm/s390x/debug_test.c  |   4 +-
 tools/testing/selftests/kvm/s390x/memop.c     |   4 +-
 tools/testing/selftests/kvm/s390x/tprot.c     |   5 +-
 .../selftests/kvm/s390x/ucontrol_test.c       | 598 ++++++++++++++++++
 13 files changed, 931 insertions(+), 16 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/include/s390x/debug_print.h
 create mode 100644 tools/testing/selftests/kvm/include/s390x/sie.h
 create mode 100644 tools/testing/selftests/kvm/s390x/config
 create mode 100644 tools/testing/selftests/kvm/s390x/ucontrol_test.c

base-commit: de9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed

Signature · 1 line
2.45.2