Skip to content

Add printf and formatted asserts in the guest

Aaron Lewis kvm 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 7 repliesIn review
  2. v26 patches 6 repliesSuperseded
  3. v18 patches 14 repliesSuperseded

Changes in v3 from the cover letter

- s/kvm_vsnprintf/guest_vsnprintf/ [Sean]
- GUEST_ASSERT on error in guest_vsnprintf() [Sean]
- Added "Fixes" tag to patch #3 [Sean]
- Removed memset to zero ucall.buffer to save cycles [Sean]
- Added REPORT_GUEST_PRINTF() for the host [Sean]
- Removed ucall_fmt2() and squashed it into __GUEST_ASSERT_FMT [Sean]
- Fixed stack overflow in guest_print_test Sean called out
- Refactored test_limits() in guest_print_test to account for updates

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: selftests: Add strnlen() to the string overridestools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/lib/string_override.c+10 -00 replies
2/5KVM: selftests: Add guest_snprintf() to KVM selfteststools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/include/test_util.h tools/testing/selftests/kvm/lib/guest_sprintf.c+311 -00 replies
3/5KVM: selftests: Add additional pages to the guest to accommodate ucalltools/testing/selftests/kvm/include/ucall_common.h tools/testing/selftests/kvm/lib/kvm_util.c tools/testing/selftests/kvm/lib/ucall_common.c+10 -00 replies
4/5KVM: selftests: Add string formatting options to ucalltools/testing/selftests/kvm/include/ucall_common.h tools/testing/selftests/kvm/lib/ucall_common.c+40 -00 replies
5/5KVM: selftests: Add a selftest for guest prints and formatted assertstools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/guest_print_test.c+223 -00 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/5] Add printf and formatted asserts in the guest

Extend the ucall framework to offer GUEST_PRINTF() and GUEST_ASSERT_FMT() in selftests. This will allow for better and easier guest debugging.

v2 -> v3
- s/kvm_vsnprintf/guest_vsnprintf/ [Sean]
- GUEST_ASSERT on error in guest_vsnprintf() [Sean]
- Added "Fixes" tag to patch #3 [Sean]
- Removed memset to zero ucall.buffer to save cycles [Sean]
- Added REPORT_GUEST_PRINTF() for the host [Sean]
- Removed ucall_fmt2() and squashed it into __GUEST_ASSERT_FMT [Sean]
- Fixed stack overflow in guest_print_test Sean called out
- Refactored test_limits() in guest_print_test to account for updates

v1 -> v2:
- Added a proper selftest [Sean]
- Added support for snprintf [Shaoqin]
- Added ucall_nr_pages_required() [Sean]
- Added ucall_fmt2() for GUEST_ASSERT_FMT()
- Dropped the original version of printf.c [Sean]
- Dropped patches 1-2 and 8 [Sean]

Aaron Lewis (5):
KVM: selftests: Add strnlen() to the string overrides
KVM: selftests: Add guest_snprintf() to KVM selftests
KVM: selftests: Add additional pages to the guest to accommodate ucall
KVM: selftests: Add string formatting options to ucall
KVM: selftests: Add a selftest for guest prints and formatted asserts

 tools/testing/selftests/kvm/Makefile          |   3 +
 .../testing/selftests/kvm/guest_print_test.c  | 222 +++++++++++++
 .../testing/selftests/kvm/include/test_util.h |   3 +
 .../selftests/kvm/include/ucall_common.h      |  24 ++
 .../testing/selftests/kvm/lib/guest_sprintf.c | 307 ++++++++++++++++++
 tools/testing/selftests/kvm/lib/kvm_util.c    |   4 +
 .../selftests/kvm/lib/string_override.c       |   9 +
 .../testing/selftests/kvm/lib/ucall_common.c  |  22 ++
 8 files changed, 594 insertions(+)
 create mode 100644 tools/testing/selftests/kvm/guest_print_test.c
 create mode 100644 tools/testing/selftests/kvm/lib/guest_sprintf.c
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog