]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Account NX huge page disallowed iff huge page was requested
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 23 Sep 2020 18:37:32 +0000 (11:37 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Sep 2020 11:57:41 +0000 (07:57 -0400)
commit384e2eeb79a9d7ce9059cf43c63efca0e1e8706e
tree6404796dbf0917bf8b8265ab3fafdc17387dae85
parente3dfbc09f030fb70cd0fb82be01ae09f591fa18c
KVM: x86/mmu: Account NX huge page disallowed iff huge page was requested

Condition the accounting of a disallowed huge NX page on the original
requested level of the page being greater than the current iterator
level.  This does two things: accounts the page if and only if a huge
page was actually disallowed, and accounts the shadow page if and only
if it was the level at which the huge page was disallowed.  For the
latter case, the previous logic would account all shadow pages used to
create the translation for the forced small page, e.g. even PML4, which
can't be a huge page on current hardware, would be accounted as having
been a disallowed huge page when using 5-level EPT.

The overzealous accounting is purely a performance issue, i.e. the
recovery thread will spuriously zap shadow pages, but otherwise the bad
behavior is harmless.

Cc: Junaid Shahid <junaids@google.com>
Fixes: e1f01549e95e6 ("kvm: mmu: ITLB_MULTIHIT mitigation")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200923183735.584-6-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h