Re: [PATCH v4 kvmtool 07/12] Add PCI device passthrough using VFIO

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

 



Jean-Philippe Brucker <jean-philippe.brucker@xxxxxxx> writes:

> Hi Punit,
>
> On 05/03/18 15:11, Punit Agrawal wrote:
>>> +	devs = realloc(kvm->cfg.vfio_devices, sizeof(*dev) * (idx + 1));
>>> +	if (!devs) {
>>> +		ret = -ENOMEM;
>>> +		goto out_free_buf;
>>> +	}
>>> +
>>> +	kvm->cfg.vfio_devices = devs;
>> 
>> I noticed that vfio_devices never gets freed. I'm not sure if this needs
>> fixing as I noticed a similar pattern in virtio as well.
>
> I think kvmtool is pretty lax when it comes to freeing permanent objects,
> or cleaning up before dying. It often relies on the kernel to clean up on
> process exit. The downside is that finding runtime memory leaks with
> valgrind becomes a bit more difficult (on my current setup for example, I
> can see 1.4M still reachable). So it's not worth doing tree-wide, but I
> don't mind fixing this one.

Just to be clear, I wasn't suggesting for you to fix this issue
tree-wide. :)

> I think it's safe to free in vfio__exit.

It would be great if you can fix it for the patch though - considering
that all the other allocations are dealt with symmetrically, it'd be a
shame to leave this one out.

>
>> The previous patches in the series look fine. I'll have a look at the
>> rest in the next couple of days.
>
> Thanks!
> Jean



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux