On 19/11/19 09:49, Yang Weijiang wrote: > > +/* > + * all vcpus share the same SPPT, vcpu->arch.mmu->sppt_root points to same > + * SPPT root page, so any vcpu will do. > + */ > +static struct kvm_vcpu *kvm_spp_get_vcpu(struct kvm *kvm) > +{ > + struct kvm_vcpu *vcpu = NULL; > + int idx; Is this true? Perhaps you need one with VALID_PAGE(vcpu->arch.mmu->sppt_root) for kvm_spp_set_permission? Also, since vcpu->arch.mmu->sppt_root is the same for all vCPUs, perhaps it should be kvm->arch.sppt_root instead? If you can get rid of this function, it would be much better (but if you cannot, kvm_get_vcpu(kvm, 0) should give the same result). > > + if (npages > SUBPAGE_MAX_BITMAP) > + return -EFAULT; This is not needed here, the restriction only applies to the ioctl. Paolo