[RFC PATCH v3 04/16] arm64: Introduce CPU SPE feature
Alexandru Elisei
alexandru.elisei at arm.com
Thu Dec 3 05:07:10 EST 2020
Hi Will,
On 12/2/20 5:23 PM, Will Deacon wrote:
> On Wed, Dec 02, 2020 at 02:29:31PM +0000, Alexandru Elisei wrote:
>> On 11/19/20 4:58 PM, James Morse wrote:
>>> On 27/10/2020 17:26, Alexandru Elisei wrote:
>>>> Detect Statistical Profiling Extension (SPE) support using the cpufeatures
>>>> framework. The presence of SPE is reported via the ARM64_SPE capability.
>>>>
>>>> The feature will be necessary for emulating SPE in KVM, because KVM needs
>>>> that all CPUs have SPE hardware to avoid scheduling a VCPU on a CPU without
>>>> support. For this reason, the feature type ARM64_CPUCAP_SYSTEM_FEATURE has
>>>> been selected to disallow hotplugging a CPU which doesn't support SPE.
>>> Can you mention the existing driver in the commit message? Surprisingly it doesn't use
>>> cpufeature at all. It looks like arm_spe_pmu_dev_init() goes out of its way to support
>>> mismatched systems. (otherwise the significance of the new behaviour isn't clear!)
>>>
>>> I read it as: the host is fine with mismatched systems, and the existing drivers supports
>>> this. But KVM is not. After this patch you can't make the system mismatched 'late'.
>> That was exactly my intention. Certainly, I'll try to make the commit message
>> clearer by mentioning the SPE driver.
> Hmm, so are you saying that with this patch applied, a machine where KVM
> isn't even being used can no longer late-online CPUs without SPE if the boot
> CPUs had it? If so, then I don't think that's acceptable, unfortunately.
Yes, the idea was to prevent hotplugging CPUs that don't have the capability so
the kernel won't schedule a SPE-enabled guest on a CPU which doesn't have SPE.
>
> As James points out, the current driver is very careful to support
> big.LITTLE misconfigurations and I don't see why KVM support should change
> that.
That makes sense, thank you for making it clear from the start that this approach
is not the right one.
There was a discussion for supporting KVM SPE on heterogeneous systems [1]. I
chose to use a capability because the focus for this iteration was to ensure the
correctness of SPE emulation, and the capability looked like the easiest way to
get KVM SPE up and running for testing.
The idea discussed previously [1] was to have userspace configure the VM with a
cpumask representing the CPUs the VM is allowed to run on. KVM detects if the VCPU
is scheduled on a physical CPU not in the cpumask, and returns from KVM_RUN with
an error code. That looks like a good solution to me and generic enough that it
can be used for all sorts of mismatched features. I will try to implement it in
the next iteration, after I get more feedback on the current series.
[1] https://www.spinics.net/lists/arm-kernel/msg778477.html
Thanks,
Alex
More information about the linux-arm-kernel
mailing list