Help with Understanding vcpu xstate restore error during vm migration
Hello,
I am trying to understand the causes of the vcpu xstate restore error during live migration. I get the following error during live migration:
xc: error: Failed to set vcpu0's xsave info (22 = Invalid argument): Internal error
I was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if ( evc -> size < PV_XSAVE_HDR_SIZE ||
evc -> size > PV_XSAVE_SIZE ( xfeature_mask ) )
goto vcpuextstate_out ;
I know this is related to the number of xstates handled by the source server. Please can someone explain to me how these states are computed?
I earlier thought it was simply the number xsave dependent features on the CPU but it seems to be more than that.
Thanks in advance.
Caleb
Quoted 20 lines · Fonyuy-Asheri Caleb
Hello,
I am trying to understand the causes of the vcpu xstate restore error during live migration.
I get the following error during live migration:xc: error: Failed to set vcpu0's xsave info (22 = Invalid argument):
Internal errorI was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if( evc->size<PV_XSAVE_HDR_SIZE||
evc->size>PV_XSAVE_SIZE(xfeature_mask) )gotovcpuextstate_out;I know this is related to the number of xstates handled by the source server. Please can
someone explain to me how these states are computed?
Quoted 5 lines
I earlier thought it was simply the number xsave dependent features on the CPU but it seems
to be more than that.Thanks in advance.
It is certainly more complicated than that.
What that's saying is that Xen doesn't think that the size of the blob matches expectations. That said - I'm in the middle of rewriting this logic because lots of it is subtly wrong.
To start with, which version (or versions?) of Xen, and what hardware?
Are you able to capture xen-cpuid -p on the source and destination, as well as xen-cpuid -p $domid of the VM running on the source?
Do you have any CPUID overrides in the VM config file?
Thanks,
~Andrew
----- Original Message -----
Quoted 30 lines
From: "Andrew Cooper" <[email protected]>
To: "Fonyuy-Asheri Caleb" <[email protected]>, "xen-devel" <[email protected]>
Sent: Thursday, July 11, 2024 12:45:18 PM
Subject: Re: Help with Understanding vcpu xstate restore error during vm migrationQuoted 24 lines · Fonyuy-Asheri Caleb
Hello,
I am trying to understand the causes of the vcpu xstate restore error during live migration.
I get the following error during live migration:xc: error: Failed to set vcpu0's xsave info (22 = Invalid argument):
Internal errorI was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if( evc->size<PV_XSAVE_HDR_SIZE||
evc->size>PV_XSAVE_SIZE(xfeature_mask) )gotovcpuextstate_out;I know this is related to the number of xstates handled by the source server. Please can
someone explain to me how these states are computed?I earlier thought it was simply the number xsave dependent features on the CPU but it seems
to be more than that.
Quoted 7 lines
Quoted 1 line
Thanks in advance.
It is certainly more complicated than that.
What that's saying is that Xen doesn't think that the size of the blob matches expectations. That said - I'm in the middle of rewriting this logic because lots of it is subtly wrong.
Please do you mind giving me more insight on the logic currently implemented and maybe what is wrong with it? It will be important for me since what I'm doing is research work.
How do the values evc->size and xfeature_mask relate to the source and target processor xstates (or xstate management)?
Quoted 2 lines
To start with, which version (or versions?) of Xen, and what hardware?
Xen version 4.18.3-pre
My CPU is : Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz I'm running Ubuntu 20.04.
Quoted 3 lines
Are you able to capture
xen-cpuid -pon the source and destination, as well asxen-cpuid -p $domidof the VM running on the source?
Yes I am able to capture them. You can find them below.
Quoted 2 lines
Do you have any CPUID overrides in the VM config file?
I don't have any CPUID overrides. I just let the guest (Ubuntu server) use whatever xen gives.
Quoted 4 lines
Thanks,
~Andrew
Caleb
=========================================================================================================
Source server xen-cpuid -p
---------------------------------------------------------------------------------------------------------
=========================================================================================================
Xen reports there are maximum 120 leaves and 2 MSRs Raw policy: 32 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000f:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:7ffefbff:bfebfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000005:ffffffff -> 00000040:00000040:00000003:00002120 00000006:ffffffff -> 00000077:00000002:00000009:00000000 00000007:00000000 -> 00000000:000037ab:00000000:9c000400 00000009:ffffffff -> 00000001:00000000:00000000:00000000 0000000a:ffffffff -> 07300403:00000000:00000000:00000603 0000000b:00000000 -> 00000001:00000002:00000100:00000000 0000000b:00000001 -> 00000004:00000010:00000201:00000000 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000021:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00000000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000000000000
Host policy: 31 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:77fef3ff:bfebfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000000:000037ab:00000000:9c000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000021:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00000000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000000c000000
PV Max policy: 33 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:f6f83203:1fc9cbf5 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000002:00000329:00000000:ac000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000023:28100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00001000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000001c020004
HVM Max policy: 33 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:f7fa3223:1fcbfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000002:000007ab:00000000:bc000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000023:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00101000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000001c020004
PV Default policy: 31 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:f6d83203:1fc9cbf5 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000000:00000329:00000000:ac000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000021:28100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000008:ffffffff -> 0000302e:00001000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000000c000000
HVM Default policy: 31 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:f7fa3203:1fcbfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000000:000007ab:00000000:bc000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000021:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000008:ffffffff -> 0000302e:00101000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000000c000000
=========================================================================================================
Target server xen-cpuid -p
---------------------------------------------------------------------------------------------------------
=========================================================================================================
Xen reports there are maximum 120 leaves and 2 MSRs Raw policy: 39 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 00000016:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:7ffefbff:bfebfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000005:ffffffff -> 00000040:00000040:00000003:00002020 00000006:ffffffff -> 00000ef7:00000002:00000009:00000000 00000007:00000000 -> 00000000:d39ffffb:00000018:bc002400 0000000a:ffffffff -> 07300404:00000000:00000000:00000603 0000000b:00000000 -> 00000001:00000002:00000100:00000000 0000000b:00000001 -> 00000005:00000014:00000201:00000000 0000000d:00000000 -> 000002ff:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000100:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 0000000d:00000004 -> 00000040:00000400:00000000:00000000 0000000d:00000005 -> 00000040:00000440:00000000:00000000 0000000d:00000006 -> 00000200:00000480:00000000:00000000 0000000d:00000007 -> 00000400:00000680:00000000:00000000 0000000d:00000008 -> 00000080:00000000:00000001:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000121:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00000000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000000000c04
Host policy: 38 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:47fee3ff:bfebfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000000:029cffdb:00000008:bc002400 0000000d:00000000 -> 0000021b:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000000:00000000 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 0000000d:00000004 -> 00000040:00000400:00000000:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000121:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00000000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000008000c04
PV Max policy: 32 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:c6f82203:1fc9cbf5 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000002:018c0b19:00000000:ac000c00 0000000d:00000000 -> 00000003:00000000:00000240:00000000 0000000d:00000001 -> 00000007:00000000:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000123:28100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00001000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000018020004
HVM Max policy: 40 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:c7fa2223:1fcbfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000002:019c4f9b:00000008:bc000c00 0000000d:00000000 -> 0000021b:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000000:00000000 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 0000000d:00000004 -> 00000040:00000400:00000000:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000123:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000007:ffffffff -> 00000000:00000000:00000000:00000100 80000008:ffffffff -> 0000302e:00101000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000018020004
PV Default policy: 30 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:c6d82203:1fc9cbf5 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000000:008c0b09:00000000:ac000400 0000000d:00000000 -> 00000003:00000000:00000240:00000000 0000000d:00000001 -> 00000007:00000000:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000121:28100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000008:ffffffff -> 0000302e:00001000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000008000004
HVM Default policy: 38 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:c7fa2203:1fcbfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000000:009c0f8b:00000008:bc000400 0000000d:00000000 -> 00000203:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000000:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000121:2c100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 6c695320:20726576:34313134:55504320 80000004:ffffffff -> 32204020:4730322e:00007a48:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000008:ffffffff -> 0000302e:00101000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 0000000008000004
=========================================================================================================
VM xen-cpuid -p $domid
---------------------------------------------------------------------------------------------------------
Domain 3 policy: 31 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 000306f2:00100800:f6d83203:1fc9cbf5 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c10000 00000004:00000000 -> 1c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 1c004122:01c0003f:0000003f:00000000 00000004:00000002 -> 1c004143:01c0003f:000001ff:00000000 00000004:00000003 -> 1c03c163:04c0003f:00003fff:00000006 00000007:00000000 -> 00000000:00002329:00000000:ac000400 0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 80000000:ffffffff -> 80000008:00000000:00000000:00000000 80000001:ffffffff -> 00000000:00000000:00000021:28100800 80000002:ffffffff -> 65746e49:2952286c:6f655820:2952286e 80000003:ffffffff -> 55504320:2d354520:30333632:20337620 80000004:ffffffff -> 2e322040:48473034:0000007a:00000000 80000006:ffffffff -> 00000000:00000000:01006040:00000000 80000008:ffffffff -> 0000302e:00001000:00000000:00000000
MSRs:
index -> value
000000ce -> 0000000080000000
0000010a -> 000000000c000000
=========================================================================================================
Quoted 31 lines · Fonyuy-Asheri Caleb
----- Original Message -----
Quoted 30 lines
From: "Andrew Cooper" <[email protected]>
To: "Fonyuy-Asheri Caleb" <[email protected]>, "xen-devel" <[email protected]>
Sent: Thursday, July 11, 2024 12:45:18 PM
Subject: Re: Help with Understanding vcpu xstate restore error during vm migrationQuoted 25 lines · Fonyuy-Asheri Caleb
Hello,
I am trying to understand the causes of the vcpu xstate restore error during live migration.
I get the following error during live migration:xc: error: Failed to set vcpu0's xsave info (22 = Invalid argument):
Internal errorI was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if( evc->size<PV_XSAVE_HDR_SIZE||
evc->size>PV_XSAVE_SIZE(xfeature_mask) )gotovcpuextstate_out;I know this is related to the number of xstates handled by the source server. Please can
someone explain to me how these states are computed?I earlier thought it was simply the number xsave dependent features on the CPU but it seems
to be more than that.Thanks in advance.
Quoted 8 lines
Quoted 5 lines
It is certainly more complicated than that.
What that's saying is that Xen doesn't think that the size of the blob matches expectations. That said - I'm in the middle of rewriting this logic because lots of it is subtly wrong.
Please do you mind giving me more insight on the logic currently implemented and maybe what is wrong with it? It will be important for me since what I'm doing is research work.
See 9e6dbbe8bf40^..267122a24c49
Quoted 2 lines
How do the values
evc->sizeandxfeature_maskrelate to the source and target processor xstates (or xstate management)?
The lower bounds check is for normal reasons, while the upper bounds check is a sanity "does this image appear to have more states active than the current system".
The upper bound is bogus, because "what this VM has" has no true relationship to "what Xen decided to turn on by default at boot".
Quoted 2 lines
Quoted 1 line
To start with, which version (or versions?) of Xen, and what hardware?
Xen version 4.18.3-pre
As you're not on a specific tag, exact changeset?
Not that it likely matters - there shouldn't be anything relevant in staging-4.18 since RELEASE-4.18.2 as far as this goes.
There are backports of 2 of bugfixes, but in a way that should be practical change on 4.18.
Quoted 1 line
My CPU is : Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
Ok, so Haswell.
Let me stare at the CPUID dumps and see if anything stands out.
~Andrew
Quoted 6 lines
Quoted 4 lines
Please do you mind giving me more insight on the logic currently implemented and maybe what is wrong with it? It will be important for me since what I'm doing is research work.
See 9e6dbbe8bf40^..267122a24c49
What reference is this please?
Quoted 10 lines
Quoted 3 lines
How do the values
evc->sizeandxfeature_maskrelate to the source and target processor xstates (or xstate management)?The lower bounds check is for normal reasons, while the upper bounds check is a sanity "does this image appear to have more states active than the current system".
The upper bound is bogus, because "what this VM has" has no true relationship to "what Xen decided to turn on by default at boot".
I see. My initial question about this was more of understanding how this information is gathered. Is it directly related to the CPUID of the VM or does depend on the state of the VM at the moment of migrating it?
If it is related to the CPUID, how is it constructed?
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
To start with, which version (or versions?) of Xen, and what hardware?
Xen version 4.18.3-pre
As you're not on a specific tag, exact changeset?
I am on the stable-4.18 tag.
Quoted 7 lines
Not that it likely matters - there shouldn't be anything relevant in staging-4.18 since RELEASE-4.18.2 as far as this goes.
There are backports of 2 of bugfixes, but in a way that should be practical change on 4.18.
Quoted 8 lines
Quoted 1 line
My CPU is : Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
Ok, so Haswell.
Let me stare at the CPUID dumps and see if anything stands out.
~Andrew
Caleb
Quoted 5 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
Quoted 3 lines
Please do you mind giving me more insight on the logic currently implemented and maybe what is wrong with it? It will be important for me since what I'm doing is research work.
See 9e6dbbe8bf40^..267122a24c49
What reference is this please?
It's a git commit-range. You want:
$ git log 9e6dbbe8bf40^..267122a24c49
to view them.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
How do the values
evc->sizeandxfeature_maskrelate to the source and target processor xstates (or xstate management)?The lower bounds check is for normal reasons, while the upper bounds check is a sanity "does this image appear to have more states active than the current system".
Quoted 7 lines
Quoted 2 lines
The upper bound is bogus, because "what this VM has" has no true relationship to "what Xen decided to turn on by default at boot".
I see. My initial question about this was more of understanding how this information is gathered. Is it directly related to the CPUID of the VM or does depend on the state of the VM at the moment of migrating it?
If it is related to the CPUID, how is it constructed?
The size of the xsave area is a function of the *current* value in %xcr0. (On Haswell. Lets ignore MSR_XSS on newer systems for now.)
However, because guests can modify %xcr0 and turn states back off, Xen has to track xcr0_accum which is all bits we've ever seen the guest turn on.
CPUID (and in particular, the guest's CPU policy data) controls which states the guest is permitted to activate, which in turn influences the size.
Xen's normal CPUID handling logic *should* make it impossible for a guest to see features which hardware isn't capable of, and should block migration to a system which is less capable too.
I suspect what's going on here is that the destination has one or more of AVX|SSE|x87 disabled somehow, and this check is failing before the more coherent one which should explain why the VM can't migrate in...
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
To start with, which version (or versions?) of Xen, and what hardware?
Xen version 4.18.3-pre
As you're not on a specific tag, exact changeset?
I am on the stable-4.18 tag.
That's a branch which moves, not a tag.
What does git show say? Just need the first few lines.
~Andrew
----- Original Message -----
Quoted 47 lines
From: "Andrew Cooper" <[email protected]>
To: "Fonyuy-Asheri Caleb" <[email protected]>
Cc: "xen-devel" <[email protected]>, "Jan Beulich" <[email protected]>, "Roger Pau Monné" <[email protected]>
Sent: Thursday, July 11, 2024 3:04:05 PM
Subject: Re: Help with Understanding vcpu xstate restore error during vm migrationQuoted 5 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
Quoted 3 lines
Please do you mind giving me more insight on the logic currently implemented and maybe what is wrong with it? It will be important for me since what I'm doing is research work.
See 9e6dbbe8bf40^..267122a24c49
What reference is this please?
It's a git commit-range. You want:
$ git log 9e6dbbe8bf40^..267122a24c49to view them.
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
How do the values
evc->sizeandxfeature_maskrelate to the source and target processor xstates (or xstate management)?The lower bounds check is for normal reasons, while the upper bounds check is a sanity "does this image appear to have more states active than the current system".
The upper bound is bogus, because "what this VM has" has no true relationship to "what Xen decided to turn on by default at boot".
Quoted 7 lines
I see. My initial question about this was more of understanding how this information
is gathered. Is it directly related to the CPUID of the VM or does depend on the state
of the VM at the moment of migrating it?If it is related to the CPUID, how is it constructed?
The size of the xsave area is a function of the *current* value in %xcr0. (On Haswell. Lets ignore
MSR_XSSon newer systems for now.)However, because guests can modify %xcr0 and turn states back off, Xen has to track
xcr0_accumwhich is all bits we've ever seen the guest turn on.CPUID (and in particular, the guest's CPU policy data) controls which states the guest is permitted to activate, which in turn influences the size.
Quoted 8 lines
Xen's normal CPUID handling logic *should* make it impossible for a guest to see features which hardware isn't capable of, and should block migration to a system which is less capable too.
I suspect what's going on here is that the destination has one or more of AVX|SSE|x87 disabled somehow, and this check is failing before the more coherent one which should explain why the VM can't migrate in...
Thank you. This makes much more sense now.
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
To start with, which version (or versions?) of Xen, and what hardware?
Xen version 4.18.3-pre
As you're not on a specific tag, exact changeset?
I am on the stable-4.18 tag.
That's a branch which moves, not a tag.
What does
git showsay? Just need the first few lines.
Here is the output of git show:
commit 45c5333935628e7c80de0bd5a9d9eff50b305b16 (HEAD -> stable-4.18, origin/staging-4.18, origin/stable-4.18)
Author: Jan Beulich <[email protected]> Date: Thu Jul 4 16:57:29 2024 +0200
evtchn: build fix for Arm
Quoted 2 lines
~Andrew
Caleb
Ok, so trimming down to the relevant pieces, we have:
Quoted 10 lines · Fonyuy-Asheri Caleb
=========================================================================================================
Source server xen-cpuid -p
=========================================================================================================
Raw policy: 32 leaves, 2 MSRs
...
00000001:ffffffff -> 000306f2:00100800:7ffefbff:bfebfbff
...
0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000
Haswell, with AVX, and ...
Quoted 5 lines
PV Default policy: 31 leaves, 2 MSRs
...
0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000
... AVX available to PV guests.
On the target, something very different. We have ...
Quoted 6 lines
=========================================================================================================
Target server xen-cpuid -p
=========================================================================================================
Raw policy: 39 leaves, 2 MSRs
...
00000001:ffffffff -> 00050654:00200800:7ffefbff:bfebfbff
Skylake. (Which is very much not a Haswell.)
Quoted 10 lines
0000000d:00000000 -> 000002ff:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000100:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 0000000d:00000004 -> 00000040:00000400:00000000:00000000 0000000d:00000005 -> 00000040:00000440:00000000:00000000 0000000d:00000006 -> 00000200:00000480:00000000:00000000 0000000d:00000007 -> 00000400:00000680:00000000:00000000 0000000d:00000008 -> 00000080:00000000:00000001:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000
and AVX, MPX(x2), AVX512(x3), PROC_TRACE and PKRU.
Quoted 8 lines
Host policy: 38 leaves, 2 MSRs
CPUID:
leaf subleaf -> eax ebx ecx edx
00000000:ffffffff -> 0000000d:756e6547:6c65746e:49656e69 00000001:ffffffff -> 00050654:00200800:47fee3ff:bfebfbff 00000002:ffffffff -> 76036301:00f0b5ff:00000000:00c30000 00000004:00000000 -> 3c004121:01c0003f:0000003f:00000000 00000004:00000001 -> 3c004122:01c0003f:0000003f:00000000
Quoted 8 lines
00000004:00000002 -> 3c004143:03c0003f:000003ff:00000000 00000004:00000003 -> 3c07c163:0280003f:00004fff:00000004 00000007:00000000 -> 00000000:029cffdb:00000008:bc002400 0000000d:00000000 -> 0000021b:00000000:00000a88:00000000 0000000d:00000001 -> 0000000f:00000000:00000000:00000000 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 0000000d:00000004 -> 00000040:00000400:00000000:00000000 0000000d:00000009 -> 00000008:00000a80:00000000:00000000
Xen has only chosen to activate MPX(x2) and PKRU, and indeed...
Quoted 4 lines
PV Default policy: 30 leaves, 2 MSRs
...
0000000d:00000000 -> 00000003:00000000:00000240:00000000 0000000d:00000001 -> 00000007:00000000:00000000:00000000
... PV guests get nothing, while you're trying to migrate in a guest which...
Quoted 8 lines
=========================================================================================================
VM xen-cpuid -p $domid
---------------------------------------------------------------------------------------------------------
Domain 3 policy: 31 leaves, 2 MSRs
...
0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000
... has AVX.
This explains why you're hitting the "guest size > xen size" check.
Migration should have failed earlier with a clearer message about the VM having features not available on the target, but I suspect I know why it didn't, and sadly its an item I've had on the todo list for a few years.
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
~Andrew
Quoted 17 lines
Quoted 4 lines
PV Default policy: 30 leaves, 2 MSRs
...
0000000d:00000000 -> 00000003:00000000:00000240:00000000 0000000d:00000001 -> 00000007:00000000:00000000:00000000... PV guests get nothing, while you're trying to migrate in a guest which...
Quoted 8 lines
=========================================================================================================
VM xen-cpuid -p $domid
---------------------------------------------------------------------------------------------------------
Domain 3 policy: 31 leaves, 2 MSRs
...
0000000d:00000000 -> 00000007:00000000:00000340:00000000 0000000d:00000001 -> 00000001:00000000:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000
Quoted 1 line
... has AVX.
This makes much more sense now.
Quoted 9 lines
This explains why you're hitting the "guest size > xen size" check.
Migration should have failed earlier with a clearer message about the VM having features not available on the target, but I suspect I know why it didn't, and sadly its an item I've had on the todo list for a few years.
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Quoted 2 lines
~Andrew
Thanks a lot for these pointers Andrew.
Caleb.
Quoted 4 lines · Fonyuy-Asheri Caleb
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
Jan
----- Original Message -----
Quoted 6 lines
From: "Jan Beulich" <[email protected]>
To: "Fonyuy-Asheri Caleb" <[email protected]>
Cc: "xen-devel" <[email protected]>, "Andrew Cooper" <[email protected]>
Sent: Monday, July 15, 2024 10:16:07 AM
Subject: Re: Help with Understanding vcpu xstate restore error during vm migration
Quoted 8 lines
Quoted 4 lines · Fonyuy-Asheri Caleb
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
I didn't notice that. Unfortunately I no longer have access to the logs to check since I was working on resources I reserved for a limited period.
However, do you mind telling me what this would mean for my environment?
For more context, what I'm trying to investigate here is the impact of xstate and xsave dependencies on live migration.
Quoted 2 lines
Jan
Caleb
Quoted 13 lines · Fonyuy-Asheri Caleb
----- Original Message -----
Quoted 12 lines
From: "Jan Beulich" <[email protected]>
To: "Fonyuy-Asheri Caleb" <[email protected]>
Cc: "xen-devel" <[email protected]>, "Andrew Cooper" <[email protected]>
Sent: Monday, July 15, 2024 10:16:07 AM
Subject: Re: Help with Understanding vcpu xstate restore error during vm migrationQuoted 4 lines · Fonyuy-Asheri Caleb
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Quoted 7 lines
Quoted 2 lines
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
I didn't notice that. Unfortunately I no longer have access to the logs to check since I was working on resources I reserved for a limited period.
However, do you mind telling me what this would mean for my environment?
Hard to tell, depending on what exactly you use that environment for. If I'm not mistaken (Andrew will surely correct me if I'm wrong), the best you can do is have such systems run with up-to-date microcode. Which of course requires you have control over the physical system (to update firmware) or at least the hypervisor (to hand it a microcode blob to load while booting). If you had control over only the command line, you could also choose to ignore the vulnerability and request AVX not to be turned off ("spec-ctrl=no-gds-mit"). Yet of course you wouldn't want to do this if you were running any not fully trusted guests.
Jan
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Quoted 8 lines
Quoted 2 lines
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
I didn't notice that. Unfortunately I no longer have access to the logs to check since I was
working on resources I reserved for a limited period.However, do you mind telling me what this would mean for my environment?
Quoted 9 lines
Hard to tell, depending on what exactly you use that environment for. If I'm not mistaken (Andrew will surely correct me if I'm wrong), the best you can do is have such systems run with up-to-date microcode. Which of course requires you have control over the physical system (to update firmware) or at least the hypervisor (to hand it a microcode blob to load while booting). If you had control over only the command line, you could also choose to ignore the vulnerability and request AVX not to be turned off ("spec-ctrl=no-gds-mit"). Yet of course you wouldn't want to do this if you were running any not fully trusted guests.
Quick verification: cpuid=no-avx and spec-ctrl=no-gds-mit are options passed to the grub right?
Quoted 2 lines
Jan
Caleb
Quoted 25 lines · Fonyuy-Asheri Caleb
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Quoted 8 lines
Quoted 2 lines
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
I didn't notice that. Unfortunately I no longer have access to the logs to check since I was
working on resources I reserved for a limited period.However, do you mind telling me what this would mean for my environment?
Quoted 9 lines
Hard to tell, depending on what exactly you use that environment for. If I'm not mistaken (Andrew will surely correct me if I'm wrong), the best you can do is have such systems run with up-to-date microcode. Which of course requires you have control over the physical system (to update firmware) or at least the hypervisor (to hand it a microcode blob to load while booting). If you had control over only the command line, you could also choose to ignore the vulnerability and request AVX not to be turned off ("spec-ctrl=no-gds-mit"). Yet of course you wouldn't want to do this if you were running any not fully trusted guests.
Quoted 2 lines
Quick verification: cpuid=no-avx and spec-ctrl=no-gds-mit are options passed to the grub right?
They're options passed to Xen. If you use grub as the boot loader, then they would need putting _in_ respective grub config files / scripts.
Jan
Quoted 27 lines · Fonyuy-Asheri Caleb
Quoted 25 lines
Quoted 24 lines
Quoted 6 lines
Quoted 6 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Quoted 8 lines
Quoted 2 lines
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
I didn't notice that. Unfortunately I no longer have access to the logs to check since I was
working on resources I reserved for a limited period.However, do you mind telling me what this would mean for my environment?
Hard to tell, depending on what exactly you use that environment for. If I'm not mistaken (Andrew will surely correct me if I'm wrong), the best you can do is have such systems run with up-to-date microcode. Which of course requires you have control over the physical system (to update firmware) or at least the hypervisor (to hand it a microcode blob to load while booting). If you had control over only the command line, you could also choose to ignore the vulnerability and request AVX not to be turned off ("spec-ctrl=no-gds-mit"). Yet of course you wouldn't want to do this if you were running any not fully trusted guests.
Quoted 7 lines
Quoted 2 lines
Quick verification: cpuid=no-avx and spec-ctrl=no-gds-mit are options passed to the grub right?
They're options passed to Xen. If you use grub as the boot loader, then they would need putting _in_ respective grub config files / scripts.
Jan
Thank you Jan
Caleb
Quoted 6 lines · Jan Beulich
Quoted 3 lines · Fonyuy-Asheri Caleb
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
Oh - good point. I'd completely forgotten about that.
If you've got out-of-date microcode (specifically microcode prior to 2023-08-08), then yes, Xen will disable AVX by default to mitigate CVE-2022-40982 / "Gather Data Sampling", and the symptoms would look exactly like this.
~Andrew
Hello Andrew,
Hello Jan,
Please permit me to come back to this once again.
Quoted 8 lines · Jan Beulich
Quoted 6 lines · Fonyuy-Asheri Caleb
Quoted 3 lines
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
Quoted 8 lines
Oh - good point. I'd completely forgotten about that.
If you've got out-of-date microcode (specifically microcode prior to 2023-08-08), then yes, Xen will disable AVX by default to mitigate CVE-2022-40982 / "Gather Data Sampling", and the symptoms would look exactly like this.
~Andrew
I was able to obtain access to an Ice Lake Xeon processor which is one of the processors affected by the GDS vulnerability.
I will like to know what could be the effect of this "cpuid=no-avx" xen default on the xstates handled by the system. How does this disabling manifest itself between on my CPUID or list of features?
Also, I would like to understand the relationship between xstates in xen and xsave dependencies on the system? I was expecting to have more xstates once i have more xsave dependencies but was surprised to notice a live migration go through from a cpu with more xsave dependencies to one with fewer dependencies(features which use xsave). Is there something I'm understanding wrongly?
Lastly, during vm migration, do we consider all possible xstates or just the active xstates of the cpu? I am not able to figure that out from the code yet.
Thank you in advance
Caleb
Quoted 22 lines · Fonyuy-Asheri Caleb
Quoted 8 lines · Jan Beulich
Quoted 6 lines · Fonyuy-Asheri Caleb
Quoted 3 lines
Quoted 2 lines
Perhaps the more important question, are you booting the skylake with cpuid=no-avx on the command line by any chance?
No. I didn't boot any of the machines with any cpuid modification whatsoever.
Yet is there perhaps "Mitigating GDS by disabling AVX" in the boot log of the hypervisor (which sadly so far you didn't supply anywhere afaics)?
Quoted 6 lines
Oh - good point. I'd completely forgotten about that.
If you've got out-of-date microcode (specifically microcode prior to 2023-08-08), then yes, Xen will disable AVX by default to mitigate CVE-2022-40982 / "Gather Data Sampling", and the symptoms would look exactly like this.
I was able to obtain access to an Ice Lake Xeon processor which is one of the processors affected by the GDS vulnerability.
I will like to know what could be the effect of this "cpuid=no-avx" xen default on the xstates handled by the system. How does this disabling manifest itself between on my CPUID or list of features?
Quoted 5 lines
Also, I would like to understand the relationship between xstates in xen and xsave dependencies on the system? I was expecting to have more xstates once i have more xsave dependencies but was surprised to notice a live migration go through from a cpu with more xsave dependencies to one with fewer dependencies(features which use xsave). Is there something I'm understanding wrongly?
Here and ...
Quoted 2 lines
Lastly, during vm migration, do we consider all possible xstates or just the active xstates of the cpu? I am not able to figure that out from the code yet.
... here everything depends on what the guest gets to see. I.e. in your wording "possible" would mean "possible from the guest's perspective", i.e. what it sees when it executes CPUID insns with respective inputs. During migration we cannot go below that, but we certainly can go below what the host may support.
If what you say in the earlier paragraph was the case with upstream Xen and without you restricting what the guest being migrated was able to see on the source host, then I think that would indicate a bug somewhere. Yet you don't provide enough details to be certain.
Jan
Quoted 6 lines
If what you say in the earlier paragraph was the case with upstream Xen and without you restricting what the guest being migrated was able to see on the source host, then I think that would indicate a bug somewhere. Yet you don't provide enough details to be certain.
Jan
Sorry for not specifying. I am still in the same context as stated previously. I haven't made any modifications to xen and no restrictions on what the guest can see.
Caleb
Quoted 7 lines · Fonyuy-Asheri Caleb
Quoted 4 lines
If what you say in the earlier paragraph was the case with upstream Xen and without you restricting what the guest being migrated was able to see on the source host, then I think that would indicate a bug somewhere. Yet you don't provide enough details to be certain.
Sorry for not specifying. I am still in the same context as stated previously. I haven't made any modifications to xen and no restrictions on what the guest can see.
Wasn't it the case that previously you observed AVX disabled, because of GDS? With AVX disabled, AVX512 would be implicitly disabled, too. Then migrating from an AVX512-capable host to an AVX512-incapable one would of course work. Yet of course this is only an example, because I don't know whether AVX512 is what your new inquiry would have been about. As indicated - please provide sufficient detail so we actually know what you're doing and what you observe.
Jan
Quoted 8 lines · Fonyuy-Asheri Caleb
Quoted 5 lines
Quoted 4 lines
If what you say in the earlier paragraph was the case with upstream Xen and without you restricting what the guest being migrated was able to see on the source host, then I think that would indicate a bug somewhere. Yet you don't provide enough details to be certain.
Quoted 6 lines
Quoted 3 lines
Sorry for not specifying. I am still in the same context as stated previously. I haven't made any modifications to xen and no restrictions on what the guest can see.
Wasn't it the case that previously you observed AVX disabled, because of GDS? With AVX disabled, AVX512 would be implicitly disabled, too. Then
In my previous setup I wasn't able to confirm the GDS status because at the time we mentioned it in discussions I no longer had access to the experiment environment.
Quoted 7 lines
migrating from an AVX512-capable host to an AVX512-incapable one would of course work. Yet of course this is only an example, because I don't know whether AVX512 is what your new inquiry would have been about. As indicated - please provide sufficient detail so we actually know what you're doing and what you observe.
Jan
Seems there's more to this than I think. Here's the entire information about my setup.
Source Server:
Processor: Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz Xsave dependences(based on xen gen-cpuid.py):
'fma', 'avx', 'f16c', 'avx2', 'avx512f', 'avx512dq', 'avx512cd',
'avx512bw', 'avx512vl', 'xsaveopt', 'xsavec', 'xgetbv1', 'xsaves',
'pku', 'avx512_vbmi2', 'vaes', 'vpclmulqdq', 'avx512_vnni', 'avx512_bitalg',
'avx512_vpopcntdq'Target Server:
Processor: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz Xsave dependencies:
'fma', 'avx', 'f16c', 'avx2', 'mpx', 'avx512f', 'avx512dq',
'avx512cd', 'avx512bw', 'avx512vl', 'xsaveopt', 'xsavec', 'xgetbv1', 'xsaves', 'pku'Operating System: Debian12 (on both source and target servers) Guest OS: Ubuntu 18.04 (PV)
Xen version: 4.18.3-pre (commit 01f7a3c792241d348a4e454a30afdf6c0d6cd71c)
So I have the following which are available on my source server but not on the target server:
'avx512_vbmi2', 'vaes', 'vpclmulqdq', 'avx512_vnni', 'avx512_bitalg', 'avx512_vpopcntdq'
Per my current understanding, I would expect more xstates on the VM than supported on the target server and hence a failure with xstate verification when restoring CPU state.
However migrating a guest from Source to target works.
Note that these extra avx512 features are all visible to the guest I migrate.
Caleb
Quoted 17 lines · Fonyuy-Asheri Caleb
Seems there's more to this than I think. Here's the entire information about my setup.
Source Server:
Processor: Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz Xsave dependences(based on xen gen-cpuid.py): 'fma', 'avx', 'f16c', 'avx2', 'avx512f', 'avx512dq', 'avx512cd', 'avx512bw', 'avx512vl', 'xsaveopt', 'xsavec', 'xgetbv1', 'xsaves', 'pku', 'avx512_vbmi2', 'vaes', 'vpclmulqdq', 'avx512_vnni', 'avx512_bitalg', 'avx512_vpopcntdq'Target Server:
Processor: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz Xsave dependencies: 'fma', 'avx', 'f16c', 'avx2', 'mpx', 'avx512f', 'avx512dq', 'avx512cd', 'avx512bw', 'avx512vl', 'xsaveopt', 'xsavec', 'xgetbv1', 'xsaves', 'pku'
Quoted 8 lines
Operating System: Debian12 (on both source and target servers) Guest OS: Ubuntu 18.04 (PV)
Xen version: 4.18.3-pre (commit
01f7a3c792241d348a4e454a30afdf6c0d6cd71c)So I have the following which are available on my source server but not on the target server:
'avx512_vbmi2', 'vaes', 'vpclmulqdq', 'avx512_vnni', 'avx512_bitalg', 'avx512_vpopcntdq'
None of these require extra state (i.e. registers), hence ...
Quoted 2 lines
Per my current understanding, I would expect more xstates on the VM than supported on the target server and hence a failure with xstate verification when restoring CPU state.
... no extra "xstates" (as you name it).
Quoted 3 lines
However migrating a guest from Source to target works.
Note that these extra avx512 features are all visible to the guest I migrate.
Ah yes. While that's a bug, it's a known one I think, awaiting further work that Andrew has been meaning to do for quite some time, yet always getting preempted by security stuff and other emergencies. For guests to migrate safely, I think right now it is required that you limit features visible to them on the source host.
Jan
Quoted 8 lines
None of these require extra state (i.e. registers), hence ...
Quoted 3 lines
Per my current understanding, I would expect more xstates on the VM than supported on the target
server and hence a failure with xstate verification when restoring CPU state.... no extra "xstates" (as you name it).
I see. Makes more sense now. So if i understand correctly, not all these features have states and hence are not all taken into account during xstate verification.
Quoted 10 lines
Quoted 4 lines
However migrating a guest from Source to target works.
Note that these extra avx512 features are all visible to the guest I migrate.
Ah yes. While that's a bug, it's a known one I think, awaiting further work that Andrew has been meaning to do for quite some time, yet always getting preempted by security stuff and other emergencies. For guests to migrate safely, I think right now it is required that you limit features visible to them on the source host.
Noted. Will take that into account when evaluating the impact of unnecessary features.
Quoted 2 lines
Jan
Thanks again Jan
Caleb
Hi Andrew,
Quoted 7 lines
Quoted 6 lines
I was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if( evc->size<PV_XSAVE_HDR_SIZE||
evc->size>PV_XSAVE_SIZE(xfeature_mask) )gotovcpuextstate_out;
Quoted 5 lines
It is certainly more complicated than that.
What that's saying is that Xen doesn't think that the size of the blob matches expectations. That said - I'm in the middle of rewriting this logic because lots of it is subtly wrong.
Following from the check above, I have this other check in the same code block.
if ( evc->size == PV_XSAVE_HDR_SIZE )
; /* Nothing to restore. */
else if ( evc->size < PV_XSAVE_HDR_SIZE + XSTATE_AREA_MIN_SIZE )
ret = -EINVAL; /* Can't be legitimate data. */
else if ( xsave_area_compressed(_xsave_area) )
ret = -EOPNOTSUPP; /* Don't support compressed data. */
else if ( evc->size != PV_XSAVE_SIZE(_xcr0_accum) )
ret = -EINVAL; /* Not legitimate data. */
What do you consider here as legitimate / non-legitimate data ?
Quoted 2 lines
~Andrew
Caleb
Quoted 26 lines · Fonyuy-Asheri Caleb
Quoted 7 lines
Quoted 6 lines
I was able to locate the failure point to the file xen/arch/x86/domctl.c with the following check.
if( evc->size<PV_XSAVE_HDR_SIZE||
evc->size>PV_XSAVE_SIZE(xfeature_mask) )gotovcpuextstate_out;Quoted 5 lines
It is certainly more complicated than that.
What that's saying is that Xen doesn't think that the size of the blob matches expectations. That said - I'm in the middle of rewriting this logic because lots of it is subtly wrong.
Following from the check above, I have this other check in the same code block.
if (
evc->size==PV_XSAVE_HDR_SIZE)
; /* Nothing to restore. */
else if (evc->size<PV_XSAVE_HDR_SIZE+XSTATE_AREA_MIN_SIZE)
ret =-EINVAL; /* Can't be legitimate data. */
else if (xsave_area_compressed(_xsave_area))
ret =-EOPNOTSUPP; /* Don't support compressed data. */
else if (evc->size!=PV_XSAVE_SIZE(_xcr0_accum))
ret =-EINVAL; /* Not legitimate data. */
Quoted 1 line
What do you consider here as legitimate / non-legitimate data ?
In the first case (first "else if"): Simply too small. In the last case:
Size not matching accumulated features.
Jan