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,
Yan Zhao <yan.y.zhao@intel.com>,
Friedrich Weber <f.weber@proxmox.com>,
Kai Huang <kai.huang@intel.com>,
Yuan Yao <yuan.yao@linux.intel.com>,
Xu Yilun <yilun.xu@linux.intel.com>,
Yu Zhang <yu.c.zhang@linux.intel.com>,
Chao Peng <chao.p.peng@linux.intel.com>,
Fuad Tabba <tabba@google.com>,
Michael Roth <michael.roth@amd.com>,
Isaku Yamahata <isaku.yamahata@intel.com>,
David Matlack <dmatlack@google.com>
Subject: [PATCH v4 0/4] KVM: x86/mmu: Pre-check for mmu_notifier retry
Date: Fri, 9 Feb 2024 14:28:54 -0800 [thread overview]
Message-ID: <20240209222858.396696-1-seanjc@google.com> (raw)
Retry page faults without acquiring mmu_lock, and potentially even without
resolving a pfn, if the gfn is covered by an active invalidation. This
avoids resource and lock contention, which can be especially beneficial
for preemptible kernels as KVM can get stuck bouncing mmu_lock between a
vCPU and the invalidation task the vCPU is waiting on to finish.
v4:
- Pre-check for retry before resolving the pfn, too. [Yan]
- Add a patch to fix a private/shared vs. memslot validity check
priority inversion bug.
- Refactor kvm_faultin_pfn() to clean up the handling of noslot faults.
v3:
- https://lkml.kernel.org/r/20240203003518.387220-1-seanjc%40google.com
- Release the pfn, i.e. put the struct page reference if one was held,
as the caller doesn't expect to get a reference on "failure". [Yuan]
- Fix a typo in the comment.
v2:
- Introduce a dedicated helper and collapse to a single patch (because
adding an unused helper would be quite silly).
- Add a comment to explain the "unsafe" check in kvm_faultin_pfn(). [Kai]
- Add Kai's Ack.
v1: https://lore.kernel.org/all/20230825020733.2849862-1-seanjc@google.com
Sean Christopherson (4):
KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is
changing
KVM: x86/mmu: Move private vs. shared check above slot validity checks
KVM: x86/mmu: Move slot checks from __kvm_faultin_pfn() to
kvm_faultin_pfn()
KVM: x86/mmu: Handle no-slot faults at the beginning of
kvm_faultin_pfn()
arch/x86/kvm/mmu/mmu.c | 134 ++++++++++++++++++++++----------
arch/x86/kvm/mmu/mmu_internal.h | 5 +-
include/linux/kvm_host.h | 26 +++++++
3 files changed, 122 insertions(+), 43 deletions(-)
base-commit: 60eedcfceda9db46f1b333e5e1aa9359793f04fb
--
2.43.0.687.g38aa6559b0-goog
next reply other threads:[~2024-02-09 22:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 22:28 Sean Christopherson [this message]
2024-02-09 22:28 ` [PATCH v4 1/4] KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing Sean Christopherson
2024-02-17 14:45 ` Xu Yilun
2024-02-19 16:18 ` Sean Christopherson
2024-02-09 22:28 ` [PATCH v4 2/4] KVM: x86/mmu: Move private vs. shared check above slot validity checks Sean Christopherson
2024-02-09 22:28 ` [PATCH v4 3/4] KVM: x86/mmu: Move slot checks from __kvm_faultin_pfn() to kvm_faultin_pfn() Sean Christopherson
2024-02-19 3:44 ` Yan Zhao
2024-02-19 9:12 ` Huang, Kai
2024-02-19 19:44 ` Sean Christopherson
2024-02-20 6:54 ` Yan Zhao
2024-02-21 2:10 ` Sean Christopherson
2024-02-09 22:28 ` [PATCH v4 4/4] KVM: x86/mmu: Handle no-slot faults at the beginning of kvm_faultin_pfn() Sean Christopherson
2024-02-14 13:17 ` [PATCH v4 0/4] KVM: x86/mmu: Pre-check for mmu_notifier retry Friedrich Weber
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=20240209222858.396696-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=chao.p.peng@linux.intel.com \
--cc=dmatlack@google.com \
--cc=f.weber@proxmox.com \
--cc=isaku.yamahata@intel.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=tabba@google.com \
--cc=yan.y.zhao@intel.com \
--cc=yilun.xu@linux.intel.com \
--cc=yu.c.zhang@linux.intel.com \
--cc=yuan.yao@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