|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/cpu-policy: Remove cpu_policy.x86_vendor
On 12/2/26 16:07, Jan Beulich wrote:
> On 02.12.2026 10:42, ODIN Thomas wrote:
>> c520286a53 ("x86: Reject CPU policies with vendors other than the
>> host's") made x86_cpu_policies_are_compatible() reject any guest CPU
>> policy whose vendor doesn't match the host's, and that check runs
>> before a policy is ever installed. Every cpu_policy visible to a
>> running domain, or to any other in-hypervisor consumer (the
>> raw/host/pv_max/hvm_max policies, all derived from the host's own
>> CPUID), therefore now necessarily has the same vendor as
>> boot_cpu_data.x86_vendor.
>>
>> The cached x86_vendor field is thus redundant, so we drop it, and
>> x86_cpu_policy_recalc_synth() along with it, since that function's
>> only job was to compute it.
>>
>> The lib/x86 code shared with the toolstack and the emulator's
>> standalone test suite has no boot_cpu_data to fall back on (and isn't
>> covered by the same guarantee), so those few spots compute the vendor
>> from basic.vendor_ebx/ecx/edx via x86_cpuid_lookup_vendor() instead of
>> caching it.
>
> I wonder whether this somewhat ugly aspect was taken into account when ...
>
>> No functional change.
>>
>> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>
> ... Andrew suggested this.
>
> Jan
To be fair, in our discussion Andrew only suggested removing
cpu_policy.x86_vendor as a small, isolated cleanup task (since c520286a53
made it redundant with the host vendor in Xen) to get familiar with the
patch workflow before tackling the larger x86_cpu_policies_are_compatible()
work.
The x86_cpuid_lookup_vendor() fallback in the shared lib/x86 paths was
something I ran into when implementing the removal, since those consumers
don't have boot_cpu_data. There are five call sites that each spell out
x86_cpuid_lookup_vendor(p->basic.vendor_ebx, p->basic.vendor_ecx,
p->basic.vendor_edx) instead of going through one accessor. Would a
small helper wrapping that call be better here, or would you rather I keep
the cached field around instead of working around its absence in lib/x86?
--
ODIN Thomas
--
Thomas Odin | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |