<div>
                    <br>
                </div>
                <div><div><br></div><div>-- </div><div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Best regards </div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Eli</div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br></div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">天涯无处不重逢</div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><span style="color: rgb(0, 0, 0); font-family: "Microsoft YaHei", Verdana, arial, sans-serif;">a leaf duckweed belongs to the sea, where not to meet in life </span></div></div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Wednesday, 22 February 2017 at 7:36 AM, Marcelo Tosatti wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>On Tue, Feb 21, 2017 at 10:25:13AM +0800, Eli Qiao wrote:</div><blockquote type="cite"><div><div><br></div><div><br></div><div>--  </div><div>Best regards  </div><div>Eli</div><div><br></div><div>天涯无处不重逢</div><div>a leaf duckweed belongs to the sea, where not to meet in life  </div><div><br></div><div>Sent with Sparrow (<a href="http://www.sparrowmailapp.com/?sig">http://www.sparrowmailapp.com/?sig</a>)</div><div><br></div><div><br></div><div>On Tuesday, 21 February 2017 at 4:54 AM, Marcelo Tosatti wrote:</div><div><br></div><blockquote type="cite"><div><div>Can you explain how the resource leak can happen?</div><div> </div></div></blockquote><div>1. libvirtd creates a qemu process and create a resctrl directory for it, add it’s pids to tasks</div><div>2. stop libvirtd or it’s down.</div><div>3. qemu process, and tasks file is empty now.</div><div>4. libvirt restart, well, the resctrl directory should be deleted as qemu process gone.</div></div></blockquote><div><br></div><div>So there are two problems: </div><div><br></div><div>P1) If libvirtd is not restarted and guest VM is poweredoff, then </div><div>CAT reservation leaks.</div><div><br></div><div>Ideally QEMU should free the resources.</div><div><br></div></div></div></span></blockquote><div>yes, but qemu doesn’t care about CAT stuff. </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div></div><div>How does libvirt deal with this for other resources?</div></div></div></span></blockquote><div><br></div><div>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. </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div><br></div><div>P2) Libvirt restart.</div><div><br></div></div></div></span></blockquote><div>Yes.  </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div></div><div>Please remove resctrlfs directory only for </div><div>libvirt owned VMs (say if the directory name matches</div><div>the VM UUID), and not for all directories in resctrlfs</div></div></div></span></blockquote><div>Yep, I ‘v done the patch update yesterday, and will send out new version today. </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div>(should not change resctrlfs directories which libvirt</div><div>does not own).</div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div><div>Thanks for the advices.</div>