Re: [RFC PATCH 1/3] kvm: arm/arm64: vgic-vits: separate vgic_its_free_list() function

Christoffer Dall
2017-09-13T19:11:02Z

On Tue, Sep 12, 2017 at 12:08:27PM +0200, Auger Eric wrote:
> Hi Wanghaibin,
>
> On 12/09/2017 10:50, wanghaibin wrote:
> > On 2017/9/6 21:05, wanghaibin wrote:
> >
> >> We slightly refactor vgic_its_destroy, separate vgic_its_free_list()
> >> function for later patch invoke.
> >>
> >> The patch also take a functional change. If the its->device_list.next
> >> is NULL, we still should free the its.
> >
> >
> > Hi, Eric
> >
> > Does this its->device_list.next is NULL can happened ?
>
> I don't get why we have this check.
>
> The kvm device is removed by kvm_destroy_devices which loops on all
> devices added to kvm->devices. kvm_ioctl_create_device only adds the
> device to kvm_devices once the lists have been initialized (in
> vgic_create_its). So it looks safe to me without the check.
>
> André, do we miss something?

Eric, I think I agree with you, and even if we need to check for
initialization, we should have a separate flag instead of piggy-backing
on the list_head.

Thanks,
-Christoffer