Re: [PATCH] KVM: arm/arm64: kvm_arch_destroy_vm cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 01, 2017 at 09:09:19AM +0100, Christoffer Dall wrote:
> Hi Drew,
> 
> On Mon, Nov 27, 2017 at 07:17:18PM +0100, Andrew Jones wrote:
> > Recently commit b2c9a85dd75a ("KVM: arm/arm64: vgic: Move
> > kvm_vgic_destroy call around") caught my eye. When I looked closer I
> > saw that while it made the code saner, it wasn't changing anything.
> > kvm_for_each_vcpu() checks for NULL kvm->vcpus[i], so there wasn't
> > a NULL dereference being fixed, and because kvm_vgic_vcpu_destroy()
> > was called by kvm_arch_vcpu_free() it was still getting called, just
> > not by kvm_vgic_destroy() as intended. But now the call from
> > kvm_arch_vcpu_free() is redundant, and while currently harmless, it
> > should be removed in case kvm_vgic_vcpu_destroy() were ever to
> > want to reference vgic state, as kvm_vgic_destroy() now comes before
> > kvm_arch_vcpu_free(). Additionally the other architectures set
> > kvm->online_vcpus to zero after freeing them. We might as well do
> > that for ARM too.
> 
> Could this commit message be rewritten to:
> 
>   kvm_vgic_vcpu_destroy already gets called from kvm_vgic_destroy for
>   each vcpu, so we don't have to call it from kvm_arch_vcpu_free.
> 
>   Additionally the other architectures set kvm->online_vcpus to zero
>   after freeing them. We might as well do that for ARM too.

Sure, I don't mind you removing the '-v' (verbose) from it. Should I
respin? Or is that something you don't mind doing while applying?

Thanks,
drew

> 
> ?
> 
> Thanks,
> -Christoffer
> 
> 
> 
> > 
> > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
> > ---
> >  virt/kvm/arm/arm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> > index a6524ff27de4..c5bc79c4ccf7 100644
> > --- a/virt/kvm/arm/arm.c
> > +++ b/virt/kvm/arm/arm.c
> > @@ -188,6 +188,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
> >  			kvm->vcpus[i] = NULL;
> >  		}
> >  	}
> > +	atomic_set(&kvm->online_vcpus, 0);
> >  }
> >  
> >  int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> > @@ -296,7 +297,6 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
> >  {
> >  	kvm_mmu_free_memory_caches(vcpu);
> >  	kvm_timer_vcpu_terminate(vcpu);
> > -	kvm_vgic_vcpu_destroy(vcpu);
> >  	kvm_pmu_vcpu_destroy(vcpu);
> >  	kvm_vcpu_uninit(vcpu);
> >  	kmem_cache_free(kvm_vcpu_cache, vcpu);
> > -- 
> > 2.13.6
> > 
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux