|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/cpu-policy: set up host policy earlier
On 01.07.2026 17:21, Andrew Cooper wrote:
> On 07/04/2026 7:46 am, Jan Beulich wrote:
>> In order to use cpu_has_* expanding to host_cpu_policy.*, the host policy
>> needs setting up alongside boot_cpu_data.x86_capability[]. Arrange for
>> that towards the end of identify_cpu().
>>
>> Fixes: 894bd7617924 ("x86/Intel: use host CPU policy for ARAT checking")
>> Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> In the longer run we may need to (also) update the host policy from
>> setup_{force,clear}_cpu_cap().
I'm noticing only while making the change that I did already suggest here
what ...
>> --- a/xen/arch/x86/cpu-policy.c
>> +++ b/xen/arch/x86/cpu-policy.c
>> @@ -359,7 +359,7 @@ void calculate_raw_cpu_policy(void)
>> /* Was already added by probe_cpuid_faulting() */
>> }
>>
>> -static void __init calculate_host_policy(void)
>> +void __init calculate_host_policy(void)
>> {
>> struct cpu_policy *p = &host_cpu_policy;
>> unsigned int max_extd_leaf;
>> @@ -904,6 +904,7 @@ static void __init calculate_hvm_def_pol
>>
>> void __init init_guest_cpu_policies(void)
>> {
>> + /* Do this a 2nd time to account for setup_{clear,force}_cpu_cap()
>> uses. */
>> calculate_host_policy();
>
> I'm sorry, but no. The cleanup work to CPUID handling is in an attempt
> to purge this antipattern.
>
> Double-initialising data structures *is* the entire reason we have
> order-of-boot problems in the first place. Having a structure which is
> initialised but wrong is itself wrong.
>
> Really, I should insist on a revert of switching cpu_has_* to use
> host_policy. It was not adequately tested and is not compatible with
> how Xen starts up.
>
> But as I expect you're going to object to that feedback, I'll tolerate
> setup_*_cpu_cap() keeping the host policy correct as they're called.
> The easy option is to call x86_cpu_featureset_to_policy() each time.
... you're effectively (see my earlier reply) asking for here.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |