[PATCH v2 0/4] KVM: arm64: Improve PMU support on heterogeneous systems
Marc Zyngier
maz at kernel.org
Wed Dec 8 00:05:14 PST 2021
Reji,
On 2021-12-08 02:36, Reiji Watanabe wrote:
> Hi Alex,
>
> On Mon, Dec 6, 2021 at 9:02 AM Alexandru Elisei
> <alexandru.elisei at arm.com> wrote:
>>
>> (CC'ing Peter Maydell in case this might be of interest to qemu)
>>
>> The series can be found on a branch at [1], and the kvmtool support at
>> [2].
>> The kvmtool patches are also on the mailing list [3] and haven't
>> changed
>> since v1.
>>
>> Detailed explanation of the issue and symptoms that the patches
>> attempt to
>> correct can be found in the cover letter for v1 [4].
>>
>> A brief summary of the problem is that on heterogeneous systems KVM
>> will
>> always use the same PMU for creating the VCPU events for *all* VCPUs
>> regardless of the physical CPU on which the VCPU is running, leading
>> to
>> events suddenly stopping and resuming in the guest as the VCPU thread
>> gets
>> migrated across different CPUs.
>>
>> This series proposes to fix this behaviour by allowing the user to
>> specify
>> which physical PMU is used when creating the VCPU events needed for
>> guest
>> PMU emulation. When the PMU is set, KVM will refuse to the VCPU on a
>> physical which is not part of the supported CPUs for the specified
>> PMU.
>
> Just to confirm, this series provides an API for userspace to request
> KVM to detect a wrong affinity setting due to a userspace bug so that
> userspace can get an error at KVM_RUN instead of leading to events
> suddenly stopping, correct ?
More than that, it allows userspace to select which PMU will be used
for their guest. The affinity setting is a byproduct of the PMU's own
affinity.
>
>> The default behaviour stays the same - without userspace setting the
>> PMU,
>> events will stop counting if the VCPU is scheduled on the wrong CPU.
>
> Can't we fix the default behavior (in addition to the current fix) ?
> (Do we need to maintain the default behavior ??)
Of course we do. This is a behaviour that has been exposed to userspace
for years, and *we don't break userspace*.
> IMHO I feel it is better to prevent userspace from configuring PMU
> for guests on such heterogeneous systems rather than leading to
> events suddenly stopping even as the default behavior.
People running KVM on asymmetric systems *strongly* disagree with you.
M.
--
Jazz is not dead. It just smells funny...
More information about the linux-arm-kernel
mailing list