mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] KVM: selftests: Introduce vcpu_arch_put_guest()
Date: Thu, 14 Mar 2024 11:54:53 -0700	[thread overview]
Message-ID: <20240314185459.2439072-1-seanjc@google.com> (raw)

The end goal of this series is to add a regression test for commit
910c57dfa4d1 ("KVM: x86: Mark target gfn of emulated atomic instruction
as dirty"), *without* polluting the common dirty_log_test.c code with
gory x86 details.

The regression test requires forcing KVM to emulate a guest atomic RMW
access, which is done via a magic instruction prefix/opcode that is
guarded by an off-by-default KVM module param.

To allow x86 to (a) detect the param, (b) shove in the unique instruction,
and (c) do all of that conditionally so that selftests doesn't test _only_
the forced emulation path, this series provides a pseudo-RNG instance for
all tests, and a new arch hook for doing "interesting" guest writes
(vcpu_arch_put_guest()).

Tested on x86 and ARM, compile tested on s390 and RISC-V.

Sean Christopherson (5):
  KVM: selftests: Provide a global pseudo-RNG instance for all tests
  KVM: selftests: Provide an API for getting a random bool from an RNG
  KVM: selftests: Add global snapshot of
    kvm_is_forced_emulation_enabled()
  KVM: selftests: Add vcpu_arch_put_guest() to do writes from guest code
  KVM: selftests: Randomly force emulation on x86 writes from guest code

 .../selftests/kvm/dirty_log_perf_test.c       |  9 ++++----
 tools/testing/selftests/kvm/dirty_log_test.c  | 22 ++++--------------
 .../selftests/kvm/include/kvm_util_base.h     |  3 +++
 .../testing/selftests/kvm/include/memstress.h |  1 -
 .../testing/selftests/kvm/include/test_util.h | 19 +++++++++++++++
 .../kvm/include/x86_64/kvm_util_arch.h        | 23 +++++++++++++++++++
 tools/testing/selftests/kvm/lib/kvm_util.c    |  9 ++++++++
 tools/testing/selftests/kvm/lib/memstress.c   | 10 ++------
 .../selftests/kvm/lib/x86_64/processor.c      |  3 +++
 .../selftests/kvm/x86_64/pmu_counters_test.c  |  3 ---
 .../kvm/x86_64/userspace_msr_exit_test.c      | 10 ++------
 .../selftests/kvm/x86_64/xen_shinfo_test.c    |  5 ++--
 12 files changed, 72 insertions(+), 45 deletions(-)


base-commit: e9a2bba476c8332ed547fce485c158d03b0b9659
-- 
2.44.0.291.gc1ea87d7ee-goog


             reply	other threads:[~2024-03-14 18:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 18:54 Sean Christopherson [this message]
2024-03-14 18:54 ` [PATCH 1/5] KVM: selftests: Provide a global pseudo-RNG instance for all tests Sean Christopherson
2024-03-14 18:54 ` [PATCH 2/5] KVM: selftests: Provide an API for getting a random bool from an RNG Sean Christopherson
2024-03-14 18:54 ` [PATCH 3/5] KVM: selftests: Add global snapshot of kvm_is_forced_emulation_enabled() Sean Christopherson
2024-03-14 18:54 ` [PATCH 4/5] KVM: selftests: Add vcpu_arch_put_guest() to do writes from guest code Sean Christopherson
2024-03-14 18:54 ` [PATCH 5/5] KVM: selftests: Randomly force emulation on x86 " Sean Christopherson
2024-04-29 20:45 ` [PATCH 0/5] KVM: selftests: Introduce vcpu_arch_put_guest() 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=20240314185459.2439072-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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

all inboxes | Powered by JetHome®