On Sun, Jul 5, 2015 at 5:13 PM, Qiaowei Ren <qiaowei.ren@intel.com> wrote:
One RFC in
https://www.redhat.com/archives/libvir-list/2015-June/msg01509.html

CMT (Cache Monitoring Technology) can be used to measure the
usage of cache by VM running on the host. This patch will
extend the bulk stats API (virDomainListGetStats) to add this
field. Applications based on libvirt can use this API to achieve
cache usage of VM. Because CMT implementation in Linux kernel
is based on perf mechanism, this patch will enable perf event
for CMT when VM is created and disable it when VM is destroyed.


Hi Ren,
One query wrt this implementation. I see you make a perf ioctl to gather CMT stats each time the stats API is invoked.
If the CMT stats are exposed by a hardware counter, then this implies logging on a per-cpu (or per-socket ???) basis.
This also implies that the value read will vary as the CPU (or socket) on which it is being called changes.

Now, with this background, if we need real-world stats on a VM, we need this perf ioctl executed on all CPUs/ sockets on which the VM ran. Also, once done, we will need to aggregate results from each of these sources.

In this implementation, I am missing this -- there seems no control over which physical CPU the libvirt worker thread will run and collect the perf data from. Data collected from this implementation might not accurately model the system state.
I _think_ libvirt currently has no way of directing a worker thread to collect stats from a given CPU -- if we do, I would be happy to learn about it :)

Regards,
Prerna