The KVM_ARM_VCPU_PMU_V3_CTRL(KVM_ARM_VCPU_PMU_V3_SET_PMU) VCPU ioctl is
used to assign a physical PMU to the events that KVM creates when emulating
the PMU for that VCPU. This is useful on heterogeneous systems, when there
is more than one hardware PMU present.
The assumption that is made in the i
Signed-off-by: Alexandru Elisei
---
arm/aarch64/include/asm/kvm.h | 57 -
include/linux/kvm.h | 441 +-
powerpc/include/asm/kvm.h | 10 +
x86/include/asm/kvm.h | 64 -
4 files changed, 558 insertions(+), 14 deletions(-)
diff --git
Add the function cpulist_parse(), which creates a cpumask_t from a
cpulist. The function will be necessary to parse the cpulist of CPUs
associated with a particular PMU.
Signed-off-by: Alexandru Elisei
---
Makefile| 1 +
include/linux/bitmap.h | 25 +
include/linux/bitops
Add a handful of basic cpumask functions, some of which will be used when
dealing with different PMUs on heterogeneous systems.
Signed-off-by: Alexandru Elisei
---
arm/aarch32/include/asm/kernel.h | 8
arm/aarch64/include/asm/kernel.h | 8
include/linux/bitmap.h | 2
By the time kvmtool generates the DTB node for the PMU, the
KVM_ARM_VCPU_PMU_V3 VCPU feature is already set by kvm_cpu__arch_init().
KVM refuses to run a VCPU if the PMU hasn't been initialized. A PMU
cannot be initialized if the interrupt ID hasn't been set by userspace.
As a consequence, kvmtool
KVM for aarch32 does not exist anymore, PMUv3 is a hardware feature
present only on aarch64 CPUs, the command line option to enable the
feature for a VCPU is aarch64 specific, the PMU code is called only from
an aarch64 function and it compiles to an empty stub when ARCH=arm.
There is no reason to
The ARM_VCPU_FEATURE_FLAGS() macro sets a feature bit in a rather
convoluted way: if cpu_id is 0, then bit KVM_ARM_VCPU_POWER_OFF is 0,
otherwise is set to 1. There's really no need for this indirection,
especially considering that the macro has been changed to return the same
value for both the ar
KVM_CAP_ARM_EL1_32BIT and KVM_CAP_ARM_PMU_V3 are arm64 specific features.
They are set based on arm64 specific command line options and they target
arm64 hardware features. It makes little sense for kvmtool to set the
features in the code that is shared between arm and arm64. Move the logic
to set
The series can be found at [1], and the Linux patches that this series is
based on at [2].
The series adds support for the KVM_ARM_VCPU_PMU_V3_SET_PMU PMU attribute,
which allows userspace to set a PMU for a VCPU. This PMU is used by KVM
when creating perf events to emulate the guest PMU.
Without
Add missing header stdbool.h to avoid errors like this one, which can
happen if the including file doesn't include stdbool.h:
include/linux/err.h:33:15: error: type defaults to ‘int’ in declaration of
‘bool’ [-Werror=implicit-int]
33 | static inline bool __must_check IS_ERR(__force const void
Userspace can assign a PMU to a VCPU with the KVM_ARM_VCPU_PMU_V3_SET_PMU
device ioctl. If the VCPU is scheduled on a physical CPU which has a
different PMU, the perf events needed to emulate a guest PMU won't be
scheduled in and the guest performance counters will stop counting. Treat
it as an use
When KVM creates an event and there are more than one PMUs present on the
system, perf_init_event() will go through the list of available PMUs and
will choose the first one that can create the event. The order of the PMUs
in the PMU list depends on the probe order, which can change under various
ci
The ARM PMU driver calls kvm_host_pmu_init() after probing to tell KVM that
a hardware PMU is available for guest emulation. Heterogeneous systems can
have more than one PMU present, and the callback gets called multiple
times, once for each of them. Keep track of all the PMUs available to KVM,
as
Commit 0793a61d4df8 ("performance counters: core code") added the perf
subsystem (then called Performance Counters) to Linux, creating the struct
perf_cpu_context. The comment for the struct referred to it as a "struct
perf_counter_cpu_context".
Commit cdd6c482c9ff ("perf: Do the big rename: Perfo
(CC'ing Peter Maydell in case this might be of interest to qemu)
The series can be found at [x], and the kvmtool support at [2].
At the moment, the experience of running a virtual machine with a PMU on a
heterogeneous systems (where there are different PMUs), varies from just
works, if the VCPUs
15 matches
Mail list logo