From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org,
"Sean Christopherson" <seanjc@google.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Aaron Lewis" <aaronlewis@google.com>
Subject: [PATCH v4 00/34] KVM: selftests: Guest printf and asserts overhaul
Date: Fri, 28 Jul 2023 17:36:09 -0700 [thread overview]
Message-ID: <20230729003643.1053367-1-seanjc@google.com> (raw)
This is effectively v4 of Aaron's series to add printf capabilities to
the guest[*]. I also pulled in Thomas' patch to rename ASSERT_EQ() to
TEST_ASSERT_EQ(), mainly so that we can decide on a common output format
for both host and guest asserts in a single series, but also so that all
these basically treewide patches are contained in a single series.
Note, Aaron did all of the heavy lifting, I just mopped up. The core code
is pretty much unchanged from Aaron's v3, v4 massages the assert code a
bit and converts all the tests.
I initially did the conversion in one big patch (the flag is ugly), but
after hitting a nasty bug (see "Add a shameful hack to preserve/clobber
GPRs across ucall") that occurred purely due to the compiler using
registers differently, I decided splitting it up was probably for the best
(even though I still think it probably wasn't worth the effort).
Other maintainers, I want to get this into 6.6, hell or high water. The
ability to use proper asserts in the guest is super nice, and given how
much selftests code is written via CTRL-C + CTRL-V, the sooner we switch
over the better.
My thought is to apply this whole thing to kvm-x86/selftests early next
week, and then create a tag to make that part of branch immutable. That
would allow other architectures to pull the code into their trees, e.g.
if an arch is gaining a big selftest or something.
Apologies for not giving advance warning, I was originally thinking we
could leisurely convert to the printf-based asserts, but then realized
that we would probably never get rid of the old crud if we tried that
approach.
Any objections, or better ideas?
Thanks!
Oh, and tested on Intel, AMD, and whatever flavor of ARM we have. Compile
tested on s390 and RISC-V.
[*] https://lore.kernel.org/all/20230607224520.4164598-1-aaronlewis@google.com
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
Sean Christopherson (28):
KVM: selftests: Make TEST_ASSERT_EQ() output look like normal
TEST_ASSERT()
KVM: selftests: Add a shameful hack to preserve/clobber GPRs across
ucall
KVM: selftests: Add formatted guest assert support in ucall framework
KVM: selftests: Convert aarch_timer to printf style GUEST_ASSERT
KVM: selftests: Convert debug-exceptions to printf style GUEST_ASSERT
KVM: selftests: Convert ARM's hypercalls test to printf style
GUEST_ASSERT
KVM: selftests: Convert ARM's page fault test to printf style
GUEST_ASSERT
KVM: selftests: Convert ARM's vGIC IRQ test to printf style
GUEST_ASSERT
KVM: selftests: Convert the memslot performance test to printf guest
asserts
KVM: selftests: Convert s390's memop test to printf style GUEST_ASSERT
KVM: selftests: Convert s390's tprot test to printf style GUEST_ASSERT
KVM: selftests: Convert set_memory_region_test to printf-based
GUEST_ASSERT
KVM: selftests: Convert steal_time test to printf style GUEST_ASSERT
KVM: selftests: Convert x86's CPUID test to printf style GUEST_ASSERT
KVM: selftests: Convert the Hyper-V extended hypercalls test to printf
asserts
KVM: selftests: Convert the Hyper-V feature test to printf style
GUEST_ASSERT
KVM: selftests: Convert x86's KVM paravirt test to printf style
GUEST_ASSERT
KVM: selftests: Convert the MONITOR/MWAIT test to use printf guest
asserts
KVM: selftests: Convert x86's nested exceptions test to printf guest
asserts
KVM: selftests: Convert x86's set BSP ID test to printf style guest
asserts
KVM: selftests: Convert the nSVM software interrupt test to printf
guest asserts
KVM: selftests: Convert x86's TSC MSRs test to use printf guest
asserts
KVM: selftests: Convert the x86 userspace I/O test to printf guest
assert
KVM: selftests: Convert VMX's PMU capabilities test to printf guest
asserts
KVM: selftests: Convert x86's XCR0 test to use printf-based guest
asserts
KVM: selftests: Rip out old, param-based guest assert macros
KVM: selftests: Print out guest RIP on unhandled exception
KVM: selftests: Use GUEST_FAIL() in ARM's arch timer helpers
Thomas Huth (1):
KVM: selftests: Rename the ASSERT_EQ macro
tools/testing/selftests/kvm/Makefile | 3 +
.../selftests/kvm/aarch64/aarch32_id_regs.c | 8 +-
.../selftests/kvm/aarch64/arch_timer.c | 22 +-
.../selftests/kvm/aarch64/debug-exceptions.c | 8 +-
.../selftests/kvm/aarch64/hypercalls.c | 20 +-
.../selftests/kvm/aarch64/page_fault_test.c | 17 +-
.../testing/selftests/kvm/aarch64/vgic_irq.c | 3 +-
.../testing/selftests/kvm/guest_print_test.c | 221 +++++++++++++
.../kvm/include/aarch64/arch_timer.h | 12 +-
.../testing/selftests/kvm/include/test_util.h | 18 +-
.../selftests/kvm/include/ucall_common.h | 97 +++---
.../testing/selftests/kvm/lib/guest_sprintf.c | 307 ++++++++++++++++++
tools/testing/selftests/kvm/lib/kvm_util.c | 6 +-
.../selftests/kvm/lib/string_override.c | 9 +
.../testing/selftests/kvm/lib/ucall_common.c | 44 +++
.../selftests/kvm/lib/x86_64/processor.c | 18 +-
.../testing/selftests/kvm/lib/x86_64/ucall.c | 32 +-
.../selftests/kvm/max_guest_memory_test.c | 2 +-
.../testing/selftests/kvm/memslot_perf_test.c | 4 +-
tools/testing/selftests/kvm/s390x/cmma_test.c | 62 ++--
tools/testing/selftests/kvm/s390x/memop.c | 13 +-
tools/testing/selftests/kvm/s390x/tprot.c | 11 +-
.../selftests/kvm/set_memory_region_test.c | 21 +-
tools/testing/selftests/kvm/steal_time.c | 20 +-
.../testing/selftests/kvm/x86_64/cpuid_test.c | 12 +-
.../x86_64/dirty_log_page_splitting_test.c | 18 +-
.../x86_64/exit_on_emulation_failure_test.c | 2 +-
.../kvm/x86_64/hyperv_extended_hypercalls.c | 3 +-
.../selftests/kvm/x86_64/hyperv_features.c | 29 +-
.../selftests/kvm/x86_64/kvm_pv_test.c | 8 +-
.../selftests/kvm/x86_64/monitor_mwait_test.c | 35 +-
.../kvm/x86_64/nested_exceptions_test.c | 16 +-
.../kvm/x86_64/recalc_apic_map_test.c | 6 +-
.../selftests/kvm/x86_64/set_boot_cpu_id.c | 6 +-
.../kvm/x86_64/svm_nested_soft_inject_test.c | 22 +-
.../selftests/kvm/x86_64/tsc_msrs_test.c | 34 +-
.../selftests/kvm/x86_64/userspace_io_test.c | 10 +-
.../vmx_exception_with_invalid_guest_state.c | 2 +-
.../selftests/kvm/x86_64/vmx_pmu_caps_test.c | 31 +-
.../selftests/kvm/x86_64/xapic_state_test.c | 8 +-
.../selftests/kvm/x86_64/xcr0_cpuid_test.c | 29 +-
.../selftests/kvm/x86_64/xen_vmcall_test.c | 20 +-
42 files changed, 938 insertions(+), 331 deletions(-)
create mode 100644 tools/testing/selftests/kvm/guest_print_test.c
create mode 100644 tools/testing/selftests/kvm/lib/guest_sprintf.c
base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c
--
2.41.0.487.g6d72f3e995-goog
next reply other threads:[~2023-07-29 0:36 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-29 0:36 Sean Christopherson [this message]
2023-07-29 0:36 ` [PATCH v4 01/34] KVM: selftests: Rename the ASSERT_EQ macro Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 02/34] KVM: selftests: Make TEST_ASSERT_EQ() output look like normal TEST_ASSERT() Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 03/34] KVM: selftests: Add a shameful hack to preserve/clobber GPRs across ucall Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 04/34] KVM: selftests: Add strnlen() to the string overrides Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 05/34] KVM: selftests: Add guest_snprintf() to KVM selftests Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 06/34] KVM: selftests: Add additional pages to the guest to accommodate ucall Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 07/34] KVM: selftests: Add string formatting options to ucall Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 08/34] KVM: selftests: Add formatted guest assert support in ucall framework Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 09/34] KVM: selftests: Add a selftest for guest prints and formatted asserts Sean Christopherson
2023-07-31 16:32 ` Andrew Jones
2023-07-31 17:04 ` Sean Christopherson
2023-07-31 17:19 ` Sean Christopherson
2023-07-31 18:22 ` Andrew Jones
2023-07-29 0:36 ` [PATCH v4 10/34] KVM: selftests: Convert aarch_timer to printf style GUEST_ASSERT Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 11/34] KVM: selftests: Convert debug-exceptions " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 12/34] KVM: selftests: Convert ARM's hypercalls test " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 13/34] KVM: selftests: Convert ARM's page fault " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 14/34] KVM: selftests: Convert ARM's vGIC IRQ " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 15/34] KVM: selftests: Convert the memslot performance test to printf guest asserts Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 16/34] KVM: selftests: Convert s390's memop test to printf style GUEST_ASSERT Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 17/34] KVM: selftests: Convert s390's tprot " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 18/34] KVM: selftests: Convert set_memory_region_test to printf-based GUEST_ASSERT Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 19/34] KVM: selftests: Convert steal_time test to printf style GUEST_ASSERT Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 20/34] KVM: selftests: Convert x86's CPUID " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 21/34] KVM: selftests: Convert the Hyper-V extended hypercalls test to printf asserts Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 22/34] KVM: selftests: Convert the Hyper-V feature test to printf style GUEST_ASSERT Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 23/34] KVM: selftests: Convert x86's KVM paravirt " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 24/34] KVM: selftests: Convert the MONITOR/MWAIT test to use printf guest asserts Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 25/34] KVM: selftests: Convert x86's nested exceptions test to " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 26/34] KVM: selftests: Convert x86's set BSP ID test to printf style " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 27/34] KVM: selftests: Convert the nSVM software interrupt test to printf " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 28/34] KVM: selftests: Convert x86's TSC MSRs test to use " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 29/34] KVM: selftests: Convert the x86 userspace I/O test to printf guest assert Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 30/34] KVM: selftests: Convert VMX's PMU capabilities test to printf guest asserts Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 31/34] KVM: selftests: Convert x86's XCR0 test to use printf-based " Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 32/34] KVM: selftests: Rip out old, param-based guest assert macros Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 33/34] KVM: selftests: Print out guest RIP on unhandled exception Sean Christopherson
2023-07-29 0:36 ` [PATCH v4 34/34] KVM: selftests: Use GUEST_FAIL() in ARM's arch timer helpers Sean Christopherson
2023-08-02 22:01 ` [PATCH v4 00/34] KVM: selftests: Guest printf and asserts overhaul Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230729003643.1053367-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=aaronlewis@google.com \
--cc=borntraeger@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox