Re: [PATCH v5] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Jan 2024, Shaoqin Huang wrote:
The KVM_ARM_VCPU_PMU_V3_FILTER provides the ability to let the VMM decide
which PMU events are provided to the guest. Add a new option
`kvm-pmu-filter` as -cpu sub-option to set the PMU Event Filtering.
Without the filter, all PMU events are exposed from host to guest by
default. The usage of the new sub-option can be found from the updated
document (docs/system/arm/cpu-features.rst).

Here is an example shows how to use the PMU Event Filtering, when
we launch a guest by use kvm, add such command line:

 # qemu-system-aarch64 \
       -accel kvm \
       -cpu host,kvm-pmu-filter="D:0x11-0x11"

Since the first action is deny, we have a global allow policy. This
disables the filtering of the cycle counter (event 0x11 being CPU_CYCLES).

And then in guest, use the perf to count the cycle:

 # perf stat sleep 1

  Performance counter stats for 'sleep 1':

             1.22 msec task-clock                       #    0.001 CPUs utilized
                1      context-switches                 #  820.695 /sec
                0      cpu-migrations                   #    0.000 /sec
               55      page-faults                      #   45.138 K/sec
  <not supported>      cycles
          1128954      instructions
           227031      branches                         #  186.323 M/sec
             8686      branch-misses                    #    3.83% of all branches

      1.002492480 seconds time elapsed

      0.001752000 seconds user
      0.000000000 seconds sys

As we can see, the cycle counter has been disabled in the guest, but
other pmu events are still work.

Signed-off-by: Shaoqin Huang <shahuang@xxxxxxxxxx>

Reviewed-by: Sebastian Ott <sebott@xxxxxxxxxx>





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux