KVM: x86/mmu: Clean up MMU_DEBUG and BUG/WARN usage
Sean Christopherson
maintainercover KVM: x86/mmu: Clean up MMU_DEBUG and BUG/WARN usage
This series consist of three loosely related miniseries:
1. Remove the noisy prints buried behind MMU_DEBUG, and replace MMU_DEBUG with a KVM_PROVE_MMU Kconfig.
2. Use WARN_ON_ONCE() for all runtime WARNs, i.e. avoid spamming the kernel log if something goes awry in the MMU.
3. Demote BUG() usage in the shadow MMU to KVM_BUG_ON() when the kernel is built with CONFIG_BUG_ON_DATA_CORRUPTION=n.
The three things aren't directly dependent on each other, but there are minor conflicts, and more importantly I want to have a single series for discussing how we want the MMU to behave when things go sideways.
Mingwei Zhang (1):
KVM: x86/mmu: Plumb "struct kvm" all the way to pte_list_remove()
Sean Christopherson (8):
KVM: x86/mmu: Delete pgprintk() and all its usage
KVM: x86/mmu: Delete rmap_printk() and all its usage
KVM: x86/mmu: Delete the "dbg" module param
KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE
enabled
KVM: x86/mmu: Replace MMU_DEBUG with proper KVM_PROVE_MMU Kconfig
KVM: x86/mmu: BUG() in rmap helpers iff
CONFIG_BUG_ON_DATA_CORRUPTION=y
arch/x86/kvm/Kconfig | 13 +++ arch/x86/kvm/mmu/mmu.c | 144 +++++++++++++------------------- arch/x86/kvm/mmu/mmu_internal.h | 14 +--- arch/x86/kvm/mmu/page_track.c | 16 ++-- arch/x86/kvm/mmu/paging_tmpl.h | 16 ++-- arch/x86/kvm/mmu/spte.c | 6 +- arch/x86/kvm/mmu/spte.h | 8 +- arch/x86/kvm/mmu/tdp_iter.c | 4 +- arch/x86/kvm/mmu/tdp_mmu.c | 28 +++---- include/linux/kvm_host.h | 19 +++++ 10 files changed, 127 insertions(+), 141 deletions(-)
base-commit: 5c291b93e5d665380dbecc6944973583f9565ee5
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 1/9 KVM: x86/mmu: Delete pgprintk() and all its usage
Delete KVM's pgprintk() and all its usage, as the code is very prone to bitrot due to being buried behind MMU_DEBUG, and the functionality has been rendered almost entirely obsolete by the tracepoints KVM has gained over the years. And for the situations where the information provided by KVM's tracepoints is insufficient, pgprintk() rarely fills in the gaps, and is almost always far too noisy, i.e. developers end up implementing custom prints anyways.
--- arch/x86/kvm/mmu/mmu.c | 17 ----------------- arch/x86/kvm/mmu/mmu_internal.h | 2 -- arch/x86/kvm/mmu/paging_tmpl.h | 7 ------- arch/x86/kvm/mmu/spte.c | 2 -- 4 files changed, 28 deletions(-)
arch/x86/kvm/mmu/mmu.c +0 -17
@@ -2768,12 +2768,9 @@ int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn)LIST_HEAD (invalid_list);int r; -pgprintk ("%s: looking for gfn %llx\n" , __func__, gfn); r =0 ;write_lock (&kvm->mmu_lock);for_each_gfn_valid_sp_with_gptes (kvm, sp, gfn) { -pgprintk ("%s: gfn %llx role %x\n" , __func__, gfn, - sp->role.word); r =1 ;kvm_mmu_prepare_zap_page (kvm, sp, &invalid_list); }
@@ -2931,9 +2928,6 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,bool prefetch = !fault || fault->prefetch;bool write_fault = fault && fault->write; -pgprintk ("%s: spte %llx write_fault %d gfn %llx\n" , __func__, - *sptep, write_fault, gfn); -if (unlikely (is_noslot_pfn (pfn))) { vcpu->stat.pf_mmio_spte_created++;mark_mmio_spte (vcpu, sptep, gfn, pte_access);
@@ -2953,8 +2947,6 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,drop_parent_pte (child, sptep); flush = true; }else if (pfn !=spte_to_pfn (*sptep)) { -pgprintk ("hfn old %llx new %llx\n" , -spte_to_pfn (*sptep), pfn);drop_spte (vcpu->kvm, sptep); flush = true; }else
@@ -2979,8 +2971,6 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,if (flush)kvm_flush_remote_tlbs_gfn (vcpu->kvm, gfn, level); -pgprintk ("%s: setting spte %llx\n" , __func__, *sptep); -if (!was_rmapped) {WARN_ON_ONCE (ret ==RET_PF_SPURIOUS );rmap_add (vcpu, slot, sptep, gfn, pte_access);
@@ -4436,8 +4426,6 @@ static int direct_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *faultstatic int nonpaging_page_fault (struct kvm_vcpu *vcpu,struct kvm_page_fault *fault) { -pgprintk ("%s: gva %lx error %x\n" , __func__, fault->addr, fault->error_code); -/* This path builds a PAE pagetable, we can map 2mb pages at maximum. */ fault->max_level =PG_LEVEL_2M ;return direct_page_fault (vcpu, fault);
@@ -5627,9 +5615,6 @@ static bool detect_write_misaligned(struct kvm_mmu_page *sp, gpa_t gpa, {unsigned offset, pte_size, misaligned; -pgprintk ("misaligned: gpa %llx bytes %d role %x\n" , - gpa, bytes, sp->role.word); - offset =offset_in_page (gpa); pte_size = sp->role.has_4_byte_gpte ?4 :8 ;
@@ -5695,8 +5680,6 @@ static void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,if (!READ_ONCE (vcpu->kvm->arch.indirect_shadow_pages))return ; -pgprintk ("%s: gpa %llx bytes %d\n" , __func__, gpa, bytes); -write_lock (&vcpu->kvm->mmu_lock); gentry =mmu_pte_write_fetch_gpte (vcpu, &gpa, &bytes);
arch/x86/kvm/mmu/mmu_internal.h +0 -2
@@ -11,11 +11,9 @@#ifdef MMU_DEBUG extern bool dbg; -#define pgprintk(x...) do { if (dbg) printk(x); } while (0) #define rmap_printk(fmt, args...) do { if (dbg) printk("%s: " fmt, __func__, ## args); } while (0)#define MMU_WARN_ON (x) WARN_ON(x)#else -#define pgprintk(x...) do { } while (0) #define rmap_printk(x...) do { } while (0)#define MMU_WARN_ON (x) do { } while (0)#endif
arch/x86/kvm/mmu/paging_tmpl.h +0 -7
@@ -456,9 +456,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, goto retry_walk; } -pgprintk ("%s: pte %llx pte_access %x pt_access %x\n" , - __func__, (u64 )pte, walker->pte_access, - walker->pt_access[walker->level -1 ]);return 1 ; error:
@@ -529,8 +526,6 @@ FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,if (FNAME (prefetch_invalid_gpte)(vcpu, sp, spte, gpte))return false; -pgprintk ("%s: gpte %llx spte %p\n" , __func__, (u64 )gpte, spte); - gfn =gpte_to_gfn (gpte); pte_access = sp->role.access &FNAME (gpte_access)(gpte);FNAME (protect_clean_gpte)(vcpu->arch.mmu, &pte_access, gpte);
@@ -758,7 +753,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, struct kvm_page_fault *faultstruct guest_walker walker;int r; -pgprintk ("%s: addr %lx err %x\n" , __func__, fault->addr, fault->error_code);WARN_ON_ONCE (fault->is_tdp);/*
@@ -773,7 +767,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault* The page is not mapped by the guest. Let the guest handle it. */ if (!r) { -pgprintk ("%s: guest page fault\n" , __func__);if (!fault->prefetch)kvm_inject_emulated_page_fault (vcpu, &walker.fault);
arch/x86/kvm/mmu/spte.c +0 -2
@@ -221,8 +221,6 @@ bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,* shadow pages and unsync'ing pages is not allowed. */ if (mmu_try_to_unsync_pages (vcpu->kvm, slot, gfn, can_unsync, prefetch)) { -pgprintk ("%s: found shadow page for %llx, marking ro\n" , - __func__, gfn); wrprot = true; pte_access &= ~ACC_WRITE_MASK ; spte &= ~(PT_WRITABLE_MASK | shadow_mmu_writable_mask);
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 2/9 KVM: x86/mmu: Delete rmap_printk() and all its usage
In reply to Sean ChristophersonDelete rmap_printk() so that MMU_WARN_ON() and MMU_DEBUG can be morphed into something that can be regularly enabled for debug kernels. The information provided by rmap_printk() isn't all that useful now that the rmap and unsync code is mature, as the prints are simultaneously too verbose (_lots_ of message) and yet not verbose enough to be helpful for debug (most instances print just the SPTE pointer/value, which is rarely sufficient to root cause anything but trivial bugs).
Alternatively, rmap_printk() could be reworked to into tracepoints, but it's not clear there is a real need as rmap bugs rarely escape initial development, and when bugs do escape to production, they are often edge cases and/or reside in code that isn't directly related to the rmaps. In other words, the problems with rmap_printk() being unhelpful also apply to tracepoints. And deleting rmap_printk() doesn't preclude adding tracepoints in the future.
--- arch/x86/kvm/mmu/mmu.c | 12 ------------ arch/x86/kvm/mmu/mmu_internal.h | 2 -- 2 files changed, 14 deletions(-)
arch/x86/kvm/mmu/mmu.c +0 -12
@@ -938,10 +938,8 @@ static int pte_list_add(struct kvm_mmu_memory_cache *cache, u64 *spte,int count =0 ;if (!rmap_head->val) { -rmap_printk ("%p %llx 0->1\n" , spte, *spte); rmap_head->val = (unsigned long )spte; }else if (!(rmap_head->val &1 )) { -rmap_printk ("%p %llx 1->many\n" , spte, *spte); desc =kvm_mmu_memory_cache_alloc (cache); desc->sptes[0 ] = (u64 *)rmap_head->val; desc->sptes[1 ] = spte;
@@ -950,7 +948,6 @@ static int pte_list_add(struct kvm_mmu_memory_cache *cache, u64 *spte, rmap_head->val = (unsigned long )desc |1 ; ++count; }else { -rmap_printk ("%p %llx many->many\n" , spte, *spte); desc = (struct pte_list_desc *)(rmap_head->val & ~1ul ); count = desc->tail_count + desc->spte_count;
@@ -1015,14 +1012,12 @@ static void pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head)pr_err ("%s: %p 0->BUG\n" , __func__, spte);BUG (); }else if (!(rmap_head->val &1 )) { -rmap_printk ("%p 1->0\n" , spte);if ((u64 *)rmap_head->val != spte) {pr_err ("%s: %p 1->BUG\n" , __func__, spte);BUG (); } rmap_head->val =0 ; }else { -rmap_printk ("%p many->many\n" , spte); desc = (struct pte_list_desc *)(rmap_head->val & ~1ul );while (desc) {for (i =0 ; i < desc->spte_count; ++i) {
@@ -1238,8 +1233,6 @@ static bool spte_write_protect(u64 *sptep, bool pt_protect) !(pt_protect && is_mmu_writable_spte(spte)))return false; -rmap_printk ("spte %p %llx\n" , sptep, *sptep); -if (pt_protect) spte &= ~shadow_mmu_writable_mask; spte = spte & ~PT_WRITABLE_MASK ;
@@ -1264,8 +1257,6 @@ static bool spte_clear_dirty(u64 *sptep) {u64 spte = *sptep; -rmap_printk ("spte %p %llx\n" , sptep, *sptep); -MMU_WARN_ON (!spte_ad_enabled (spte)); spte &= ~shadow_dirty_mask;return mmu_spte_update (sptep, spte);
@@ -1477,9 +1468,6 @@ static bool kvm_set_pte_rmap(struct kvm *kvm, struct kvm_rmap_head *rmap_head, restart:for_each_rmap_spte (rmap_head, &iter, sptep) { -rmap_printk ("spte %p %llx gfn %llx (%d)\n" , - sptep, *sptep, gfn, level); - need_flush = true;if (pte_write (pte)) {
arch/x86/kvm/mmu/mmu_internal.h +0 -2
@@ -11,10 +11,8 @@#ifdef MMU_DEBUG extern bool dbg; -#define rmap_printk(fmt, args...) do { if (dbg) printk("%s: " fmt, __func__, ## args); } while (0)#define MMU_WARN_ON (x) WARN_ON(x)#else -#define rmap_printk(x...) do { } while (0)#define MMU_WARN_ON (x) do { } while (0)#endif
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 3/9 KVM: x86/mmu: Delete the "dbg" module param
In reply to Sean ChristophersonDelete KVM's "dbg" module param now that its usage in KVM is gone (it used to guard pgprintk() and rmap_printk()).
--- arch/x86/kvm/mmu/mmu.c | 5 ----- arch/x86/kvm/mmu/mmu_internal.h | 2 -- 2 files changed, 7 deletions(-)
arch/x86/kvm/mmu/mmu.c +0 -5
@@ -112,11 +112,6 @@ static int max_huge_page_level __read_mostly;static int tdp_root_level__read_mostly ;static int max_tdp_level__read_mostly ; -#ifdef MMU_DEBUG -bool dbg =0 ; -module_param (dbg, bool,0644 ); -#endif -#define PTE_PREFETCH_NUM 8#include <trace/events/kvm.h>
arch/x86/kvm/mmu/mmu_internal.h +0 -2
@@ -9,8 +9,6 @@#undef MMU_DEBUG#ifdef MMU_DEBUG -extern bool dbg; -#define MMU_WARN_ON (x) WARN_ON(x)#else #define MMU_WARN_ON (x) do { } while (0)
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 4/9 KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
In reply to Sean ChristophersonRename MMU_WARN_ON() to make it super obvious that the assertions are all about KVM's MMU, not the primary MMU.
--- arch/x86/kvm/mmu/mmu.c | 4 ++-- arch/x86/kvm/mmu/mmu_internal.h | 4 ++-- arch/x86/kvm/mmu/spte.h | 8 ++++---- arch/x86/kvm/mmu/tdp_mmu.c | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/kvm/mmu/mmu.c +2 -2
@@ -1252,7 +1252,7 @@ static bool spte_clear_dirty(u64 *sptep) {u64 spte = *sptep; -MMU_WARN_ON (!spte_ad_enabled (spte)); +KVM_MMU_WARN_ON (!spte_ad_enabled (spte)); spte &= ~shadow_dirty_mask;return mmu_spte_update (sptep, spte); }
@@ -1728,7 +1728,7 @@ static void kvm_unaccount_mmu_page(struct kvm *kvm, struct kvm_mmu_page *sp)static void kvm_mmu_free_shadow_page (struct kvm_mmu_page *sp) { -MMU_WARN_ON (!is_empty_shadow_page (sp->spt)); +KVM_MMU_WARN_ON (!is_empty_shadow_page (sp->spt));hlist_del (&sp->hash_link);list_del (&sp->link);free_page ((unsigned long )sp->spt);
arch/x86/kvm/mmu/mmu_internal.h +2 -2
@@ -9,9 +9,9 @@#undef MMU_DEBUG#ifdef MMU_DEBUG -#define MMU_WARN_ON (x) WARN_ON(x) +#define KVM_MMU_WARN_ON (x) WARN_ON(x)#else -#define MMU_WARN_ON (x) do { } while (0) +#define KVM_MMU_WARN_ON (x) do { } while (0)#endif /* Page table builder macros common to shadow (host) PTEs and guest PTEs. */
arch/x86/kvm/mmu/spte.h +4 -4
@@ -265,13 +265,13 @@ static inline bool sp_ad_disabled(struct kvm_mmu_page *sp)static inline bool spte_ad_enabled (u64 spte) { -MMU_WARN_ON (!is_shadow_present_pte (spte)); +KVM_MMU_WARN_ON (!is_shadow_present_pte (spte));return (spte &SPTE_TDP_AD_MASK ) !=SPTE_TDP_AD_DISABLED ; }static inline bool spte_ad_need_write_protect (u64 spte) { -MMU_WARN_ON (!is_shadow_present_pte (spte)); +KVM_MMU_WARN_ON (!is_shadow_present_pte (spte));/* * This is benign for non-TDP SPTEs as SPTE_TDP_AD_ENABLED is '0', * and non-TDP SPTEs will never set these bits. Optimize for 64-bit
@@ -282,13 +282,13 @@ static inline bool spte_ad_need_write_protect(u64 spte)static inline u64 spte_shadow_accessed_mask (u64 spte) { -MMU_WARN_ON (!is_shadow_present_pte (spte)); +KVM_MMU_WARN_ON (!is_shadow_present_pte (spte));return spte_ad_enabled (spte) ? shadow_accessed_mask :0 ; }static inline u64 spte_shadow_dirty_mask (u64 spte) { -MMU_WARN_ON (!is_shadow_present_pte (spte)); +KVM_MMU_WARN_ON (!is_shadow_present_pte (spte));return spte_ad_enabled (spte) ? shadow_dirty_mask :0 ; }
arch/x86/kvm/mmu/tdp_mmu.c +4 -4
@@ -1545,8 +1545,8 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root,if (!is_shadow_present_pte (iter.old_spte))continue ; -MMU_WARN_ON (kvm_ad_enabled () && -spte_ad_need_write_protect (iter.old_spte)); +KVM_MMU_WARN_ON (kvm_ad_enabled () && +spte_ad_need_write_protect (iter.old_spte));if (!(iter.old_spte & dbit))continue ;
@@ -1604,8 +1604,8 @@ static void clear_dirty_pt_masked(struct kvm *kvm, struct kvm_mmu_page *root,if (!mask)break ; -MMU_WARN_ON (kvm_ad_enabled () && -spte_ad_need_write_protect (iter.old_spte)); +KVM_MMU_WARN_ON (kvm_ad_enabled () && +spte_ad_need_write_protect (iter.old_spte));if (iter.level >PG_LEVEL_4K || !(mask & (1UL << (iter.gfn - gfn))))
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Re: [PATCH 4/9] KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
Quoted 2 lines · Sean Christopherson
Rename
MMU_WARN_ON()to make it super obvious that the assertions are all about KVM's MMU, not the primary MMU.
I think adding KVM is a step in the right direction but I have 2 remaining problems with KVM_MMU_WARN_ON():
- Reminds me of VM_WARN_ON(), which toggles between WARN_ON() and BUG_ON(), whereas KVM_MMU_WARN_ON() toggles between no-op and WARN_ON().
- It's not obvious from the name that it's a no-op most of the time.
Naming is hard so I might just make things worse by trying but...
How about KVM_MMU_PROVE(condition). That directly pairs it with the new CONFIG_KVM_PROVE_MMU(), makes it sufficiently different from VM_WARN_ON() and WARN_ON() that readers will not make assumptions about what's happening under the hood. Also "PROVE" sounds like a high bar which conveys this might not always be enabled.
That also will allow us to convert this to a WARN_ON_ONCE() (my suggestion on the other patch) without having to make the name any longer.
Sean Christopherson
maintainerRe: [PATCH 4/9] KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
Quoted 10 lines · David Matlack
Quoted 2 lines · Sean Christopherson
Rename
MMU_WARN_ON()to make it super obvious that the assertions are all about KVM's MMU, not the primary MMU.I think adding KVM is a step in the right direction but I have 2 remaining problems with
KVM_MMU_WARN_ON():- Reminds me of
VM_WARN_ON(), which toggles betweenWARN_ON()andBUG_ON(), whereasKVM_MMU_WARN_ON()toggles between no-op andWARN_ON().
No, VM_WARN_ON() bounces between WARN_ON() and nop, just like KVM_MMU_WARN_ON(). There's an extra bit of magic that adds a static assert that the code is valid (which I can/should/will add), but the runtime behavior is a nop.
#define VM_WARN_ON(cond) (void)WARN_ON(cond) #else #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
/*
* BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
* expression but avoids the generation of any code, even if that expression
* has side-effects.
*/
#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
Quoted 9 lines
- It's not obvious from the name that it's a no-op most of the time.
Naming is hard so I might just make things worse by trying but...
How about
KVM_MMU_PROVE(condition). That directly pairs it with the newCONFIG_KVM_PROVE_MMU(), makes it sufficiently different fromVM_WARN_ON()andWARN_ON()that readers will not make assumptions about what's happening under the hood. Also "PROVE" sounds like a high bar which conveys this might not always be enabled.
It inverts the checks though. Contexting switching between "WARN_ON" and "ASSERT" is hard enough, I don't want to add a third flavor.
Quoted 3 lines
That also will allow us to convert this to a
WARN_ON_ONCE()(my suggestion on the other patch) without having to make the name any longer.
Re: [PATCH 4/9] KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
Quoted 9 lines · Sean Christopherson
Quoted 7 lines · David Matlack
Quoted 2 lines · Sean Christopherson
Rename
MMU_WARN_ON()to make it super obvious that the assertions are all about KVM's MMU, not the primary MMU.I think adding KVM is a step in the right direction but I have 2 remaining problems with
KVM_MMU_WARN_ON():
Quoted 7 lines
Quoted 3 lines
- Reminds me of
VM_WARN_ON(), which toggles betweenWARN_ON()andBUG_ON(), whereasKVM_MMU_WARN_ON()toggles between no-op andWARN_ON().No,
VM_WARN_ON()bounces betweenWARN_ON()and nop, just likeKVM_MMU_WARN_ON(). There's an extra bit of magic that adds a static assert that the code is valid (which I can/should/will add), but the runtime behavior is a nop.
Ah, you're right, I misread VM_WARN_ON().
Sean Christopherson
maintainerPATCH 5/9 KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
In reply to Sean ChristophersonConvert all "runtime" assertions, i.e. assertions that can be triggered while running vCPUs, from WARN_ON() to WARN_ON_ONCE(). Every WARN in the MMU that is tied to running vCPUs, i.e. not contained to loading and initializing KVM, is likely to fire _a lot_ when it does trigger. E.g. if KVM ends up with a bug that causes a root to be invalidated before the page fault handler is invoked, pretty much _every_ page fault VM-Exit triggers the WARN.
If a WARN is triggered frequently, the resulting spam usually causes a lot of damage of its own, e.g. consumes resources to log the WARN and pollutes the kernel log, often to the point where other useful information can be lost. In many case, the damage caused by the spam is actually worse than the bug itself, e.g. KVM can almost always recover from an unexpectedly invalid root.
On the flip side, warning every time is rarely helpful for debug and triage, i.e. a single splat is usually sufficient to point a debugger in the right direction, and automated testing, e.g. syzkaller, typically runs with warn_on_panic=1, i.e. will never get past the first WARN anyways.
Lastly, when an assertions fails multiple times, the stack traces in KVM are almost always identical, i.e. the full splat only needs to be captured once. And _if_ there is value in captruing information about the failed assert, a ratelimited printk() is sufficient and less likely to rack up a large amount of collateral damage.
--- arch/x86/kvm/mmu/mmu.c | 48 ++++++++++++++++----------------- arch/x86/kvm/mmu/mmu_internal.h | 2 +- arch/x86/kvm/mmu/page_track.c | 16 +++++------ arch/x86/kvm/mmu/paging_tmpl.h | 4 +-- arch/x86/kvm/mmu/spte.c | 4 +-- arch/x86/kvm/mmu/tdp_iter.c | 4 +-- arch/x86/kvm/mmu/tdp_mmu.c | 20 +++++++------- 7 files changed, 49 insertions(+), 49 deletions(-)
arch/x86/kvm/mmu/mmu.c +24 -24
@@ -482,7 +482,7 @@ static u64 __get_spte_lockless(u64 *sptep)*/ static void mmu_spte_set (u64 *sptep,u64 new_spte) { -WARN_ON (is_shadow_present_pte (*sptep)); +WARN_ON_ONCE (is_shadow_present_pte (*sptep));__set_spte (sptep, new_spte); }
@@ -494,7 +494,7 @@ static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte) {u64 old_spte = *sptep; -WARN_ON (!is_shadow_present_pte (new_spte)); +WARN_ON_ONCE (!is_shadow_present_pte (new_spte));check_spte_writable_invariants (new_spte);if (!is_shadow_present_pte (old_spte)) {
@@ -507,7 +507,7 @@ static u64 mmu_spte_update_no_track(u64 *sptep, u64 new_spte)else old_spte =__update_clear_spte_slow (sptep, new_spte); -WARN_ON (spte_to_pfn (old_spte) !=spte_to_pfn (new_spte)); +WARN_ON_ONCE (spte_to_pfn (old_spte) !=spte_to_pfn (new_spte));return old_spte; }
@@ -589,7 +589,7 @@ static u64 mmu_spte_clear_track_bits(struct kvm *kvm, u64 *sptep)* by a refcounted page, the refcount is elevated. */ page =kvm_pfn_to_refcounted_page (pfn); -WARN_ON (page && !page_count (page)); +WARN_ON_ONCE (page && !page_count (page));if (is_accessed_spte (old_spte))kvm_set_pfn_accessed (pfn);
@@ -804,7 +804,7 @@ static void update_gfn_disallow_lpage_count(const struct kvm_memory_slot *slot,for (i =PG_LEVEL_2M ; i <=KVM_MAX_HUGEPAGE_LEVEL ; ++i) { linfo =lpage_info_slot (gfn, slot, i); linfo->disallow_lpage += count; -WARN_ON (linfo->disallow_lpage <0 ); +WARN_ON_ONCE (linfo->disallow_lpage <0 ); } }
@@ -1199,7 +1199,7 @@ static void drop_large_spte(struct kvm *kvm, u64 *sptep, bool flush)struct kvm_mmu_page *sp; sp =sptep_to_sp (sptep); -WARN_ON (sp->role.level ==PG_LEVEL_4K ); +WARN_ON_ONCE (sp->role.level ==PG_LEVEL_4K );drop_spte (kvm, sptep);
@@ -1458,7 +1458,7 @@ static bool kvm_set_pte_rmap(struct kvm *kvm, struct kvm_rmap_head *rmap_head,u64 new_spte;kvm_pfn_t new_pfn; -WARN_ON (pte_huge (pte)); +WARN_ON_ONCE (pte_huge (pte)); new_pfn =pte_pfn (pte); restart:
@@ -1816,7 +1816,7 @@ static int mmu_pages_add(struct kvm_mmu_pages *pvec, struct kvm_mmu_page *sp,static inline void clear_unsync_child_bit (struct kvm_mmu_page *sp,int idx) { --sp->unsync_children; -WARN_ON ((int )sp->unsync_children <0 ); +WARN_ON_ONCE ((int )sp->unsync_children <0 );__clear_bit (idx, sp->unsync_child_bitmap); }
@@ -1874,7 +1874,7 @@ static int mmu_unsync_walk(struct kvm_mmu_page *sp,static void kvm_unlink_unsync_page (struct kvm *kvm,struct kvm_mmu_page *sp) { -WARN_ON (!sp->unsync); +WARN_ON_ONCE (!sp->unsync);trace_kvm_mmu_sync_page (sp); sp->unsync =0 ; --kvm->stat.mmu_unsync;
@@ -2049,11 +2049,11 @@ static int mmu_pages_first(struct kvm_mmu_pages *pvec,if (pvec->nr ==0 )return 0 ; -WARN_ON (pvec->page[0 ].idx !=INVALID_INDEX ); +WARN_ON_ONCE (pvec->page[0 ].idx !=INVALID_INDEX ); sp = pvec->page[0 ].sp; level = sp->role.level; -WARN_ON (level ==PG_LEVEL_4K ); +WARN_ON_ONCE (level ==PG_LEVEL_4K ); parents->parent[level-2 ] = sp;
@@ -2075,7 +2075,7 @@ static void mmu_pages_clear_parents(struct mmu_page_path *parents)if (!sp)return ; -WARN_ON (idx ==INVALID_INDEX ); +WARN_ON_ONCE (idx ==INVALID_INDEX );clear_unsync_child_bit (sp, idx); level++; }while (!sp->unsync_children);
@@ -2196,7 +2196,7 @@ static struct kvm_mmu_page *kvm_mmu_find_shadow_page(struct kvm *kvm,if (ret <0 )break ; -WARN_ON (!list_empty (&invalid_list)); +WARN_ON_ONCE (!list_empty (&invalid_list));if (ret >0 )kvm_flush_remote_tlbs (kvm); }
@@ -2651,7 +2651,7 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,kvm_flush_remote_tlbs (kvm);list_for_each_entry_safe (sp, nsp, invalid_list, link) { -WARN_ON (!sp->role.invalid || sp->root_count); +WARN_ON_ONCE (!sp->role.invalid || sp->root_count);kvm_mmu_free_shadow_page (sp); } }
@@ -2846,7 +2846,7 @@ int mmu_try_to_unsync_pages(struct kvm *kvm, const struct kvm_memory_slot *slot,continue ; } -WARN_ON (sp->role.level !=PG_LEVEL_4K ); +WARN_ON_ONCE (sp->role.level !=PG_LEVEL_4K );kvm_unsync_page (kvm, sp); }if (locked)
@@ -2999,7 +2999,7 @@ static void __direct_pte_prefetch(struct kvm_vcpu *vcpu,u64 *spte, *start =NULL ;int i; -WARN_ON (!sp->role.direct); +WARN_ON_ONCE (!sp->role.direct); i =spte_index (sptep) & ~(PTE_PREFETCH_NUM -1 ); spte = sp->spt + i;
@@ -3545,7 +3545,7 @@ static void mmu_free_root_page(struct kvm *kvm, hpa_t *root_hpa,* SPTE to ensure any non-PA bits are dropped. */ sp =spte_to_child_sp (*root_hpa); -if (WARN_ON (!sp)) +if (WARN_ON_ONCE (!sp))return ;if (is_tdp_mmu_page (sp))
@@ -4160,7 +4160,7 @@ static int handle_mmio_page_fault(struct kvm_vcpu *vcpu, u64 addr, bool direct)return RET_PF_EMULATE ; reserved =get_mmio_spte (vcpu, addr, &spte); -if (WARN_ON (reserved)) +if (WARN_ON_ONCE (reserved))return -EINVAL ;if (is_mmio_spte (spte)) {
@@ -5495,9 +5495,9 @@ void kvm_mmu_unload(struct kvm_vcpu *vcpu)struct kvm *kvm = vcpu->kvm;kvm_mmu_free_roots (kvm, &vcpu->arch.root_mmu,KVM_MMU_ROOTS_ALL ); -WARN_ON (VALID_PAGE (vcpu->arch.root_mmu.root.hpa)); +WARN_ON_ONCE (VALID_PAGE (vcpu->arch.root_mmu.root.hpa));kvm_mmu_free_roots (kvm, &vcpu->arch.guest_mmu,KVM_MMU_ROOTS_ALL ); -WARN_ON (VALID_PAGE (vcpu->arch.guest_mmu.root.hpa)); +WARN_ON_ONCE (VALID_PAGE (vcpu->arch.guest_mmu.root.hpa));vcpu_clear_mmio_info (vcpu,MMIO_GVA_ANY ); }
@@ -5701,7 +5701,7 @@ int noinline kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u64 errint r, emulation_type =EMULTYPE_PF ;bool direct = vcpu->arch.mmu->root_role.direct; -if (WARN_ON (!VALID_PAGE (vcpu->arch.mmu->root.hpa))) +if (WARN_ON_ONCE (!VALID_PAGE (vcpu->arch.mmu->root.hpa)))return RET_PF_RETRY ; r =RET_PF_INVALID ;
@@ -6050,7 +6050,7 @@ static void kvm_zap_obsolete_pages(struct kvm *kvm)* pages. Skip the bogus page, otherwise we'll get stuck in an * infinite loop if the page gets put back on the list (again). */ -if (WARN_ON (sp->role.invalid)) +if (WARN_ON_ONCE (sp->role.invalid))continue ;/*
@@ -6692,7 +6692,7 @@ void kvm_mmu_zap_all(struct kvm *kvm)write_lock (&kvm->mmu_lock); restart:list_for_each_entry_safe (sp, node, &kvm->arch.active_mmu_pages, link) { -if (WARN_ON (sp->role.invalid)) +if (WARN_ON_ONCE (sp->role.invalid))continue ;if (__kvm_mmu_prepare_zap_page (kvm, sp, &invalid_list, &ign)) goto restart;
@@ -6710,7 +6710,7 @@ void kvm_mmu_zap_all(struct kvm *kvm)void kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,u64 gen) { -WARN_ON (gen &KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS ); +WARN_ON_ONCE (gen &KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS ); gen &=MMIO_SPTE_GEN_MASK ;
arch/x86/kvm/mmu/mmu_internal.h +1 -1
@@ -9,7 +9,7 @@#undef MMU_DEBUG#ifdef MMU_DEBUG -#define KVM_MMU_WARN_ON (x) WARN_ON(x) +#define KVM_MMU_WARN_ON (x) WARN_ON_ONCE(x)#else #define KVM_MMU_WARN_ON (x) do { } while (0)#endif
arch/x86/kvm/mmu/page_track.c +8 -8
@@ -94,7 +94,7 @@ static void update_gfn_track(struct kvm_memory_slot *slot, gfn_t gfn, val = slot->arch.gfn_track[mode][index]; -if (WARN_ON (val + count <0 || val + count >USHRT_MAX )) +if (WARN_ON_ONCE (val + count <0 || val + count >USHRT_MAX ))return ; slot->arch.gfn_track[mode][index] += count;
@@ -117,11 +117,11 @@ void kvm_slot_page_track_add_page(struct kvm *kvm, enum kvm_page_track_mode mode) { -if (WARN_ON (!page_track_mode_is_valid (mode))) +if (WARN_ON_ONCE (!page_track_mode_is_valid (mode)))return ; -if (WARN_ON (mode ==KVM_PAGE_TRACK_WRITE && - !kvm_page_track_write_tracking_enabled (kvm))) +if (WARN_ON_ONCE (mode ==KVM_PAGE_TRACK_WRITE && + !kvm_page_track_write_tracking_enabled (kvm)))return ;update_gfn_track (slot, gfn, mode,1 );
@@ -155,11 +155,11 @@ void kvm_slot_page_track_remove_page(struct kvm *kvm, struct kvm_memory_slot *slot, gfn_t gfn, enum kvm_page_track_mode mode) { - if (WARN_ON(!page_track_mode_is_valid(mode))) + if (WARN_ON_ONCE(!page_track_mode_is_valid(mode))) return; -if (WARN_ON (mode ==KVM_PAGE_TRACK_WRITE && - !kvm_page_track_write_tracking_enabled (kvm))) +if (WARN_ON_ONCE (mode ==KVM_PAGE_TRACK_WRITE && + !kvm_page_track_write_tracking_enabled (kvm)))return ;update_gfn_track (slot, gfn, mode,-1 );
@@ -181,7 +181,7 @@ bool kvm_slot_page_track_is_active(struct kvm *kvm, {int index; -if (WARN_ON (!page_track_mode_is_valid (mode))) +if (WARN_ON_ONCE (!page_track_mode_is_valid (mode)))return false;if (!slot)
arch/x86/kvm/mmu/paging_tmpl.h +2 -2
@@ -633,7 +633,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,if (FNAME (gpte_changed)(vcpu, gw, top_level)) goto out_gpte_changed; -if (WARN_ON (!VALID_PAGE (vcpu->arch.mmu->root.hpa))) +if (WARN_ON_ONCE (!VALID_PAGE (vcpu->arch.mmu->root.hpa))) goto out_gpte_changed;for_each_shadow_entry (vcpu, fault->addr, it) {
@@ -830,7 +830,7 @@ static gpa_t FNAME(get_level1_sp_gpa)(struct kvm_mmu_page *sp) {int offset =0 ; -WARN_ON (sp->role.level !=PG_LEVEL_4K ); +WARN_ON_ONCE (sp->role.level !=PG_LEVEL_4K );if (PTTYPE ==32 ) offset = sp->role.quadrant <<SPTE_LEVEL_BITS ;
arch/x86/kvm/mmu/spte.c +2 -2
@@ -61,7 +61,7 @@ static u64 generation_mmio_spte_mask(u64 gen) {u64 mask; -WARN_ON (gen & ~MMIO_SPTE_GEN_MASK ); +WARN_ON_ONCE (gen & ~MMIO_SPTE_GEN_MASK ); mask = (gen <<MMIO_SPTE_GEN_LOW_SHIFT ) &MMIO_SPTE_GEN_LOW_MASK ; mask |= (gen <<MMIO_SPTE_GEN_HIGH_SHIFT ) &MMIO_SPTE_GEN_HIGH_MASK ;
@@ -240,7 +240,7 @@ bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,if ((spte &PT_WRITABLE_MASK ) &&kvm_slot_dirty_track_enabled (slot)) {/* Enforced by kvm_mmu_hugepage_adjust. */ -WARN_ON (level >PG_LEVEL_4K ); +WARN_ON_ONCE (level >PG_LEVEL_4K );mark_page_dirty_in_slot (vcpu->kvm, slot, gfn); }
arch/x86/kvm/mmu/tdp_iter.c +2 -2
@@ -41,8 +41,8 @@ void tdp_iter_start(struct tdp_iter *iter, struct kvm_mmu_page *root, {int root_level = root->role.level; -WARN_ON (root_level <1 ); -WARN_ON (root_level >PT64_ROOT_MAX_LEVEL ); +WARN_ON_ONCE (root_level <1 ); +WARN_ON_ONCE (root_level >PT64_ROOT_MAX_LEVEL ); iter->next_last_level_gfn = next_last_level_gfn; iter->root_level = root_level;
arch/x86/kvm/mmu/tdp_mmu.c +10 -10
@@ -475,9 +475,9 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,bool is_leaf = is_present &&is_last_spte (new_spte, level);bool pfn_changed =spte_to_pfn (old_spte) !=spte_to_pfn (new_spte); -WARN_ON (level >PT64_ROOT_MAX_LEVEL ); -WARN_ON (level <PG_LEVEL_4K ); -WARN_ON (gfn & (KVM_PAGES_PER_HPAGE (level) -1 )); +WARN_ON_ONCE (level >PT64_ROOT_MAX_LEVEL ); +WARN_ON_ONCE (level <PG_LEVEL_4K ); +WARN_ON_ONCE (gfn & (KVM_PAGES_PER_HPAGE (level) -1 ));/* * If this warning were to trigger it would indicate that there was a
@@ -522,9 +522,9 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,* impact the guest since both the former and current SPTEs * are nonpresent. */ -if (WARN_ON (!is_mmio_spte (old_spte) && - !is_mmio_spte (new_spte) && - !is_removed_spte (new_spte))) +if (WARN_ON_ONCE (!is_mmio_spte (old_spte) && + !is_mmio_spte (new_spte) && + !is_removed_spte (new_spte)))pr_err ("Unexpected SPTE change! Nonpresent SPTEs\n" "should not be replaced with another,\n" "different nonpresent SPTE, unless one or both\n"
@@ -658,7 +658,7 @@ static u64 tdp_mmu_set_spte(struct kvm *kvm, int as_id, tdp_ptep_t sptep,* should be used. If operating under the MMU lock in write mode, the * use of the removed SPTE should not be necessary. */ -WARN_ON (is_removed_spte (old_spte) ||is_removed_spte (new_spte)); +WARN_ON_ONCE (is_removed_spte (old_spte) ||is_removed_spte (new_spte)); old_spte =kvm_tdp_mmu_write_spte (sptep, old_spte, new_spte, level);
@@ -706,7 +706,7 @@ static inline bool __must_check tdp_mmu_iter_cond_resched(struct kvm *kvm,struct tdp_iter *iter, bool flush, bool shared) { - WARN_ON(iter->yielded); + WARN_ON_ONCE(iter->yielded);/* Ensure forward progress has been made before yielding. */ if (iter->next_last_level_gfn == iter->yielded_gfn)
@@ -725,7 +725,7 @@ static inline bool __must_check tdp_mmu_iter_cond_resched(struct kvm *kvm,rcu_read_lock (); -WARN_ON (iter->gfn > iter->next_last_level_gfn); +WARN_ON_ONCE (iter->gfn > iter->next_last_level_gfn); iter->yielded = true; }
@@ -1238,7 +1238,7 @@ static bool set_spte_gfn(struct kvm *kvm, struct tdp_iter *iter,u64 new_spte;/* Huge pages aren't expected to be modified without first being zapped. */ -WARN_ON (pte_huge (range->pte) || range->start +1 != range->end); +WARN_ON_ONCE (pte_huge (range->pte) || range->start +1 != range->end);if (iter->level !=PG_LEVEL_4K || !is_shadow_present_pte (iter->old_spte))
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Re: [PATCH 5/9] KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
Quoted 15 lines · Sean Christopherson
Convert all "runtime" assertions, i.e. assertions that can be triggered while running vCPUs, from
WARN_ON()toWARN_ON_ONCE(). Every WARN in the MMU that is tied to running vCPUs, i.e. not contained to loading and initializing KVM, is likely to fire _alot_when it does trigger. E.g. if KVM ends up with a bug that causes a root to be invalidated before the page fault handler is invoked, pretty much _every_ page fault VM-Exit triggers the WARN.If a WARN is triggered frequently, the resulting spam usually causes a lot of damage of its own, e.g. consumes resources to log the WARN and pollutes the kernel log, often to the point where other useful information can be lost. In many case, the damage caused by the spam is actually worse than the bug itself, e.g. KVM can almost always recover from an unexpectedly invalid root.
Quoted 4 lines
On the flip side, warning every time is rarely helpful for debug and triage, i.e. a single splat is usually sufficient to point a debugger in the right direction, and automated testing, e.g. syzkaller, typically runs with warn_on_panic=1, i.e. will never get past the first WARN anyways.
On the topic of syzkaller, we should get them to test with CONFIG_KVM_PROVE_MMU once it's available.
Quoted 6 lines
Lastly, when an assertions fails multiple times, the stack traces in KVM are almost always identical, i.e. the full splat only needs to be captured once. And _if_ there is value in captruing information about the failed assert, a ratelimited
printk()is sufficient and less likely to rack up a large amount of collateral damage.
These are all good arguments and I think they apply to KVM_MMU_WARN_ON() as well. Should we convert that to _ONCE() too?
Sean Christopherson
maintainerRe: [PATCH 5/9] KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
Quoted 16 lines · David Matlack
Quoted 15 lines · Sean Christopherson
Convert all "runtime" assertions, i.e. assertions that can be triggered while running vCPUs, from
WARN_ON()toWARN_ON_ONCE(). Every WARN in the MMU that is tied to running vCPUs, i.e. not contained to loading and initializing KVM, is likely to fire _alot_when it does trigger. E.g. if KVM ends up with a bug that causes a root to be invalidated before the page fault handler is invoked, pretty much _every_ page fault VM-Exit triggers the WARN.If a WARN is triggered frequently, the resulting spam usually causes a lot of damage of its own, e.g. consumes resources to log the WARN and pollutes the kernel log, often to the point where other useful information can be lost. In many case, the damage caused by the spam is actually worse than the bug itself, e.g. KVM can almost always recover from an unexpectedly invalid root.
Quoted 7 lines
Quoted 4 lines
On the flip side, warning every time is rarely helpful for debug and triage, i.e. a single splat is usually sufficient to point a debugger in the right direction, and automated testing, e.g. syzkaller, typically runs with warn_on_panic=1, i.e. will never get past the first WARN anyways.
On the topic of syzkaller, we should get them to test with
CONFIG_KVM_PROVE_MMUonce it's available.
+1
Quoted 8 lines
Quoted 5 lines
Lastly, when an assertions fails multiple times, the stack traces in KVM are almost always identical, i.e. the full splat only needs to be captured once. And _if_ there is value in captruing information about the failed assert, a ratelimited
printk()is sufficient and less likely to rack up a large amount of collateral damage.These are all good arguments and I think they apply to
KVM_MMU_WARN_ON()as well. Should we convert that to_ONCE()too?
Already done in this patch :-) I didn't call it out because that warn also falls under the "runtime assertions" umbrella.
arch/x86/kvm/mmu/mmu_internal.h +1 -1
@@ -9,7 +9,7 @@#undef MMU_DEBUG#ifdef MMU_DEBUG -#define KVM_MMU_WARN_ON (x) WARN_ON(x) +#define KVM_MMU_WARN_ON (x) WARN_ON_ONCE(x)#else #define KVM_MMU_WARN_ON (x) do { } while (0)#endif
Re: [PATCH 5/9] KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
Quoted 34 lines · Sean Christopherson
Quoted 16 lines · David Matlack
Quoted 15 lines · Sean Christopherson
Convert all "runtime" assertions, i.e. assertions that can be triggered while running vCPUs, from
WARN_ON()toWARN_ON_ONCE(). Every WARN in the MMU that is tied to running vCPUs, i.e. not contained to loading and initializing KVM, is likely to fire _alot_when it does trigger. E.g. if KVM ends up with a bug that causes a root to be invalidated before the page fault handler is invoked, pretty much _every_ page fault VM-Exit triggers the WARN.If a WARN is triggered frequently, the resulting spam usually causes a lot of damage of its own, e.g. consumes resources to log the WARN and pollutes the kernel log, often to the point where other useful information can be lost. In many case, the damage caused by the spam is actually worse than the bug itself, e.g. KVM can almost always recover from an unexpectedly invalid root.
Quoted 7 lines
Quoted 4 lines
On the flip side, warning every time is rarely helpful for debug and triage, i.e. a single splat is usually sufficient to point a debugger in the right direction, and automated testing, e.g. syzkaller, typically runs with warn_on_panic=1, i.e. will never get past the first WARN anyways.
On the topic of syzkaller, we should get them to test with
CONFIG_KVM_PROVE_MMUonce it's available.+1
Quoted 6 lines
Quoted 5 lines
Lastly, when an assertions fails multiple times, the stack traces in KVM are almost always identical, i.e. the full splat only needs to be captured once. And _if_ there is value in captruing information about the failed assert, a ratelimited
printk()is sufficient and less likely to rack up a large amount of collateral damage.
Quoted 5 lines
Quoted 2 lines
These are all good arguments and I think they apply to
KVM_MMU_WARN_ON()as well. Should we convert that to_ONCE()too?Already done in this patch :-) I didn't call it out because that warn also falls under the "runtime assertions" umbrella.
Doh! Indeed. I was expecting to see KVM_MMU_WARN_ON() change to KVM_MMU_WARN_ON_ONCE().
Sean Christopherson
maintainerPATCH 6/9 KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE enabled
In reply to Sean ChristophersonPromote the ASSERT(), which is quite dead code in KVM, into a KVM_BUG_ON() for KVM's sanity check that CR4.PAE=1 if the vCPU is in long mode when performing a walk of guest page tables. The sanity is quite cheap since neither EFER nor CR4.PAE requires a VMREAD, especially relative to the cost of walking the guest page tables.
More importantly, the sanity check would have prevented the true badness fixed by commit 112e66017bff ("KVM: nVMX: add missing consistency checks for CR0 and CR4"). The missed consistency check resulted in some versions of KVM corrupting the on-stack guest_walker structure due to KVM thinking there are 4/5 levels of page tables, but wiring up the MMU hooks to point at the paging32 implementation, which only allocates space for two levels of page tables in "struct guest_walker32".
Queue a page fault for injection if the assertion fails, as the sole caller, FNAME(gva_to_gpa), assumes that walker.fault contains sane info on a walk failure, i.e. avoid making the situation worse between the time the assertion fails and when KVM kicks the vCPU out to userspace (because the VM is bugged).
Move the check below the initialization of "pte_access" so that the aforementioned to-be-injected page fault doesn't consume uninitialized stack data. The information _shouldn't_ reach the guest or userspace, but there's zero downside to being paranoid in this case.
--- arch/x86/kvm/mmu/paging_tmpl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kvm/mmu/paging_tmpl.h +4 -1
@@ -338,7 +338,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, }#endif walker->max_level = walker->level; -ASSERT (!(is_long_mode (vcpu) && !is_pae (vcpu)));/* * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging
@@ -348,6 +347,10 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, nested_access = (have_ad ?PFERR_WRITE_MASK :0 ) |PFERR_USER_MASK ; pte_access = ~0 ; + +if (KVM_BUG_ON (is_long_mode (vcpu) && !is_pae (vcpu), vcpu->kvm)) + goto error; + ++walker->level; do {
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Re: [PATCH 6/9] KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE enabled
Quoted 14 lines · Sean Christopherson
Promote the
ASSERT(), which is quite dead code in KVM, into aKVM_BUG_ON()for KVM's sanity check that CR4.PAE=1 if the vCPU is in long mode when performing a walk of guest page tables. The sanity is quite cheap since neither EFER nor CR4.PAE requires a VMREAD, especially relative to the cost of walking the guest page tables.More importantly, the sanity check would have prevented the true badness fixed by commit
112e66017bff("KVM: nVMX: add missing consistency checks for CR0 and CR4"). The missed consistency check resulted in some versions of KVM corrupting the on-stackguest_walkerstructure due to KVM thinking there are 4/5 levels of page tables, but wiring up the MMU hooks to point at the paging32 implementation, which only allocates space for two levels of page tables in "structguest_walker32".
Quoted 2 lines
Queue a page fault for injection if the assertion fails, as the sole caller,
FNAME(gva_to_gpa), assumes that walker.fault contains sane info
FNAME(page_fault)->FNAME(walk_addr)->FNAME(walk_addr_generic) is another caller but I think the same reasoning here applies.
Quoted 27 lines
on a walk failure, i.e. avoid making the situation worse between the time the assertion fails and when KVM kicks the vCPU out to userspace (because the VM is bugged).
Move the check below the initialization of "
pte_access" so that the aforementioned to-be-injected page fault doesn't consume uninitialized stack data. The information _shouldn't_ reach the guest or userspace, but there's zero downside to being paranoid in this case.Signed-off-by Sean Christopherson <[email protected]>--- arch/x86/kvm/mmu/paging_tmpl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)arch/x86/kvm/mmu/paging_tmpl.h +0
-1@@ -338,7 +338,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, }#endif walker->max_level = walker->level; -ASSERT (!(is_long_mode (vcpu) && !is_pae (vcpu)));/* * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging
arch/x86/kvm/mmu/paging_tmpl.h static int FNAME(walk_addr_generic)(struct guest_walker *walker, · line 352
Quoted 6 lines
arch/x86/kvm/mmu/paging_tmpl.h +3
-0@@ -348,6 +347,10 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, nested_access = (have_ad ?PFERR_WRITE_MASK :0 ) |PFERR_USER_MASK ; pte_access = ~0 ; + +if (KVM_BUG_ON (is_long_mode (vcpu) && !is_pae (vcpu), vcpu->kvm)) + goto error;
This if() deserves a comment since it's queueing a page fault for what is likely a KVM bug. As a reader that'd be pretty jarring to see.
Quoted 7 lines
arch/x86/kvm/mmu/paging_tmpl.h +1
-0+ ++walker->level; do {Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerRe: [PATCH 6/9] KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE enabled
Quoted 15 lines · David Matlack
Quoted 14 lines · Sean Christopherson
Promote the
ASSERT(), which is quite dead code in KVM, into aKVM_BUG_ON()for KVM's sanity check that CR4.PAE=1 if the vCPU is in long mode when performing a walk of guest page tables. The sanity is quite cheap since neither EFER nor CR4.PAE requires a VMREAD, especially relative to the cost of walking the guest page tables.More importantly, the sanity check would have prevented the true badness fixed by commit
112e66017bff("KVM: nVMX: add missing consistency checks for CR0 and CR4"). The missed consistency check resulted in some versions of KVM corrupting the on-stackguest_walkerstructure due to KVM thinking there are 4/5 levels of page tables, but wiring up the MMU hooks to point at the paging32 implementation, which only allocates space for two levels of page tables in "structguest_walker32".
Quoted 5 lines
Quoted 2 lines
Queue a page fault for injection if the assertion fails, as the sole caller,
FNAME(gva_to_gpa), assumes that walker.fault contains sane infoFNAME(page_fault)->FNAME(walk_addr)->FNAME(walk_addr_generic) is another caller but I think the same reasoning here applies.
Huh. No idea what I was doing. Missed the super obvious use case... I'll make sure the call from walk_addr() does something not awful.
Quoted 29 lines
Quoted 29 lines
on a walk failure, i.e. avoid making the situation worse between the time the assertion fails and when KVM kicks the vCPU out to userspace (because the VM is bugged).
Move the check below the initialization of "
pte_access" so that the aforementioned to-be-injected page fault doesn't consume uninitialized stack data. The information _shouldn't_ reach the guest or userspace, but there's zero downside to being paranoid in this case.Signed-off-by Sean Christopherson <[email protected]>--- arch/x86/kvm/mmu/paging_tmpl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)arch/x86/kvm/mmu/paging_tmpl.h +0
-1@@ -338,7 +338,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, }#endif walker->max_level = walker->level; -ASSERT (!(is_long_mode (vcpu) && !is_pae (vcpu)));/* * FIXME: on Intel processors, loads of the PDPTE registers for PAE paging @@ -348,6 +347,10 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, nested_access = (have_ad ?PFERR_WRITE_MASK :0 ) |PFERR_USER_MASK ;
Quoted 7 lines
arch/x86/kvm/mmu/paging_tmpl.h static int FNAME(walk_addr_generic)(struct guest_walker *walker, · line 352
Quoted 4 lines
arch/x86/kvm/mmu/paging_tmpl.h +3
-0pte_access = ~0 ; + +if (KVM_BUG_ON (is_long_mode (vcpu) && !is_pae (vcpu), vcpu->kvm)) + goto error;This
if()deserves a comment since it's queueing a page fault for what is likely a KVM bug. As a reader that'd be pretty jarring to see.
Will add.
Sean Christopherson
maintainerPATCH 7/9 KVM: x86/mmu: Replace MMU_DEBUG with proper KVM_PROVE_MMU Kconfig
In reply to Sean ChristophersonReplace MMU_DEBUG, which requires manually modifying KVM to enable the macro, with a proper Kconfig, KVM_PROVE_MMU. Now that pgprintk() and rmap_printk() are gone, i.e. the macro guards only KVM_MMU_WARN_ON() and won't flood the kernel logs, enabling the option for debug kernels is both desirable and feasible.
--- arch/x86/kvm/Kconfig | 13 +++++++++++++ arch/x86/kvm/mmu/mmu.c | 4 ++-- arch/x86/kvm/mmu/mmu_internal.h | 4 +--- 3 files changed, 16 insertions(+), 5 deletions(-)
arch/x86/kvm/Kconfig +13 -0
@@ -139,6 +139,19 @@ config KVM_XEN If in doubt, say "N". +config KVM_PROVE_MMU + bool "Prove KVM MMU correctness" + depends on DEBUG_KERNEL + depends on KVM + depends on EXPERT + help + Enables runtime assertions in KVM's MMU that are too costly to enable + in anything remotely resembling a production environment, e.g. this + gates code that verifies a to-be-freed page table doesn't have any + present SPTEs. + + If in doubt, say "N". + config KVM_EXTERNAL_WRITE_TRACKING bool
arch/x86/kvm/mmu/mmu.c +2 -2
@@ -1686,7 +1686,7 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)return young; } -#ifdef MMU_DEBUG +#ifdef CONFIG_KVM_PROVE_MMU static int is_empty_shadow_page (u64 *spt) {u64 *pos;
@@ -1700,7 +1700,7 @@ static int is_empty_shadow_page(u64 *spt) }return 1 ; } -#endif +#endif /* CONFIG_KVM_PROVE_MMU */ /* * This value is the sum of all of the kvm instances's
arch/x86/kvm/mmu/mmu_internal.h +1 -3
@@ -6,9 +6,7 @@#include <linux/kvm_host.h> #include <asm/kvm_host.h> -#undef MMU_DEBUG - -#ifdef MMU_DEBUG +#ifdef CONFIG_KVM_PROVE_MMU #define KVM_MMU_WARN_ON (x) WARN_ON_ONCE(x)#else #define KVM_MMU_WARN_ON (x) do { } while (0)
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 8/9 KVM: x86/mmu: Plumb "struct kvm" all the way to pte_list_remove()
In reply to Sean ChristophersonFrom: Mingwei Zhang <[email protected]>
Plumb "struct kvm" all the way to pte_list_remove() to allow the usage of KVM_BUG() and/or KVM_BUG_ON(). This will allow killing only the offending VM instead of doing BUG() if the kernel is built with CONFIG_BUG_ON_DATA_CORRUPTION=n, i.e. does NOT want to BUG() if KVM's data structures (rmaps) appear to be corrupted.
--- arch/x86/kvm/mmu/mmu.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
arch/x86/kvm/mmu/mmu.c +18 -15
@@ -962,7 +962,8 @@ static int pte_list_add(struct kvm_mmu_memory_cache *cache, u64 *spte,return count; } -static void pte_list_desc_remove_entry (struct kvm_rmap_head *rmap_head, +static void pte_list_desc_remove_entry (struct kvm *kvm, +struct kvm_rmap_head *rmap_head,struct pte_list_desc *desc,int i) {struct pte_list_desc *head_desc = (struct pte_list_desc *)(rmap_head->val & ~1ul );
@@ -998,7 +999,8 @@ static void pte_list_desc_remove_entry(struct kvm_rmap_head *rmap_head,mmu_free_pte_list_desc (head_desc); } -static void pte_list_remove (u64 *spte,struct kvm_rmap_head *rmap_head) +static void pte_list_remove (struct kvm *kvm,u64 *spte, +struct kvm_rmap_head *rmap_head) {struct pte_list_desc *desc;int i;
@@ -1017,7 +1019,8 @@ static void pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head)while (desc) {for (i =0 ; i < desc->spte_count; ++i) {if (desc->sptes[i] == spte) { -pte_list_desc_remove_entry (rmap_head, desc, i); +pte_list_desc_remove_entry (kvm, rmap_head, + desc, i);return ; } }
@@ -1032,7 +1035,7 @@ static void kvm_zap_one_rmap_spte(struct kvm *kvm, struct kvm_rmap_head *rmap_head, u64 *sptep) {mmu_spte_clear_track_bits (kvm ,sptep ); -pte_list_remove (sptep, rmap_head); +pte_list_remove (kvm, sptep, rmap_head); }/* Return true if at least one SPTE was zapped, false otherwise */
@@ -1107,7 +1110,7 @@ static void rmap_remove(struct kvm *kvm, u64 *spte) slot =__gfn_to_memslot (slots, gfn); rmap_head =gfn_to_rmap (gfn, sp->role.level, slot); -pte_list_remove (spte, rmap_head); +pte_list_remove (kvm, spte, rmap_head); }/*
@@ -1751,16 +1754,16 @@ static void mmu_page_add_parent_pte(struct kvm_mmu_memory_cache *cache,pte_list_add (cache, parent_pte, &sp->parent_ptes); } -static void mmu_page_remove_parent_pte (struct kvm_mmu_page *sp, +static void mmu_page_remove_parent_pte (struct kvm *kvm,struct kvm_mmu_page *sp,u64 *parent_pte) { -pte_list_remove (parent_pte, &sp->parent_ptes); +pte_list_remove (kvm, parent_pte, &sp->parent_ptes); } -static void drop_parent_pte (struct kvm_mmu_page *sp, +static void drop_parent_pte (struct kvm *kvm,struct kvm_mmu_page *sp,u64 *parent_pte) { -mmu_page_remove_parent_pte (sp, parent_pte); +mmu_page_remove_parent_pte (kvm, sp, parent_pte);mmu_spte_clear_no_track (parent_pte); }
@@ -2475,7 +2478,7 @@ static void validate_direct_spte(struct kvm_vcpu *vcpu, u64 *sptep,if (child->role.access == direct_access)return ; -drop_parent_pte (child, sptep); +drop_parent_pte (vcpu->kvm, child, sptep);kvm_flush_remote_tlbs_sptep (vcpu->kvm, sptep); } }
@@ -2493,7 +2496,7 @@ static int mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp,drop_spte (kvm, spte); }else { child =spte_to_child_sp (pte); -drop_parent_pte (child, spte); +drop_parent_pte (kvm, child, spte);/* * Recursively zap nested TDP SPs, parentless SPs are
@@ -2524,13 +2527,13 @@ static int kvm_mmu_page_unlink_children(struct kvm *kvm,return zapped; } -static void kvm_mmu_unlink_parents (struct kvm_mmu_page *sp) +static void kvm_mmu_unlink_parents (struct kvm *kvm,struct kvm_mmu_page *sp) {u64 *sptep;struct rmap_iterator iter;while ((sptep =rmap_get_first (&sp->parent_ptes, &iter))) -drop_parent_pte (sp, sptep); +drop_parent_pte (kvm, sp, sptep); } static int mmu_zap_unsync_children(struct kvm *kvm,
@@ -2569,7 +2572,7 @@ static bool __kvm_mmu_prepare_zap_page(struct kvm *kvm, ++kvm->stat.mmu_shadow_zapped; *nr_zapped =mmu_zap_unsync_children (kvm, sp, invalid_list); *nr_zapped +=kvm_mmu_page_unlink_children (kvm, sp, invalid_list); -kvm_mmu_unlink_parents (sp); +kvm_mmu_unlink_parents (kvm, sp);/* Zapping children means active_mmu_pages has become unstable. */ list_unstable = *nr_zapped;
@@ -2927,7 +2930,7 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, struct kvm_memory_slot *slot,u64 pte = *sptep; child =spte_to_child_sp (pte); -drop_parent_pte (child, sptep); +drop_parent_pte (vcpu->kvm, child, sptep); flush = true; }else if (pfn !=spte_to_pfn (*sptep)) {drop_spte (vcpu->kvm, sptep);
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Sean Christopherson
maintainerPATCH 9/9 KVM: x86/mmu: BUG() in rmap helpers iff CONFIG_BUG_ON_DATA_CORRUPTION=y
In reply to Sean ChristophersonIntroduce KVM_BUG_ON_DATA_CORRUPTION() and use it in the low-level rmap helpers to convert the existing BUG()s to WARN_ON_ONCE() when the kernel is built with CONFIG_BUG_ON_DATA_CORRUPTION=n, i.e. does NOT want to BUG() on corruption of host kernel data structures. Environments that don't have infrastructure to automatically capture crash dumps, i.e. aren't likely to enable CONFIG_BUG_ON_DATA_CORRUPTION=y, are typically better served overall by WARN-and-continue behavior (for the kernel, the VM is dead regardless), as a BUG() while holding mmu_lock all but guarantees the _best_ case scenario is a panic().
Make the BUG()s conditional instead of removing/replacing them entirely as there's a non-zero chance (though by no means a guarantee) that the damage isn't contained to the target VM, e.g. if no rmap is found for a SPTE then KVM may be double-zapping the SPTE, i.e. has already freed the memory the SPTE pointed at and thus KVM is reading/writing memory that KVM no longer owns.
--- arch/x86/kvm/mmu/mmu.c | 21 ++++++++++----------- include/linux/kvm_host.h | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-)
arch/x86/kvm/mmu/mmu.c +10 -11
@@ -974,7 +974,7 @@ static void pte_list_desc_remove_entry(struct kvm *kvm,* when adding an entry and the previous head is full, and heads are * removed (this flow) when they become empty. */ -BUG_ON (j <0 ); +KVM_BUG_ON_DATA_CORRUPTION (j <0 , kvm);/* * Replace the to-be-freed SPTE with the last valid entry from the head
@@ -1005,14 +1005,13 @@ static void pte_list_remove(struct kvm *kvm, u64 *spte,struct pte_list_desc *desc;int i; -if (!rmap_head->val) { -pr_err ("%s: %p 0->BUG\n" , __func__, spte); -BUG (); - }else if (!(rmap_head->val &1 )) { -if ((u64 *)rmap_head->val != spte) { -pr_err ("%s: %p 1->BUG\n" , __func__, spte); -BUG (); - } +if (KVM_BUG_ON_DATA_CORRUPTION (!rmap_head->val, kvm)) +return ; + +if (!(rmap_head->val &1 )) { +if (KVM_BUG_ON_DATA_CORRUPTION ((u64 *)rmap_head->val != spte, kvm)) +return ; + rmap_head->val =0 ; }else { desc = (struct pte_list_desc *)(rmap_head->val & ~1ul );
@@ -1026,8 +1025,8 @@ static void pte_list_remove(struct kvm *kvm, u64 *spte, } desc = desc->more; } -pr_err ("%s: %p many->many\n" , __func__, spte); -BUG (); + +KVM_BUG_ON_DATA_CORRUPTION (true, kvm); } }
include/linux/kvm_host.h +19 -0
@@ -864,6 +864,25 @@ static inline void kvm_vm_bugged(struct kvm *kvm)unlikely (__ret); \ }) +/* +* Note, "data corruption" refers to corruption of host kernel data structures, +* not guest data. Guest data corruption, suspected or confirmed, that is tied +* and contained to a single VM should *never* BUG() and potentially panic the +* host, i.e. use this variant of KVM_BUG() if and only if a KVM data structure +* is corrupted and that corruption can have a cascading effect to other parts +* of the hosts and/or to other VMs. +*/ +#define KVM_BUG_ON_DATA_CORRUPTION (cond, kvm) \ +({ \ + bool __ret = !!(cond); \ + \ + if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) \ + BUG_ON(__ret); \ + else if (WARN_ON_ONCE(__ret && !(kvm)->vm_bugged)) \ + kvm_vm_bugged(kvm); \ + unlikely(__ret); \ +}) +static inline void kvm_vcpu_srcu_read_lock (struct kvm_vcpu *vcpu) {#ifdef CONFIG_PROVE_RCU
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
Re: [PATCH 9/9] KVM: x86/mmu: BUG() in rmap helpers iff CONFIG_BUG_ON_DATA_CORRUPTION=y
Quoted 17 lines · Sean Christopherson
Introduce
KVM_BUG_ON_DATA_CORRUPTION()and use it in the low-level rmap helpers to convert the existing BUG()s toWARN_ON_ONCE()when the kernel is built withCONFIG_BUG_ON_DATA_CORRUPTION=n, i.e. does NOT want toBUG()on corruption of host kernel data structures. Environments that don't have infrastructure to automatically capture crash dumps, i.e. aren't likely to enableCONFIG_BUG_ON_DATA_CORRUPTION=y, are typically better served overall by WARN-and-continue behavior (for the kernel, the VM is dead regardless), as aBUG()while holdingmmu_lockall but guarantees the _best_ case scenario is apanic().Make the BUG()s conditional instead of removing/replacing them entirely as there's a non-zero chance (though by no means a guarantee) that the damage isn't contained to the target VM, e.g. if no rmap is found for a SPTE then KVM may be double-zapping the SPTE, i.e. has already freed the memory the SPTE pointed at and thus KVM is reading/writing memory that KVM no longer owns.
Quoted 5 lines
Suggested-by Mingwei Zhang <[email protected]>Cc David Matlack <[email protected]>Cc Jim Mattson <[email protected]>Signed-off-by Sean Christopherson <[email protected]>
Quoted 9 lines
include/linux/kvm_host.h +9
-0+/* +* Note, "data corruption" refers to corruption of host kernel data structures, +* not guest data. Guest data corruption, suspected or confirmed, that is tied +* and contained to a single VM should *never* BUG() and potentially panic the +* host, i.e. use this variant of KVM_BUG() if and only if a KVM data structure +* is corrupted and that corruption can have a cascading effect to other parts +* of the hosts and/or to other VMs. +*/ +#define KVM_BUG_ON_DATA_CORRUPTION (cond, kvm) \
include/linux/kvm_host.h static inline void kvm_vm_bugged(struct kvm *kvm) · line 885
Quoted 10 lines
include/linux/kvm_host.h +10
-0+({ \ +bool __ret = !!(cond); \ + \ +if (IS_ENABLED (CONFIG_BUG_ON_DATA_CORRUPTION )) \ +BUG_ON (__ret); \ +else if (WARN_ON_ONCE (__ret && !(kvm)->vm_bugged)) \ +kvm_vm_bugged (kvm); \ +unlikely (__ret); \ +}) +
Previously, my concern was that people might abuse this feature by generating lots of KVM_BUG_ON_DATA_CORRUPTION() in the code, with the execuse that "hey, it is not a BUG_ON(), just turn off CONFIG_BUG_ON_DATA_CORRUPTION." In reality, especially in production, no one will take that risk by completely turning off the KCONFIG, so KVM_BUG_ON_DATA_CORRUPTION() is still a BUG_ON() but with people having execuses to add more.
Later I realize that this worry is purely based on hypothesis, so I choose to not worry about that anymore. Overall, making BUG_ON() tunable is still a very good progress. Thank you and David for the help.
-Mingwei
Quoted 6 lines
static inline void
kvm_vcpu_srcu_read_lock(struct kvm_vcpu *vcpu){
#ifdefCONFIG_PROVE_RCUSignature · 1 line
2.40.1.606.ga4b1b128d6-goog