<div>
                    <br>
                </div>
                <div><div><br></div><div>-- </div><div>Eli Qiao</div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Wednesday, 15 February 2017 at 1:14 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 14, 2017 at 09:37:02AM +0100, Martin Kletzander wrote:</div><blockquote type="cite"><div><div>On Mon, Feb 13, 2017 at 04:09:13PM -0200, Marcelo Tosatti wrote:</div><blockquote type="cite"><div><div>On Mon, Feb 13, 2017 at 03:42:04PM +0800, Eli Qiao wrote:</div><blockquote type="cite"><div><blockquote type="cite"><div><blockquote type="cite"><div><div>L3data:0=0xff00;...</div><div>L3code:0=0xff00;...</div><div><br></div><div>* Would you please help to test if the functions work.</div></div></blockquote><div><br></div><div>Setting up CDP machine.</div><div><br></div><div>Unrelated:</div><div><br></div><div>Found a bug:</div><div><br></div><div>The code should scan for all directories in resctrlfs,</div><div>and then find free CBM space from that:</div><div><br></div><div><br></div><div>free_cbm_space = ~(resctrldir1.CBM_bits &</div><div>resctrldir2.CBM_bits &</div><div>...</div><div>resctrldirN.CBM_bits)</div><div><br></div><div>For all resctrlfs directories.</div><div><br></div><div>The bug is as follows:</div><div><br></div><div>Create a directory in resctrlfs by hand:</div><div><br></div><div># mkdir newres</div></div></blockquote><div><br></div><div>Libvirt will not aware this after it starts running, so we should not allow operate /sys/fs/.</div></div></blockquote><div><br></div><div>Are you saying that usage of the resctrlfs filesystem should not be</div><div>allowed after libvirt starts? I don't think this is correct.</div></div></blockquote><div><br></div><div>In some cases the only way to accomplish keeping consistency would be</div><div>saying that if you are using libvirt, you should not change anything</div><div>behind its back.  It would be really wrong in this case, mainly when you</div><div>need to set the allocation for other apps, especially when there is</div><div>nicely designed file that you can lock.</div><div><br></div><blockquote type="cite"><blockquote type="cite"><div>we will scan for all directors while the libvirt daemon begin running, and libvirt will remove exist directories if no tasks inside of it.</div></blockquote></blockquote><div><br></div><div>Definitely not.  What if someone wants to create another allocation?</div><div>They start by creating a directory, then libvirtd removes it before they</div><div>manage to add anything to tasks.</div></div></blockquote><div><br></div><div>If the other application is properly using the filesystem lock, then: </div><div><br></div><div>OTHER APP, CREATE PROCEDURE:</div><div><br></div><div>    1. grab fs lock.</div><div> 2. create directory.</div><div>     3. write schemata.</div><div>       4. write tasks.</div><div>  5. release fs lock</div><div><br></div><div>Any operation that writes to any file in resctrlfs will first grab </div><div>the lock. So the problem being discussed is handled.</div><div><br></div></div></div></span></blockquote><div>Sure, as long as the application can manage the schemata well. </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div></div><blockquote type="cite"><div><blockquote type="cite"><div><div><br></div><div><br></div><blockquote type="cite"><div><div><br></div><div><br></div><blockquote type="cite"><div><div># cd newres</div><div># echo "L3:0=3;1=f0000" > schemata</div><div># virsh start guest</div><div># cd ../b4c270b5-e0f9-4106-a446-69032872ed7e</div><div># cat schemata</div><div>L3:0=3;1=f0000</div><div><br></div><div>That is, it is using the same CBM space as the "newres"</div><div>reservation.</div></div></blockquote><div><br></div><div><br></div><div>As user create a new directory after libvirt running, it don’t notice newly created directory under /sys/fs/resctrl.</div><div><br></div><div>That will lead mess, this should be forbidden.</div></div></blockquote><div><br></div><div>Well, this means that only libvirt can use the resctrlfs filesystem.</div><div><br></div><div>This forbids other applications which require allocation</div><div>of CAT resources from being used.</div><div><br></div><div>Its simple to fix it: move the scanning of resctrlfs data from libvirt</div><div>initialization time to:</div><div><br></div><div>       - VM initialization time</div><div> and</div><div>      - virConnectGetCapabilities time</div><div><br></div><div>The second case is necessary to get updated free space information.</div></div></blockquote><div><br></div><div>Just VM initialization time could be enough as virConnectGetCapabilities</div><div>would just know the total and free size would be reported in an API (if</div><div>I rememer the discussion correctly)</div></div></blockquote><div><br></div><div>Ok so resctrlfs has to be rescanned in whatever location the</div><div>free size is reported to the user.</div></div></div></span></blockquote><div>Sure, will add this when adding cache free API. </div>
                 
                <div>
                    <br>
                </div>