* [PATCH 1/2] KVM: x86/mmu: Wrap kvm_mmu_zap_all_fast TDP MMU code in ifdefs
@ 2021-04-19 18:37 Ben Gardon
2021-04-19 18:37 ` [PATCH 2/2] KVM: x86/mmu: Fix typo in for_each_tdp_mmu_root Ben Gardon
0 siblings, 1 reply; 2+ messages in thread
From: Ben Gardon @ 2021-04-19 18:37 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: Paolo Bonzini, Peter Xu, Sean Christopherson, Robert Hu,
Farrah Chen, Danmei Wei, Ben Gardon, kernel test robot
The TDP MMU code in kvm_mmu_zap_all_fast is only needed with
CONFIG_X86_64 and creates a build error without that setting. Since the
TDP MMU can only be enabled with CONFIG_X86_64, wrap those code blocks
in ifdefs.
Fixes: 1336c692abad ("KVM: x86/mmu: Fast invalidation for TDP MMU")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
---
arch/x86/kvm/mmu/mmu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 0f311c9bf9c6..3ae59c8e129b 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5407,7 +5407,9 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm)
*/
static void kvm_mmu_zap_all_fast(struct kvm *kvm)
{
+#ifdef CONFIG_X86_64
struct kvm_mmu_page *root;
+#endif /* CONFIG_X86_64 */
lockdep_assert_held(&kvm->slots_lock);
@@ -5424,6 +5426,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
kvm->arch.mmu_valid_gen = kvm->arch.mmu_valid_gen ? 0 : 1;
+#ifdef CONFIG_X86_64
if (is_tdp_mmu_enabled(kvm)) {
/*
* Mark each TDP MMU root as invalid so that other threads
@@ -5456,6 +5459,7 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
if (refcount_inc_not_zero(&root->tdp_mmu_root_count))
root->role.invalid = true;
}
+#endif /* CONFIG_X86_64 */
/*
* Notify all vcpus to reload its shadow page table and flush TLB.
@@ -5471,11 +5475,13 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
write_unlock(&kvm->mmu_lock);
+#ifdef CONFIG_X86_64
if (is_tdp_mmu_enabled(kvm)) {
read_lock(&kvm->mmu_lock);
kvm_tdp_mmu_zap_invalidated_roots(kvm);
read_unlock(&kvm->mmu_lock);
}
+#endif /* CONFIG_X86_64 */
}
static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm)
--
2.31.1.368.gbe11c130af-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] KVM: x86/mmu: Fix typo in for_each_tdp_mmu_root
2021-04-19 18:37 [PATCH 1/2] KVM: x86/mmu: Wrap kvm_mmu_zap_all_fast TDP MMU code in ifdefs Ben Gardon
@ 2021-04-19 18:37 ` Ben Gardon
0 siblings, 0 replies; 2+ messages in thread
From: Ben Gardon @ 2021-04-19 18:37 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: Paolo Bonzini, Peter Xu, Sean Christopherson, Robert Hu,
Farrah Chen, Danmei Wei, Ben Gardon, kernel test robot
There's a typo in for_each_tdp_mmu_root which breaks compilation with
certain configurations. Fix it.
Fixes: 078d47ee71d6 ("KVM: x86/mmu: Protect the tdp_mmu_roots list with RCU")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
---
arch/x86/kvm/mmu/tdp_mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 8ce8d0916042..f0aef4969754 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -152,7 +152,7 @@ static struct kvm_mmu_page *tdp_mmu_next_root(struct kvm *kvm,
#define for_each_tdp_mmu_root(_kvm, _root, _as_id) \
list_for_each_entry_rcu(_root, &_kvm->arch.tdp_mmu_roots, link, \
lockdep_is_held_type(&kvm->mmu_lock, 0) || \
- lockdep_is_help(&kvm->arch.tdp_mmu_pages_lock)) \
+ lockdep_is_held(&kvm->arch.tdp_mmu_pages_lock)) \
if (kvm_mmu_page_as_id(_root) != _as_id) { \
} else
--
2.31.1.368.gbe11c130af-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-19 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 18:37 [PATCH 1/2] KVM: x86/mmu: Wrap kvm_mmu_zap_all_fast TDP MMU code in ifdefs Ben Gardon
2021-04-19 18:37 ` [PATCH 2/2] KVM: x86/mmu: Fix typo in for_each_tdp_mmu_root Ben Gardon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).