mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michael Roth <michael.roth@amd.com>
Subject: [PATCH gmem 4/5] KVM: selftests: Use dedicated pattern for testing that mem is shared by default
Date: Mon, 23 Oct 2023 12:15:31 -0700	[thread overview]
Message-ID: <20231023191532.2405326-5-seanjc@google.com> (raw)
In-Reply-To: <20231023191532.2405326-1-seanjc@google.com>

Somewhat arbitrarily use 0xaa as the data pattern when testing that memory
is shared by default.  Inverting the bits of the init pattern (0xcc)
yields 0x33, which just so happens to be the same as pattern #3, i.e. makes
triaging failures on the default check unnecessarily difficult.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 .../selftests/kvm/x86_64/private_mem_conversions_test.c     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c b/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
index 3f6d8d4dbc53..8a2f924fd031 100644
--- a/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
+++ b/tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
@@ -122,13 +122,15 @@ struct {
 
 static void guest_test_explicit_conversion(uint64_t base_gpa, bool do_fallocate)
 {
+	const uint8_t def_p = 0xaa;
 	const uint8_t init_p = 0xcc;
 	uint64_t j;
 	int i;
 
 	/* Memory should be shared by default. */
-	memset((void *)base_gpa, ~init_p, PER_CPU_DATA_SIZE);
-	guest_sync_shared(base_gpa, PER_CPU_DATA_SIZE, (uint8_t)~init_p, init_p);
+	memset((void *)base_gpa, def_p, PER_CPU_DATA_SIZE);
+	guest_sync_shared(base_gpa, PER_CPU_DATA_SIZE, def_p, init_p);
+
 	memcmp_g(base_gpa, init_p, PER_CPU_DATA_SIZE);
 
 	for (i = 0; i < ARRAY_SIZE(test_ranges); i++) {
-- 
2.42.0.758.gaed0368e0e-goog


  parent reply	other threads:[~2023-10-23 19:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 19:15 [PATCH gmem 0/5] KVM: selftests: Fix multiple memslots in conv test Sean Christopherson
2023-10-23 19:15 ` [PATCH gmem 1/5] KVM: selftests: Rework fallocate() helper to work across multiple memslots Sean Christopherson
2023-10-23 19:15 ` [PATCH gmem 2/5] KVM: selftests: Handle memslot splits in private mem conversions test Sean Christopherson
2023-10-23 19:15 ` [PATCH gmem 3/5] KVM: selftests: Let user specify nr of memslots in private mem conversion Sean Christopherson
2023-10-23 19:15 ` Sean Christopherson [this message]
2023-10-23 19:15 ` [PATCH gmem 5/5] KVM: selftests: Verify default pattern was written " 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=20231023191532.2405326-5-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --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®