mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: x86/mmu: Drop dedicated self-changing mapping code
@ 2023-02-02 18:28 Sean Christopherson
  2023-02-02 18:28 ` [PATCH v2 1/3] KVM: x86/mmu: Use EMULTYPE flag to track write #PFs to shadow pages Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sean Christopherson @ 2023-02-02 18:28 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini
  Cc: kvm, linux-kernel, Huang Hang, Lai Jiangshan

Excise the MMU's one-off self-changing mapping logic and instead detect
self-changing mappings in the primary "walk" flow, and rely on
kvm_mmu_hugepage_adjust() to naturally handle "disallowed hugepage due to
shadow page" conditions.

When is_self_change_mapping() was first added, KVM did hugepage adjustments
before the primary walk, and so didn't account for shadow pages that were
allocated for the current page fault, i.e. effectively consumed a stale
disallow_lpage.  Now that KVM adjust after allocating new shadow pages, the
one-off code is superfluous.

Dropping the one-off code fixes an issue where KVM will force 4KiB pages
for a 1GiB guest page even when using a 2MiB would be safe (1GiB overlaps
a shadow page but 2MiB does not).

v2:
 - Track the "write #PF to shadow page" using an EMULTYPE flag.
 - Split the main patch in two.

v1: https://lore.kernel.org/all/20221213125538.81209-1-jiangshanlai@gmail.com

Lai Jiangshan (2):
  KVM: x86/mmu: Detect write #PF to shadow pages during FNAME(fetch)
    walk
  KVM: x86/mmu: Remove FNAME(is_self_change_mapping)

Sean Christopherson (1):
  KVM: x86/mmu: Use EMULTYPE flag to track write #PFs to shadow pages

 arch/x86/include/asm/kvm_host.h | 37 +++++++++++---------
 arch/x86/kvm/mmu/mmu.c          |  5 +--
 arch/x86/kvm/mmu/mmu_internal.h | 12 ++++++-
 arch/x86/kvm/mmu/paging_tmpl.h  | 61 ++++++---------------------------
 arch/x86/kvm/x86.c              | 15 ++------
 5 files changed, 46 insertions(+), 84 deletions(-)


base-commit: 11b36fe7d4500c8ef73677c087f302fd713101c2
-- 
2.39.1.519.gcb327c4b5f-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-14 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 18:28 [PATCH v2 0/3] KVM: x86/mmu: Drop dedicated self-changing mapping code Sean Christopherson
2023-02-02 18:28 ` [PATCH v2 1/3] KVM: x86/mmu: Use EMULTYPE flag to track write #PFs to shadow pages Sean Christopherson
2023-02-02 18:28 ` [PATCH v2 2/3] KVM: x86/mmu: Detect write #PF to shadow pages during FNAME(fetch) walk Sean Christopherson
2023-02-02 18:28 ` [PATCH v2 3/3] KVM: x86/mmu: Remove FNAME(is_self_change_mapping) Sean Christopherson
2023-03-14 13:34 ` [PATCH v2 0/3] KVM: x86/mmu: Drop dedicated self-changing mapping code Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®