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

Re: XEN_SYSCTL_cpu_policy_hvm_default truncates leaf count


  • To: Olaf Hering <olaf@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 1 Jul 2021 12:19:24 +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-SenderADCheck; bh=QNk+aQRxXzhpWD8DJgJK2eEl3dKt+LtyV24JvxMfyak=; b=G6jRGKX2UBwoczsfrYgdjrwb/bsaATk7QFBEKUMhn4gMPlOAFDgNyWk/hFZDNTU2f9LNlFxXfAwXW7FETEt8SsQEpzKE10jden9/UEZk7tGYwymvHdngniUNV9TslZ3i6CpBP7l0C9PNmfPjSYyjcnuXIitFhKGSlqW1YaJoRCc3XNdXn2r0n1iQfi56bZySOZtTdrqFQTVCCqOzoAL/qskrT9wuBso16I8BneB9eu6m6FIderZnF/yC4z92lpDkbrJpGRZCjPqfM6dTYkaJeoiDGrw1h6Vfq0OMUhTQAPV6vX1X8jekifoDfMGqelJZisq/GqB9nfO6Vm0bxv5jGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLVPvGC/+I4u7z3fPaFbPGIhSxMLIKQBzOeIOryKStZy4xuvQ7/GEgiMg9G4eqcMK/HbPNUMraIJWc+b4IxYfxIrsSXYKrugIujkqCA629M5SSryAesxhzn08QSJ52QHo4WCarrP53zEkQDk7/vS0eh4eUCh9DPkviIN8dOHjrYzXymCLFxXR96SjTphsO8/PA5Mq3R9+r9emG6iCoCN7/ytZEmAelBn6r3iwCKRWac/RtXT4hhNHhMIsfjxHJd6yaSahiOTBVAZ0kmPQyquB7HhmJ2F5538l+fdMlRzH/d1v9MoHu9Bug5JH0jmdWiQDrg3RbpNabrAmT4ww96DUg==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Delivery-date: Thu, 01 Jul 2021 11:19:44 +0000
  • Ironport-hdrordr: A9a23:Wb35+ansY0b5XNqHBc2tMp76svnpDfPaimdD5ihNYBxZY6Wkfp +V8sjzhCWatN9OYh0dcLC7WJVoMkmsiqKdhrNhQYtKPTOWxVdASbsC0WKM+UyZJ8STzJ876U 4kSdkFNDSSNykIsS+Z2njALz9I+rDum8rE9ISurQYZcegpUdAF0+4QMHfqLqQcfnghOXNWLu v42iMKnUvaRZxBBf7Ld0XtEtKz6+HjpdbDW1orFhQn4A6BgXeB76P7KQGR2lM7XylUybkv3G DZm0ihj5/T/c2T+1v57Sv+/p5WkNzuxp9qA9GNsNEcLnHJhhyzbIpsdrWetHQeof2p6nwtjN 7Qyi1QcPhb2jf0RCWYsBHt0w7v3HIF8Hn502KVhnPlvIjQWC86I9Apv/MbTjLpr24b+P1s2q NC2GyU87BNCwnboSj779/UEzl3i0uPp2Y4m+J7tQ0ebWInUs4VkWUjxjIQLH9ZdxiKr7zPUd MeTf003cwmM29zNBvizy9SKLXGZAVAIv+EKnJy8fB9nQImxUyR9HFos/D3qE1wvK7Ve6M0k9 gsDZ4Y4o2mbvVmJ56VV91xDPdeNAT2MFvx2TWpUCra/ec8Sirwl6I=
  • Ironport-sdr: PqilrLgr1TMgFGVyEJrz/LHvpEtxIAuTvH7IISt0frdnVyLRolnwk8kW2WL2xIXaFQ9zG5DTCc pfOFX5lDTo1ZFj+BKSw/bIrdjW9UE9ELyZ+rmcnrTk3SZiM7yDlNC5BoLglBhMrXrGUih4O5WG 5YkhZAq2vTYZTlr/YoVZOs/Ve/v3iUZNHgJ0nbLcnnBLwo6rAgbK9mchyvc4R2bu2GUz4h+jpX BPNye/QGX5Hp739xO7IjBmnGCMCScWHO6OnZ4JeYZlWIGgml5vu7VCqgM71qOtzR2/gg+/uDUo mPo=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01/07/2021 11:56, Olaf Hering wrote:
> For some reason migration of HVM domUs from pre-4.14 to staging is broken.
>
> It seems xc_cpuid_apply_policy gets nr_leaves=119 from 
> XEN_SYSCTL_get_cpu_policy.
> Later XEN_SYSCTL_cpu_policy_hvm_default truncates this value to 31.

119 is the maximum number of leaves to cover sizeof(struct cpuid_policy).

But no CPU hits both Intel and AMD max leaf, so we can unambiguously
represent the policy with fewer than 119 leaves.  31 is the count of
leaves with data in, on this particular system.

> As a result x86_cpuid_copy_to_buffer returns -ENOBUFS. It would copy up to 51 
> leaves in my testing.
>
> I suspect commit 34990446ca91d9e201ff17bd4e3f43bfe3ad308e just revealed a 
> logic error somewhere.
>
> What is supposed to happen in libxl__srm_callout_callback_static_data_done 
> when XGR_SDD_MISSING_CPUID is set?

One of the many totally broken things about Xen migration was that the
guests CPUID data never used to be part of the stream.  It was always
reinvented from scratch on the destination host.

This had fun properties such as the CPU's family/model/stepping changing
underfoot (I'm still amazed that VMs didn't complain more about this -
windows would happily install a new HAL driver and call itself done),
and less fun properties where some features just disappeared totally due
to changes in xc_cpuid_apply_policy() logic.

Starting in 4.14, after I'd added a "please get the guest's view of
CPUID" hypercall, the CPUID settings the VM saw move in the migrate
stream with it.

XGR_SDD_MISSING_CPUID is the signal of "this is a pre-4.14 VM with no
CPUID data", which means "you need to reinvent CPUID as the toolstack in
4.13 would have done".

This *ought* to be "grab default, edit a few details, send back to
Xen".  Where is the 51 leaves coming in?  Do you have cpuid= lines in
the xl cfg file?

~Andrew




 


Rackspace

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