From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Huang Hang <hhuang@linux.alibaba.com>,
Lai Jiangshan <jiangshan.ljs@antgroup.com>
Subject: [PATCH v2 0/3] KVM: x86/mmu: Drop dedicated self-changing mapping code
Date: Thu, 2 Feb 2023 18:28:14 +0000 [thread overview]
Message-ID: <20230202182817.407394-1-seanjc@google.com> (raw)
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
next reply other threads:[~2023-02-02 18:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 18:28 Sean Christopherson [this message]
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
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=20230202182817.407394-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=hhuang@linux.alibaba.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®