-- 
Best regards 
Eli

天涯无处不重逢
a leaf duckweed belongs to the sea, where not to meet in life 
Sent with Sparrow

On Wednesday, 22 February 2017 at 7:36 AM, Marcelo Tosatti wrote:

On Tue, Feb 21, 2017 at 10:25:13AM +0800, Eli Qiao wrote:


--
Best regards
Eli

天涯无处不重逢
a leaf duckweed belongs to the sea, where not to meet in life



On Tuesday, 21 February 2017 at 4:54 AM, Marcelo Tosatti wrote:

Can you explain how the resource leak can happen?
1. libvirtd creates a qemu process and create a resctrl directory for it, add it’s pids to tasks
2. stop libvirtd or it’s down.
3. qemu process, and tasks file is empty now.
4. libvirt restart, well, the resctrl directory should be deleted as qemu process gone.

So there are two problems:

P1) If libvirtd is not restarted and guest VM is poweredoff, then
CAT reservation leaks.

Ideally QEMU should free the resources.

yes, but qemu doesn’t care about CAT stuff. 
How does libvirt deal with this for other resources?

I tested with libvirt, if qemu process exited while libvirtd is not running, next time when libvirtd restart, it will do something cleanup like it will call qemuprocessexit(), so libvirt can aware qemu process exited. 

P2) Libvirt restart.

Yes.  
Please remove resctrlfs directory only for
libvirt owned VMs (say if the directory name matches
the VM UUID), and not for all directories in resctrlfs
Yep, I ‘v done the patch update yesterday, and will send out new version today. 
(should not change resctrlfs directories which libvirt
does not own).

Thanks for the advices.