public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Maxim Levitsky <mlevitsk@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 05/12] nSVM: Remove NPT reserved bits tests (new one on the way)
Date: Thu, 24 Jun 2021 17:43:37 +0000	[thread overview]
Message-ID: <YNTESd1rtU6RDDP0@google.com> (raw)
In-Reply-To: <2f1c2605-e588-2eea-d2c1-ab2f4fdc531d@redhat.com>

On Thu, Jun 24, 2021, Paolo Bonzini wrote:
> On 22/06/21 23:00, Sean Christopherson wrote:
> > Remove two of nSVM's NPT reserved bits test, a soon-to-be-added test will
> > provide a superset of their functionality, e.g. the current tests are
> > limited in the sense that they test a single entry and a single bit,
> > e.g. don't test conditionally-reserved bits.
> > 
> > The npt_rsvd test in particular is quite nasty as it subtly relies on
> > EFER.NX=1; dropping the test will allow cleaning up the EFER.NX weirdness
> > (it's forced for_all_  tests, presumably to get the desired PFEC.FETCH=1
> > for this one test).
> > 
> > Signed-off-by: Sean Christopherson<seanjc@google.com>
> > ---
> >   x86/svm_tests.c | 45 ---------------------------------------------
> >   1 file changed, 45 deletions(-)
> 
> This exposes a KVM bug, reproducible with
> 
> 	./x86/run x86/svm.flat -smp 2 -cpu max,+svm -m 4g \
> 		-append 'npt_rw npt_rw_pfwalk'

Any chance you're running against an older KVM version?  The test passes if I
run against a build with my MMU pile on top of kvm/queue, but fails on a random
older KVM.

Side topic, these tests all fail to invalidate TLB entries after modifying PTEs.
I suspect they work in part because KVM flushes and syncs on all nested SVM
transitions...

> While running npt_rw_pfwalk, the #NPF gets an incorrect EXITINFO2
> (address for the NPF location; on my machine it gets 0xbfede6f0 instead of
> 0xbfede000).  The same tests work with QEMU from git.
> 
> I didn't quite finish analyzing it, but my current theory is
> that KVM receives a pagewalk NPF for a *different* page walk that is caused
> by read-only page tables; then it finds that the page walk to 0xbfede6f0
> *does fail* (after all the correct and wrong EXITINFO2 belong to the same pfn)
> and therefore injects it anyway.  This theory is because the 0x6f0 offset in
> the page table corresponds to the 0xde000 part of the faulting address.
> Maxim will look into it while I'm away.
> 
> Paolo
> 

  reply	other threads:[~2021-06-24 17:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 21:00 [kvm-unit-tests PATCH 00/12] nSVM: NPT improvements and cleanups Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 01/12] nSVM: Provide expected and actual exit codes on VMRUN test failure Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 02/12] nSVM: Replace open coded NX manipulation with appropriate macros Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 03/12] nSVM: Reset the VMCB before every v1 test Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 04/12] nSVM: Explicitly save/update/restore EFER.NX for NPT NX test Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 05/12] nSVM: Remove NPT reserved bits tests (new one on the way) Sean Christopherson
2021-06-24 11:06   ` Paolo Bonzini
2021-06-24 17:43     ` Sean Christopherson [this message]
2021-06-24 17:47       ` Paolo Bonzini
2021-06-24 18:16         ` Sean Christopherson
2021-08-12  7:58       ` Maxim Levitsky
2021-06-22 21:00 ` [kvm-unit-tests PATCH 06/12] nSVM: Stop forcing EFER.NX=1 for all tests Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 07/12] nSVM: Remove a superfluous modification of guest EFER.NX in NPT NX test Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 08/12] nSVM: Clear guest's " Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 09/12] lib/vmalloc: Let arch code pass a value to its setup_mmu() helper Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 10/12] x86: Let tests omit PT_USER_MASK when configuring virtual memory Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 11/12] x86: Add GBPAGES CPUID macro, clean up CPUID comments Sean Christopherson
2021-06-22 21:00 ` [kvm-unit-tests PATCH 12/12] nSVM: Add test for NPT reserved bit and #NPF error code behavior Sean Christopherson
2021-06-23 11:52 ` [kvm-unit-tests PATCH 00/12] nSVM: NPT improvements and cleanups Paolo Bonzini

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=YNTESd1rtU6RDDP0@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.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