Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86: Convert all runtime WARNs to ONCE variants
Date: Thu, 22 Oct 2026 15:05:20 -0700	[thread overview]
Message-ID: <atqIoDulcBpCyqFL@google.com> (raw)
In-Reply-To: <sashiko-outbox-182093@kernel.org>

On Thu, Oct 22, 2026, sashiko-bot@kernel.org wrote:
> > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
> > index 44dad106fad19..945efc1cfaea1 100644
> > --- a/arch/x86/kvm/mmu/tdp_mmu.c
> > +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> > @@ -1368,7 +1368,7 @@ static bool __kvm_tdp_mmu_age_gfn_range(struct kvm *kvm,
> >  	 * this helper must NOT be used to unmap GFNs, as it processes only
> >  	 * valid roots!
> >  	 */
> > -	WARN_ON(types & ~KVM_VALID_ROOTS);
> > +	WARN_ON_ONCE(types & ~KVM_VALID_ROOTS);
> >  
> >  	guard(rcu)();
> >  	for_each_tdp_mmu_root_rcu(kvm, root, range->slot->as_id, types) {
> 
> [Severity: Medium]
> Should the WARN_ON() in kvm_mmu_uninit_tdp_mmu() in arch/x86/kvm/mmu/tdp_mmu.c
> also be converted to WARN_ON_ONCE()?
> 
> arch/x86/kvm/mmu/tdp_mmu.c:kvm_mmu_uninit_tdp_mmu() {
> 	kvm_tdp_mmu_invalidate_roots(kvm, KVM_VALID_ROOTS);
> 	kvm_tdp_mmu_zap_invalidated_roots(kvm, false);
> 
> #ifdef CONFIG_KVM_PROVE_MMU
> 	KVM_MMU_WARN_ON(atomic64_read(&kvm->arch.tdp_mmu_pages));
> #endif
> 	WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
>     ...
> }
> 
> Despite having uninit in its name, kvm_mmu_uninit_tdp_mmu() is not a
> module-exit helper. When tdp_mmu_enabled is true, it is invoked per VM at
> runtime during VM teardown (as well as on the error cleanup path of
> kvm_arch_init_vm()):
> 
> kvm_arch_destroy_vm() (in arch/x86/kvm/x86.c)
>   -> kvm_mmu_uninit_vm() (in arch/x86/kvm/mmu/mmu.c)
>        -> kvm_mmu_uninit_tdp_mmu()
> 
> Other VM and vCPU teardown checks, such as sev_vm_destroy() and
> free_loaded_vmcs(), were converted to WARN_ON_ONCE() in this patch, so
> leaving this check unconverted allows repeated warnings on every VM
> destruction if kvm->arch.tdp_mmu_roots is non-empty.

Gah, yes.  For some reason I was thinking that was a module exit function.

  reply	other threads:[~2026-10-22 22:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 21:55 [PATCH 0/2] KVM: x86: Convert all runtime WARNs to ONCE Sean Christopherson
2026-10-22 21:55 ` [PATCH 1/2] KVM: x86: Convert WARN_ON(preemptible()) to lockdep assertion Sean Christopherson
2026-10-22 21:55 ` [PATCH 2/2] KVM: x86: Convert all runtime WARNs to ONCE variants Sean Christopherson
2026-10-22 22:02   ` sashiko-bot
2026-10-22 22:05     ` Sean Christopherson [this message]
2026-10-23 14:59 ` [PATCH 0/2] KVM: x86: Convert all runtime WARNs to ONCE Yosry Ahmed
2026-10-26 17:35   ` Sean Christopherson
2026-10-26 18:04     ` Yosry Ahmed
2026-10-26 18:38       ` Vitaly Kuznetsov
2026-10-26 18:59         ` Sean Christopherson

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=atqIoDulcBpCyqFL@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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