[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.16] Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 25 Nov 2021 10:12:59 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ImPN/DDGcM8/rJ0xBvMRQaOrRzNev8CU+aPPIo7d7qo=; b=fO0/HP6TqUJ7CMpTzP8u6l3ZT6h5c9mHnsCMgQJS8K8nc0mfjIHkhllGl3nPwnry13t1Xvk9bZEynostojvm3o9GifzORAVkqS1+BU0h8Mo2GhfqGYONQA86AKAPVqnb7Om6B6wyzqlzWVgjclRE4PukVVi3bSMIWLG8U5U7Oouy3w7hIHd90+CHhsDHShEzoXjGKbDsPGI27bfhFz++VLbxXaQLM7qJ30CVpqNjxi1q+0Gmj6OaVEatS+YpaaBkSqX/OV+IeprFCPdtC2gK9f4qTJcDRweMTAyfHQ+tCV/wAOieZ1KXFlziITG5BpJb1FMrgJw0+Y+godWTQ7BbOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVFzQgDyDOpp6TevfhmzsNrxpK//+GCN6BbxmZrIEadfGLJ1Chd07LaAbY1RHIlEWtmYIRJj7BcJYWKowqhjXiZOJnVodcXSda6FkwAnYIkaKGCCfFTpYvlJ8znbHvmI7G5VNJheO1YlVyYZdnzTUON4cred1tHG5xhMHa80HKr+kZosAh6GdL6jlnMJmGc3EHxOnZFv2nAzLjFQkCO2SEkviatzbVTKPykHMvHwWZXOBjxnFZ2Fc3ZpvgskAGasLZv2gR6ZpBxrGoUmMjb9NxZy5ufM1aDQhMVLay3Q4TWS6sLhJjja1IqDCi6C7Al3CQWgzgA5ViNBBYPN0rh1lQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Thu, 25 Nov 2021 09:13:29 +0000
  • Ironport-data: A9a23:PGUbhaJtbctD/DEqFE+RNpIlxSXFcZb7ZxGr2PjKsXjdYENS3jxRn GsXUGCEPP3cMDekKoh2b9+19UIF78WAzoIwHgFlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokcxIn5BC5C5xZVG/fjgqoHUVaiUZUideSc+EH140Es5xrZg6mJVqYPR7z2l6 IuaT/L3YDdJ6xYsWo7Dw/vewP/HlK2aVAIw5jTSV9gS1LPtvyB94KYkDbOwNxPFrrx8RYZWc QphIIaRpQs19z91Yj+sfy2SnkciGtY+NiDW4pZatjTLbrGvaUXe345iXMfwZ3u7hB2shJNol 44O5aezRCUXI6P+t8heTCZhRnQW0a1uoNcrIFC6uM2XiUbHb2Ht07NlC0Re0Y8wo7gtRzsUr LpBdW5LPkvra+GemdpXTsF2gcsuNo/zNZ43sXB81zDJS/0hRPgvRo2XtYECh2hq3aiiG97Re exJTiFOXi7MTCZLPWYdV7E/sf6R0yyXnzpw9wvO+PtfD3Lo5BN1+KjgNpzSYNPibcRKnG6Iq 2Te5WP7DxoGctuFxlKt4n+qw+PCgy7/cIYTD6GjsO5nhkWJwW4eAwFQUkG0ydGboEOjX9NUK 2QP5zEj66M18SSWosLVBkPi5iTe51hFBoQW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 YET0E6MqyNMbEYt7eK3ODbKadY/DDvysnB7o2/vhQdPT2CKZsQlzuRYjzrbHGeLzM2Y6bReq Dsgvau8FGbCAsqh4mAdzM4dtmGg+eOuIPtYBYACRJiwA6SjQmw4Lq/NxSDxB8RXx5G3L9nqA H+4kDEz5Tml8v+5g7X1mfV4ZgTsNz9yuFbDMjJrsQOMD3jhiuheYwkcbyfuzIepv2p9T8R4Z TxiiZlG/42x2Laf2mzrxeo8w780Aw243un8lOciWuLm72xeBsKT+56wa5JeBrQ7EQt+Ptm1r hQ4m6fv51LSTvdgSXU/bHzJlBXv3vxhUBnvf8YjnRZX4dbQqRWt5Yj8ERcF4pFND7m6bogDP JlAKjnlbhrmGuhHjPkV1RUsZ6RtixZJGbCfqFCgL3b79FupgE486NCr/Zv2kvp9/oGOu95Dq r/Q+NVfYp1P70rhJRGdZA8qPuMex/wqC33QRevyHTcZek60iH22tXKCItc3pDfRHVP9up1pK j8
  • Ironport-sdr: 4b1xOWMekdGlePlR3BSCtooupf2xR1r2Fc/YItyUosdSszjGMjqLMAQQ0CunxjjuOM+6JPezVC 7PipGn5jl2t8VFbTwQTVdeIJkY2Os7YYIhzNNTYRep7ksaZYu1zcIdqzNTQS3UHFUzZ29bxPwp MCnszr+MgS3NdzLcswp1WCDRkyaObibPlLuanR3Acqz2E51SUfN9DUCdv9f2t3YJfDIiQRLrx8 e7Qhiw3sG3Nj8VPDycxTJFN88EfPkLDhdPC4aypux0qAKNPntG6W91deSrvrKSD6Wptw7tLtmi FaJruGv/kABSwNaQ1BnPSFSY
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Nov 24, 2021 at 09:11:52PM +0000, Andrew Cooper wrote:
> OSSTest has identified a 3rd regression caused by this change.  Migration
> between Xen 4.15 and 4.16 on the nocera pair of machines (AMD Opteron 4133)
> fails with:
> 
>   xc: error: Failed to set CPUID policy: leaf 00000000, subleaf ffffffff, msr 
> ffffffff (22 = Invalid argument): Internal error
>   xc: error: Restore failed (22 = Invalid argument): Internal error
> 
> which is a safety check to prevent resuming the guest when the CPUID data has
> been truncated.  The problem is caused by shrinking of the max policies, which
> is an ABI that needs handling compatibly between different versions of Xen.
> 
> Furthermore, shrinking of the default policies also breaks things in some
> cases, because certain cpuid= settings in a VM config file which used to have
> an effect will now be silently discarded.

I don't think they will be silently discarded. xc_cpuid_xend_policy
will attempt to get the CPUID leaf from the current/host/default
policies and fail because the leaf couldn't be found.

There's an issue with callers of xc_cpuid_apply_policy that pass a
featureset (which is not used by the upstream tools) as in that case
the featureset is translated to a CPUID policy without checking that
the set features are correctly exposed regarding the maximum leaves
set in CPUID, and thus features could be silently dropped, but as said
that's not used by the `cpuid=` config file option.

This possibly needs fixing anyway after the release, in order to
assert that the bits set in the featureset are correctly exposed given
the max leaves reported in the policy.

I think the above paragraph should be rewored as:

"Furthermore, shrinking of the default policies also breaks things in
some cases, because certain cpuid= settings in a VM config file which
used to work will now be refused. Also external toolstacks that
attempt to set the CPUID policy from a featureset might now see some
filled leaves not reachable due to the shrinking done to the default
domain policy before applying the featureset."

> This reverts commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d, as well as the
> partial fix attempt in 81da2b544cbb003a5447c9b14d275746ad22ab37 (which added
> one new case where cpuid= settings might not apply correctly) and restores the
> same behaviour as Xen 4.15.
> 
> Fixes: 540d911c2813 ("x86/CPUID: shrink max_{,sub}leaf fields according to 
> actual leaf contents")
> Fixes: 81da2b544cbb ("x86/cpuid: prevent shrinking migrated policies max 
> leaves")
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Likely with the paragraph adjusted if agreed.

> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Wei Liu <wl@xxxxxxx>
> CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>
> 
> Passing CI runs:
>   https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/415822110
>   https://cirrus-ci.com/build/4915643318272000
> 
> This supercedes
> https://lore.kernel.org/xen-devel/20211124161649.83189-1-roger.pau@xxxxxxxxxx/
> which is a step in the right direction (it fixes the OSSTest breakage), but
> incomplete (doesn't fix the potential cpuid= breakage).
> 
> For 4.16.  This is the 3rd breakage caused by 540d911c2813, and there is no
> reasonable workaround.  Obviously, this revert isn't completely without risk,
> but going wholesale back to the 4.15 behaviour is by far the safest option at
> this point.

I agree. Also the shrinking done by 540d911c2813 is not fixing any
issue we know about, so it's safer to just keep the previous behavior
of likely reporting empty leaves rather than risk more regressions
caused by the change.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.