On Wed, Sep 26, 2018 at 03:19:00PM +1000, David Gibson wrote: > On Fri, Sep 21, 2018 at 08:01:50PM +1000, Paul Mackerras wrote: > > +static void kvmhv_remove_nested(struct kvm_nested_guest *gp) > > +{ > > + struct kvm *kvm = gp->parent; > > + int lpid = gp->l1_lpid; > > + long ref; > > + > > + spin_lock(&kvm->mmu_lock); > > + if (gp == kvm->arch.nested_guests[lpid]) { > > + kvm->arch.nested_guests[lpid] = NULL; > > + while (--lpid >= 0 && !kvm->arch.nested_guests[lpid]) > > + ; > > This only looks correct of gp is the guest of KVM with the highest > l1_lpid. It's not obvious why that would have to be the case. Not obvious because not true. Good catch. :) Paul.