public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Yu Zhang <yu.c.zhang@linux.intel.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] X86: Set up EPT before running vmx_pf_exception_test
Date: Tue, 2 Aug 2022 20:41:47 +0000	[thread overview]
Message-ID: <YumMC1hAVpTWLmap@google.com> (raw)
In-Reply-To: <20220715113334.52491-1-yu.c.zhang@linux.intel.com>

On Fri, Jul 15, 2022, Yu Zhang wrote:
> Although currently vmx_pf_exception_test can succeed, its
> success is actually because we are using identical mappings
> in the page tables and EB.PF is not set by L1. In practice,
> the #PFs shall be expected by L1, if it is using shadowing
> for L2.

I'm a bit lost.  Is there an actual failure somewhere?  AFAICT, this passes when
run as L1 or L2, with or without EPT enabled.

> So just set up the EPT, and clear the EB.PT, then L1 has the
> right to claim a failure if a #PF is encountered.
> 
> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> ---
>  x86/vmx_tests.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 4d581e7..cc90611 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -10639,6 +10639,17 @@ static void __vmx_pf_exception_test(invalidate_tlb_t inv_fn, void *data)
>  
>  static void vmx_pf_exception_test(void)
>  {
> +	u32 eb;
> +
> +	if (setup_ept(false)) {
> +		printf("EPT not supported.\n");
> +		return;
> +	}
> +
> +	eb = vmcs_read(EXC_BITMAP);
> +	eb &= ~(1 << PF_VECTOR);
> +	vmcs_write(EXC_BITMAP, eb);
> +
>  	__vmx_pf_exception_test(NULL, NULL);
>  }
>  
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-08-02 20:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 11:33 [kvm-unit-tests PATCH] X86: Set up EPT before running vmx_pf_exception_test Yu Zhang
2022-08-02 20:41 ` Sean Christopherson [this message]
2022-08-03  1:57   ` Yu Zhang
2022-08-03 14:25     ` Sean Christopherson
2022-08-04  2:14       ` Yu Zhang

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=YumMC1hAVpTWLmap@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yu.c.zhang@linux.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