Shrinking max policies can lead to failures in migration as previous versions of Xen didn't shrink the number of leaves in any case, so it's possible for a guest created on previous versions of Xen that pass CPUID data on the migration stream to contain a max leaf number greatest than the one present on the max policies in versions of Xen containing 540d911c28.
Such failure was seen by osstest when doing a migration from Xen 4.15 to Xen 4.16-rc on a pair of equal boxes, the noceras. Fix this by preventing any shrinking of the max CPUID policies, so that previously built guest CPUID policies are compatible. Fixes: 540d911c28 ('x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents') Signed-off-by: Roger Pau Monné <roger....@citrix.com> --- Cc: Ian Jackson <i...@xenproject.org> This is a regression from Xen 4.15, so should be considered for Xen 4.16. The main risks would be to mess up with the CPUID policy in a different way, that would also lead to brokenness. Strictly speaking the change here removes the shrinking of max leaves and restores the previous behavior, but it's obviously not completely risk free. It has proven to fix the regression seen on the noceras. --- xen/arch/x86/cpuid.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 8ac55f0806..173c7b71ac 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -353,8 +353,6 @@ static void __init calculate_host_policy(void) p->extd.raw[0xa].d |= ((1u << SVM_FEATURE_VMCBCLEAN) | (1u << SVM_FEATURE_TSCRATEMSR)); } - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init guest_common_default_feature_adjustments(uint32_t *fs) @@ -434,8 +432,6 @@ static void __init calculate_pv_max_policy(void) recalculate_xstate(p); p->extd.raw[0xa] = EMPTY_LEAF; /* No SVM for PV guests. */ - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init calculate_pv_def_policy(void) @@ -523,8 +519,6 @@ static void __init calculate_hvm_max_policy(void) sanitise_featureset(hvm_featureset); cpuid_featureset_to_policy(hvm_featureset, p); recalculate_xstate(p); - - x86_cpuid_policy_shrink_max_leaves(p); } static void __init calculate_hvm_def_policy(void) -- 2.33.0