Skip to content

KVM: selftests: Add support for dirty-ring on dirty_log_perf_test

Leonardo Bras kvm linux-kselftest lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyIn review
  2. v13 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- Converted memstress to take a memstress_params struct instead of a lot of parameters, so it could be more easily extended in the future (Sean)
- Moved dirty-ring cap detection to a helper, so it could be used instead of open-coded options (Sean)
- Improved the error messages in case the dirty-ring fails to setup, with a more specific message on what went wrong (Sean)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: selftests: memstress: Add struct memstress_params, make memstress_create_vm() use ittools/testing/selftests/kvm/access_tracking_perf_test.c tools/testing/selftests/kvm/demand_paging_test.c tools/testing/selftests/kvm/dirty_log_perf_test.c +4 more+84 -380 replies
2/5KVM: selftests: memstress: Add option to enable dirty-ring on VM creationtools/testing/selftests/kvm/include/memstress.h tools/testing/selftests/kvm/lib/memstress.c+23 -50 replies
3/5KVM: selftests: Introduce kvm_get_dirty_ring_cap()tools/testing/selftests/kvm/dirty_log_test.c tools/testing/selftests/kvm/include/kvm_util.h+12 -20 replies
4/5KVM: selftests: Check dirty-ring size before enablingtools/testing/selftests/kvm/lib/kvm_util.c+16 -40 replies
5/5KVM: selftests: dirty_log_perf_test: Add dirty-ring supporttools/testing/selftests/kvm/dirty_log_perf_test.c+114 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] KVM: selftests: Add support for dirty-ring on dirty_log_perf_test

Add support to dirty-ring on dirty_log_perf_test, so we can measure performance differences when we change / improve the mechanism.

One big change in this set is that dirty-ring needs to be enabled after the VM was created, but before any cpu is created, so for that, I made a few changes on memstress so it can actually take dirty-ring size as a parameter for VM creation. (Patches #1 & #2)

Also added some checks in dirty-ring enable, so an error message on ring size is more informative.

Please provide feedback :)

Thanks!
Leo

Changes since v1:
- Converted memstress to take a memstress_params struct instead of a lot of parameters, so it could be more easily extended in the future (Sean)
- Moved dirty-ring cap detection to a helper, so it could be used instead of open-coded options (Sean)
- Improved the error messages in case the dirty-ring fails to setup, with a more specific message on what went wrong (Sean)

Changes since RFCv4:
- Series title
- Rebase on v7.3-rc5

- Using acquire/release barriers to make sure there is no reorder between incrementing iteration and summing the time spent on cleaning.
- Improved ring-size checks, although not perfect due to reserved entries affecting minimum size.
- Do not allocate bitmaps for dirty-ring tests, as they are unused.
- Improve help text
- Make sure ret==0 before going back to vcpu_run in dirty-ring case

Changes since RFCv2:
- Added mutex to make sure only a single vcpu is collecting/cleaning at a time. This gets us the ability to test return values, and not account for kvm.slot_lock waiting time.
- Stuff reported by Sashiko
- Return value always positive, so assert was pointless
- Concurrency inflating the time for dirty-ring cleaning

Changes since RFCv1:
- Stuff reported by Sashiko
- Fixed elements / byte size wrapping issue
- Removed element count due to concurrency
- Testing exit_reason instead of ioctl return value
- Some nits

Leonardo Bras (5):
KVM: selftests: memstress: Add struct memstress_params, make
memstress_create_vm() use it
KVM: selftests: memstress: Add option to enable dirty-ring on VM
creation
KVM: selftests: Introduce kvm_get_dirty_ring_cap()
KVM: selftests: Check dirty-ring size before enabling
KVM: selftests: dirty_log_perf_test: Add dirty-ring support

 .../testing/selftests/kvm/include/kvm_util.h  |  11 ++
 .../testing/selftests/kvm/include/memstress.h |  15 +-
 .../selftests/kvm/access_tracking_perf_test.c |  12 +-
 .../selftests/kvm/demand_paging_test.c        |  12 +-
 .../selftests/kvm/dirty_log_perf_test.c       | 140 ++++++++++++++++--
 tools/testing/selftests/kvm/dirty_log_test.c  |   3 +-
 tools/testing/selftests/kvm/lib/kvm_util.c    |  20 ++-
 tools/testing/selftests/kvm/lib/memstress.c   |  68 +++++----
 .../kvm/memslot_modification_stress_test.c    |  14 +-
 .../kvm/x86/dirty_log_page_splitting_test.c   |  12 +-
 10 files changed, 247 insertions(+), 60 deletions(-)

base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a

Signature · 1 line
2.55.0