kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: "Oliver Upton" <oupton@google.com>,
	kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Cc: Jim Mattson <jmattson@google.com>,
	Peter Shier <pshier@google.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>
Subject: Re: [kvm-unit-tests PATCH v4 8/9] x86: VMX: Make guest_state_test_main() check state from nested VM
Date: Tue, 10 Sep 2019 13:51:27 -0700	[thread overview]
Message-ID: <6e9e4f21-da9c-5da1-6507-bc0cfaf94d73@oracle.com> (raw)
In-Reply-To: <20190906210313.128316-9-oupton@google.com>



On 09/06/2019 02:03 PM, Oliver Upton wrote:
> The current tests for guest state do not yet check the validity of
> loaded state from within the nested VM. Introduce the
> load_state_test_data struct to share data with the nested VM.
>
> Signed-off-by: Oliver Upton <oupton@google.com>
> ---
>   x86/vmx_tests.c | 23 ++++++++++++++++++++---
>   1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 6f46c7759c85..84e1a7935aa1 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -5017,13 +5017,28 @@ static void test_entry_msr_load(void)
>   	test_vmx_valid_controls(false);
>   }
>   
> +static struct vmx_state_area_test_data {
> +	u32 msr;
> +	u64 exp;
> +	bool enabled;
> +} vmx_state_area_test_data;
> +
>   static void guest_state_test_main(void)
>   {
> +	u64 obs;
> +	struct vmx_state_area_test_data *data = &vmx_state_area_test_data;
> +
>   	while (1) {
> -		if (vmx_get_test_stage() != 2)
> -			vmcall();
> -		else
> +		if (vmx_get_test_stage() == 2)
>   			break;
> +
> +		if (data->enabled) {
> +			obs = rdmsr(data->msr);
> +			report("Guest state is 0x%lx (expected 0x%lx)",
> +			       data->exp == obs, obs, data->exp);
> +		}
> +
> +		vmcall();
>   	}
>   
>   	asm volatile("fnop");
> @@ -6854,7 +6869,9 @@ static void test_pat(u32 field, const char * field_name, u32 ctrl_field,
>   	u64 i, val;
>   	u32 j;
>   	int error;
> +	struct vmx_state_area_test_data *data = &vmx_state_area_test_data;
>   
> +	data->enabled = false;
>   	vmcs_clear_bits(ctrl_field, ctrl_bit);
>   	if (field == GUEST_PAT) {
>   		vmx_set_test_stage(1);

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>

  reply	other threads:[~2019-09-10 20:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 21:03 [PATCH v4 0/9] KVM: VMX: Add full nested support for IA32_PERF_GLOBAL_CTRL Oliver Upton
2019-09-06 21:03 ` [PATCH v4 1/9] KVM: nVMX: Use kvm_set_msr to load IA32_PERF_GLOBAL_CTRL on vmexit Oliver Upton
2019-09-16 18:03   ` Sean Christopherson
2019-09-16 18:15   ` Sean Christopherson
2019-09-06 21:03 ` [PATCH v4 2/9] KVM: nVMX: Load GUEST_IA32_PERF_GLOBAL_CTRL MSR on vm-entry Oliver Upton
2019-09-16 18:06   ` Sean Christopherson
2019-09-16 21:17     ` Oliver Upton
2019-09-16 22:50       ` Sean Christopherson
2019-09-06 21:03 ` [PATCH v4 3/9] KVM: VMX: Add helper to check reserved bits in IA32_PERF_GLOBAL_CTRL Oliver Upton
2019-09-06 21:03 ` [PATCH v4 4/9] KVM: nVMX: check GUEST_IA32_PERF_GLOBAL_CTRL on VM-Entry Oliver Upton
2019-09-16 18:10   ` Sean Christopherson
2019-09-16 21:19     ` Oliver Upton
2019-09-06 21:03 ` [PATCH v4 5/9] KVM: nVMX: Check HOST_IA32_PERF_GLOBAL_CTRL on VM-entry Oliver Upton
2019-09-16 18:10   ` Sean Christopherson
2019-09-06 21:03 ` [PATCH v4 6/9] KVM: nVMX: Expose load IA32_PERF_GLOBAL_CTRL vm control if supported Oliver Upton
2019-09-16 18:27   ` Sean Christopherson
2019-09-06 21:03 ` [kvm-unit-test PATCH v4 7/9] vmx: Allow vmx_tests to reset the test_guest_func Oliver Upton
2019-09-10 20:49   ` Krish Sadhukhan
2019-09-06 21:03 ` [kvm-unit-tests PATCH v4 8/9] x86: VMX: Make guest_state_test_main() check state from nested VM Oliver Upton
2019-09-10 20:51   ` Krish Sadhukhan [this message]
2019-09-06 21:03 ` [kvm-unit-tests PATCH v4 9/9] x86: VMX: Add tests for nested "load IA32_PERF_GLOBAL_CTRL" Oliver Upton
2019-09-12 16:28   ` Krish Sadhukhan

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=6e9e4f21-da9c-5da1-6507-bc0cfaf94d73@oracle.com \
    --to=krish.sadhukhan@oracle.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.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;
as well as URLs for NNTP newsgroup(s).