public inbox for kvmarm@lists.cs.columbia.edu
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: wanghaibin <wanghaibin.wang@huawei.com>
Cc: marc.zyngier@arm.com, cdall@linaro.org,
	kvmarm@lists.cs.columbia.edu, wu.wubin@huawei.com,
	andre.przywara@arm.com
Subject: Re: [RFC PATCH 1/3] kvm: arm/arm64: vgic-vits: separate vgic_its_free_list() function
Date: Tue, 12 Sep 2017 12:08:27 +0200	[thread overview]
Message-ID: <325be1c0-48cf-444f-8ca2-263cd8ee3b4f@redhat.com> (raw)
In-Reply-To: <59B79FDA.7090901@huawei.com>

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?

Thanks

Eric

> 
> Thanks
> 
>> Honestly, I can't understand How does the its->device_list.next is NULL
>> happened at this moment.
>>
>> Signed-off-by: wanghaibin <wanghaibin.wang@huawei.com>
>> ---
>>  virt/kvm/arm/vgic/vgic-its.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
>> index aa6b68d..25d614f 100644
>> --- a/virt/kvm/arm/vgic/vgic-its.c
>> +++ b/virt/kvm/arm/vgic/vgic-its.c
>> @@ -1624,10 +1624,8 @@ static void vgic_its_free_device(struct kvm *kvm, struct its_device *dev)
>>  	kfree(dev);
>>  }
>>  
>> -static void vgic_its_destroy(struct kvm_device *kvm_dev)
>> +static void vgic_its_free_list(struct kvm *kvm, struct vgic_its *its)
>>  {
>> -	struct kvm *kvm = kvm_dev->kvm;
>> -	struct vgic_its *its = kvm_dev->private;
>>  	struct list_head *cur, *temp;
>>  
>>  	/*
>> @@ -1653,7 +1651,14 @@ static void vgic_its_destroy(struct kvm_device *kvm_dev)
>>  		kfree(coll);
>>  	}
>>  	mutex_unlock(&its->its_lock);
>> +}
>> +
>> +static void vgic_its_destroy(struct kvm_device *kvm_dev)
>> +{
>> +	struct kvm *kvm = kvm_dev->kvm;
>> +	struct vgic_its *its = kvm_dev->private;
>>  
>> +	vgic_its_free_list(kvm, its);
>>  	kfree(its);
>>  }
>>  
> 
> 
> 
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
> 

  reply	other threads:[~2017-09-12 10:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 13:05 [RFC PATCH 0/3] fix migrate failed when vm is in booting wanghaibin
2017-09-06 13:05 ` [RFC PATCH 1/3] kvm: arm/arm64: vgic-vits: separate vgic_its_free_list() function wanghaibin
2017-09-12  8:50   ` wanghaibin
2017-09-12 10:08     ` Auger Eric [this message]
2017-09-13 19:13       ` Christoffer Dall
2017-09-13 19:14   ` Christoffer Dall
2017-09-16  1:59     ` wanghaibin
2017-09-16 22:17       ` Christoffer Dall
2017-09-06 13:05 ` [RFC PATCH 2/3] kvm: arm/arm64: vgic-vits: free its resource when vm reboot/reset wanghaibin
2017-09-06 16:20   ` Auger Eric
2017-09-07  1:32     ` wanghaibin
2017-09-07 11:28       ` Auger Eric
2017-09-10 18:46         ` Auger Eric
2017-09-12 11:15           ` wanghaibin
2017-09-13  8:49             ` Auger Eric
2017-09-13 19:34   ` Christoffer Dall
2017-09-13 21:13     ` Auger Eric
2017-09-14  5:34       ` Christoffer Dall
2017-09-06 13:05 ` [RFC PATCH 3/3] kvm: arm/arm64: vgic-its: fix return value for restore wanghaibin
2017-09-06 15:18   ` Auger Eric
2017-09-13 20:02     ` Christoffer Dall
2017-09-13 21:25       ` Auger Eric
2017-09-14  5:35         ` Christoffer Dall
2017-09-13 20:04   ` Christoffer Dall
2017-09-14  8:30   ` Auger Eric
2017-09-16  2:02     ` wanghaibin
2017-09-20  1:57 ` [RFC PATCH 0/3] fix migrate failed when vm is in booting wanghaibin
2017-09-20  7:16   ` Auger Eric
2017-09-21 12:17     ` wanghaibin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=325be1c0-48cf-444f-8ca2-263cd8ee3b4f@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=andre.przywara@arm.com \
    --cc=cdall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=wu.wubin@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox