On Friday, 10 February 2017 at 10:19 PM, Marcelo Tosatti wrote:
On Fri, Feb 10, 2017 at 02:42:04PM +0800, Eli Qiao wrote:Addressed comment from v3 -> v4:Daniel & Marcelo:* Added concurrence supportAddressed comment from v2 -> v3:Daniel:* Fixed coding style, passed `make check` and `make syntax-check`* Variables renaming and move from header file to c file.* For locking/mutex support, no progress.There are some discussion from mailing list, but I can not find a betterway to add locking support without performance impact.I'll explain the process and please help to advice what shoud we do.VM create:1) Get the cache left value on each bank of the host. This should beshared amount all VMs.2) Calculate the schemata on the bank based on all created resctrldomain's schemata3) Calculate the default schemata by scaning all domain's schemata.4) Flush default schemata to /sys/fs/resctrl/schemataVM destroy:1) Remove the resctrl domain of that VM2) Recalculate default schemata3) Flush default schemata to /sys/fs/resctrl/schemataThe key point is that all VMs shares /sys/fs/resctrl/schemata, andwhen a VM create a resctrl domain, the schemata of that VM depends onthe default schemata and all other exsited schematas. So a globalmutex is reqired.Before calculate a schemata or update default schemata, libvirtshould gain this global mutex.I will try to think more about how to support this gracefully in nextpatch set.Marcelo:* Added vcpu support for cachetune, this will allow user to define whichvcpu using which cache allocation bank.<cachetune id='0' host_id=0 size='3072' unit='KiB' vcpus='0,1'/>vcpus is a cpumap, the vcpu pids will be added to tasks fileWorking as expected.* Added cdp compatible, user can specify l3 cache even host enable cdp.See patch 8.On a cdp enabled host, specify l3code/l3data by<cachetune id='0' host_id='0' type='l3' size='3072' unit='KiB'/>This will create a schemata like:L3data:0=0xff00;...L3code:0=0xff00;...* Would you please help to test if the functions work.Setting up CDP machine.Unrelated:Found a bug:The code should scan for all directories in resctrlfs,and then find free CBM space from that:free_cbm_space = ~(resctrldir1.CBM_bits &resctrldir2.CBM_bits &...resctrldirN.CBM_bits)For all resctrlfs directories.The bug is as follows:Create a directory in resctrlfs by hand:# mkdir newres
# cd newres# echo "L3:0=3;1=f0000" > schemata# virsh start guest# cd ../b4c270b5-e0f9-4106-a446-69032872ed7e# cat schemataL3:0=3;1=f0000That is, it is using the same CBM space as the "newres"reservation.