All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [kvm-unit-tests PATCH 1/2] x86/vmx: fix unexpected stage error in PML test
Date: Mon,  3 Jul 2017 19:58:52 +0200	[thread overview]
Message-ID: <20170703175853.1939-2-rkrcmar@redhat.com> (raw)
In-Reply-To: <20170703175853.1939-1-rkrcmar@redhat.com>

Recent patches triggered an unexpected stage error.  This happened
because report() now adds one extra entry to the PML.

The writes done during a page walk are logged into PML, which means that
we are guaranteed to get multiple entries.  The PML test adds 4 entries
in each loop while waiting for the PML full event and unluckily, the one
extra entry fills PML just before the vmcall (3 entries are added before
checking the stage and one after).  The vmcall then sees a wrong stage
and exits.

This solution makes sure that the PML exit will not happen between the
check for stage and the vmcall.  (It wastes the first vmcall, but the
loop happens ~125 times anyway, so it's not a huge waste.)

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 x86/vmx_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 567f7143b427..25e91aa81477 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1354,10 +1354,10 @@ static void pml_main()
 	report("PML - Dirty GPA Logging", vmx_get_test_stage() == 1);
 
 	while (vmx_get_test_stage() == 1) {
+		vmcall();
 		*((u32 *)data_page2) = 0x1;
 		if (count++ > PML_INDEX)
 			break;
-		vmcall();
 	}
 	report("PML Full Event", vmx_get_test_stage() == 2);
 }
-- 
2.13.2

  reply	other threads:[~2017-07-03 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 17:58 [kvm-unit-tests PATCH 0/2] x86/vmx: fix PML test Radim Krčmář
2017-07-03 17:58 ` Radim Krčmář [this message]
2017-07-03 17:58 ` [kvm-unit-tests PATCH 2/2] x86/vmx: report failure if tests don't progress as expected Radim Krčmář

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=20170703175853.1939-2-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.