Re: [PATCH 2/2] KVM: x86: Suppress WARNs on nested_run_pending after userspace exit
From: Sean Christopherson
Date: Thu Mar 12 2026 - 10:22:17 EST
On Wed, Mar 11, 2026, Yosry Ahmed wrote:
> On Wed, Mar 11, 2026 at 6:27 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> >
> > On Tue, Mar 10, 2026, Yosry Ahmed wrote:
> > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > > > index 879cdeb6adde..cad16c83dcff 100644
> > > > --- a/arch/x86/kvm/x86.c
> > > > +++ b/arch/x86/kvm/x86.c
> > > > @@ -12090,6 +12090,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
> > > > if (r <= 0)
> > > > goto out;
> > > >
> > > > + /*
> > > > + * If userspace may have modified vCPU state, mark nested_run_pending
> > > > + * as "untrusted" to avoid triggering false-positive WARNs.
> > > > + */
> > > > + if (vcpu->arch.nested_run_pending == KVM_NESTED_RUN_PENDING)
> > > > + vcpu->arch.nested_run_pending = KVM_NESTED_RUN_PENDING_UNTRUSTED;
> > > > +
> > >
> > > Why not inside kvm_x86_vcpu_pre_run()?
> >
> > That, is a very good question. /facepalm
Oh, I know why I put it here. I didn't want to change nested_run_pending if
kvm_x86_vcpu_pre_run() rejected KVM_RUN. But looking at this again, it doesn't
actually matter because for the "untrusted" state to matter, KVM must get past
kvm_x86_vcpu_pre_run() at some point.