On Mon, 2016-08-15 at 11:12 -0500, Wei Huang wrote: > > Did you already try driving this with libvirt? It should work > > out of the box. > > > > If you haven't, I will do it :) > > No, I haven't. All tests were done based on command line to QEMU. :-)
Fair enough :) I did some testing on my own using libvirt to drive a QEMU binary that included your patch, and it looks like everything is working as expected: if I turn PMU on using the appropriate XML element (<pmu state='on'/>) I can access the performance counters from inside the guest; if I disable it explicitly or don't enable it, I can't. The host-side testing involved making sure the 'pmu' flag was passed, or not passed, to QEMU and the value, if any, matched the guest XML. The guest-side testing involved running $ dmesg | grep -i pmu $ perf list | grep 'Hardware event' and making sure some output was returned in both cases, and making sure the 'instructions' counter was not marked as '<not supported>' in the output of $ perf stat true If the kind of testing I performed is not good enough, please let me know and I'll do another round. This was tested only with <cpu mode='host-passthrough'/> (the libvirt equivalent of -cpu host), because the aarch64 CPU driver in libvirt is not currently capable of handling other CPU models for KVM guests. I also verified that TCG guests didn't accept the 'pmu' flag. -- Andrea Bolognani / Red Hat / Virtualization