<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 Friday, 10 February 2017 at 10:19 PM, 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 Fri, Feb 10, 2017 at 02:42:04PM +0800, Eli Qiao wrote:</div><blockquote type="cite"><div><div>Addressed comment from v3 -> v4:</div><div><br></div><div>Daniel & Marcelo:</div><div>       * Added concurrence support</div><div><br></div><div>Addressed comment from v2 -> v3:</div><div><br></div><div>Daniel:</div><div>      * Fixed coding style, passed `make check` and `make syntax-check`</div><div><br></div><div>      * Variables renaming and move from header file to c file.</div><div><br></div><div>      * For locking/mutex support, no progress.</div><div><br></div><div>      There are some discussion from mailing list, but I can not find a better</div><div>      way to add locking support without performance impact.</div><div><br></div><div>      I'll explain the process and please help to advice what shoud we do.</div><div><br></div><div>      VM create:</div><div>      1) Get the cache left value on each bank of the host. This should be</div><div>         shared amount all VMs.</div><div>      2) Calculate the schemata on the bank based on all created resctrl</div><div>         domain's schemata</div><div>      3) Calculate the default schemata by scaning all domain's schemata.</div><div>      4) Flush default schemata to /sys/fs/resctrl/schemata</div><div><br></div><div>      VM destroy:</div><div>      1) Remove the resctrl domain of that VM</div><div>      2) Recalculate default schemata</div><div>      3) Flush default schemata to /sys/fs/resctrl/schemata</div><div><br></div><div>      The key point is that all VMs shares /sys/fs/resctrl/schemata, and</div><div>      when a VM create a resctrl domain, the schemata of that VM depends on</div><div>      the default schemata and all other exsited schematas. So a global</div><div>      mutex is reqired.</div><div><br></div><div>      Before calculate a schemata or update default schemata, libvirt</div><div>      should gain this global mutex.</div><div><br></div><div>      I will try to think more about how to support this gracefully in next</div><div>      patch set.</div><div><br></div><div>Marcelo:</div><div>      * Added vcpu support for cachetune, this will allow user to define which</div><div>        vcpu using which cache allocation bank.</div><div><br></div><div>        <cachetune id='0' host_id=0 size='3072' unit='KiB' vcpus='0,1'/></div><div><br></div><div>        vcpus is a cpumap, the vcpu pids will be added to tasks file</div></div></blockquote><div><br></div><div>Working as expected.</div><div><br></div><blockquote type="cite"><div><div>      * Added cdp compatible, user can specify l3 cache even host enable cdp.</div><div>        See patch 8.</div><div>        On a cdp enabled host, specify l3code/l3data by</div><div><br></div><div>        <cachetune id='0' host_id='0' type='l3' size='3072' unit='KiB'/></div><div><br></div><div>        This will create a schemata like:</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></div></span></blockquote><div><br></div><div>Libvirt will not aware this after it starts running, so we should not allow operate /sys/fs/.</div><div><br></div><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><div><br></div><div> </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><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></div></span></blockquote><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>
                    <br>
                </div>