On Jul 6, 2015 14:49, Prerna wrote:
> On Sun, Jul 5, 2015 at 5:13 PM, Qiaowei Ren <qiaowei.ren(a)intel.com
> <mailto: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 :)
>
Prerna, thanks for your reply. I checked the CMT implementation in
kernel, and noticed that the series implement new ->count() of pmu
driver which can aggregate the results from each cpu if perf type is
PERF_TYPE_INTEL_CQM . The following is the link for the patch:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?i
d=bfe1fc d2688f557a6b6a88f59ea7619228728bd7
So I guess that this patch just need to set right perf type and "cpu=-1". Do
you
think this is ok?
Peter, according to your feedback about my RFC, I updated our implementation and submitted
this patch series. Could you help review them?
Thanks,
Qiaowei