MSR load lists on Harpertown
Hello,
I realise this is an old CPU, but I've I've encountered a weird failure on it.
Specifically:
(XEN) CPU Vendor: Intel, Family 6 (0x6), Model 23 (0x17), Stepping 6 (raw 00010676)
[root@harpertown ~]# head /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5420 @ 2.50GHz stepping : 6
microcode : 0x60f
cpu MHz : 2493.756
cache size : 6144 KB
physical id : 0
In Xen, we use an MSR load list to update EFER on vmentry/exit, when hardware doesn't support the EFER field in the VMCB itself. This is a change I made in 4.11 to fix a bug with NX handling on context switching.
After some investigation, it turns out that after vmentry, while the load list has the value 0xd01 (NXE, LMA, LME, SCE), the value loaded into hardware is 0xd00 (NXE, LMA, LME).
I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
Thanks,
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Andrew Cooper writes ("[Xen-devel] MSR load lists on Harpertown"):
Quoted 2 lines
I realise this is an old CPU, but I've I've encountered a weird failure on it.
...
Quoted 4 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
ISTM that Xen should run on these old CPUs and also that it should work, ideally, even if the microcode is buggy.
So presumaly the right answer is to simply disable NX for the guest completely ?
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Ian Jackson
Andrew Cooper writes ("[Xen-devel] MSR load lists on Harpertown"):
Quoted 2 lines
I realise this is an old CPU, but I've I've encountered a weird failure on it.
...
Quoted 3 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Quoted 6 lines
Quoted 1 line
Do you have any suggestions?
ISTM that Xen should run on these old CPUs and also that it should work, ideally, even if the microcode is buggy.
So presumaly the right answer is to simply disable NX for the guest completely ?
As you've observed, when SCE doesn't work, everything is fully hosed.
However, disabling NX on that CPU won't fix the problem, because the problem appears to be using the MSR load list.
Without a microcode fix (if indeed this is a microcode issue, but given how much of vmentry is, I'd be surprised if it is something else), the only fix I can see is to effectively revert the change to use MSR load lists.
However, I really don't want to do this unilaterally, because it will break NX handling on all Intel hardware, and reintroduce a wart into the context switch code which I thought I'd excised properly.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Ping Kevin / Jun.
Quoted 46 lines · Andrew Cooper
Hello,
I realise this is an old CPU, but I've I've encountered a weird failure on it.
Specifically:
(XEN) CPU Vendor: Intel, Family 6 (
0x6), Model 23 (0x17), Stepping 6 (raw 00010676)
[root@harpertown ~]# head/proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5420 @ 2.50GHz stepping : 6
microcode :0x60f
cpu MHz : 2493.756
cache size : 6144 KB
physical id : 0In Xen, we use an MSR load list to update EFER on vmentry/exit, when hardware doesn't support the EFER field in the VMCB itself. This is a change I made in 4.11 to fix a bug with NX handling on context switching.
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
Quoted 8 lines
Thanks,
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Tuesday, December 11, 2018 1:13 AMPing Kevin / Jun.
Quoted 24 lines · Andrew Cooper
Hello,
I realise this is an old CPU, but I've I've encountered a weird failure on it.
Specifically:
(XEN) CPU Vendor: Intel, Family 6 (
0x6), Model 23 (0x17), Stepping 6 (raw 00010676)
[root@harpertown ~]# head/proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5420 @ 2.50GHz stepping : 6
microcode :0x60f
cpu MHz : 2493.756
cache size : 6144 KB
physical id : 0In Xen, we use an MSR load list to update EFER on vmentry/exit, when hardware doesn't support the EFER field in the VMCB itself. This is a change I made in 4.11 to fix a bug with NX handling on context switching.
can you point to the commit number of NX fix?
Quoted 17 lines
Quoted 17 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
btw did you try upgrading to a newer microcode?
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): AADFC41AFE54684AB9EE6CBC0274A5D19BE9A746@SHSMSX101.ccr.corp.intel.com
Quoted 30 lines
From: Tian, Kevin
Sent: Tuesday, December 11, 2018 3:10 PMQuoted 27 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Tuesday, December 11, 2018 1:13 AMPing Kevin / Jun.
Quoted 21 lines · Andrew Cooper
Hello,
I realise this is an old CPU, but I've I've encountered a weird failure on it.
Specifically:
(XEN) CPU Vendor: Intel, Family 6 (
0x6), Model 23 (0x17), Stepping 6 (raw 00010676)
[root@harpertown ~]# head/proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU E5420 @ 2.50GHz stepping : 6
microcode :0x60f
cpu MHz : 2493.756
cache size : 6144 KB
physical id : 0
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
In Xen, we use an MSR load list to update EFER on vmentry/exit, when hardware doesn't support the EFER field in the VMCB itself. This is a change I made in 4.11 to fix a bug with NX handling on context switching.
can you point to the commit number of NX fix?
just found it.
commit fd32dcfe4c9a539f8e5d26ff4c5ca50ee54556b2
Author: Andrew Cooper <[email protected]> Date: Tue May 23 17:32:30 2017 +0100
x86/vmx: Don't leak EFER.NXE into guest context
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 3 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
I see that the latest production microcode on otcshare is slightly newer than exists in the microcode_ctl package. I'll give it a spin.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 39 lines · Andrew Cooper
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
Quoted 6 lines
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
I see that the latest production microcode on otcshare is slightly newer than exists in the
microcode_ctlpackage. I'll give it a spin.
The behaviour is still the same, even with the latest microcode:
(XEN) microcode: CPU0 updated from revision 0x60f to 0x612, date = 2015-08-02
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 47 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Monday, December 17, 2018 10:21 PMQuoted 43 lines · Andrew Cooper
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
Quoted 8 lines
Quoted 2 lines
I see that the latest production microcode on otcshare is slightly newer than exists in the
microcode_ctlpackage. I'll give it a spin.The behaviour is still the same, even with the latest microcode:
(XEN) microcode: CPU0 updated from revision
0x60fto0x612, date = 2015-08-02
Just confirmed that there is no erratum which could explain above behavior.
I see several options here:
a) load guest EFER in Xen context, just before vmentry. make sure no stack access between load and VM enter. but it sounds messy to add such sku specific workaround in that common path (especially just for an old one);
b) leave guest following Xen NXE setting on Harpertown. doing so bears with limitation as what fd32dcfe tries to fix, but it's better than syscall error in 64bit guest. also not clean since some ad-hoc logic that is removed by fd32dcfe may have to be added back;
c) leave above issue unfixed. Harpertown is pretty old...
d) more debug whether above is caused by other software bug
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 63 lines · Kevin
Quoted 47 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Monday, December 17, 2018 10:21 PMQuoted 43 lines · Andrew Cooper
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
Quoted 7 lines
Quoted 2 lines
I see that the latest production microcode on otcshare is slightly newer than exists in the
microcode_ctlpackage. I'll give it a spin.The behaviour is still the same, even with the latest microcode:
(XEN) microcode: CPU0 updated from revision
0x60fto0x612, date = 2015-08-02Just confirmed that there is no erratum which could explain above behavior.
I see several options here:
a) load guest EFER in Xen context, just before vmentry. make sure no stack access between load and VM enter. but it sounds messy to add such sku specific workaround in that common path (especially just for an old one);
Quoted 8 lines
b) leave guest following Xen NXE setting on Harpertown. doing so bears with limitation as what
fd32dcfetries to fix, but it's better than syscall error in 64bit guest. also not clean since some ad-hoc logic that is removed byfd32dcfemay have to be added back;c) leave above issue unfixed. Harpertown is pretty old...
d) more debug whether above is caused by other software bug
Option a) is not possible. While we could in principle turn the line of pop gpr's into movs and avoid the stack accesses, we will triple fault if an NMI/#MC hits.
As for option d), I'm quite certain at this point that it is a hardware/microcode issue, rather than a software issue.
I'd prefer to leave Harpertown cores working than simply dismissing them at this point, because they are still useful for compatibility testing. TBH, I was expecting option b) to be the outcome.
I don't suppose there is any chance of this being published as an erratum which I can reference in the source code?
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 70 lines
Quoted 1 line
Quoted 1 line · On 18.12.18 at 10:56, <[email protected]> wrote:
Quoted 68 lines · Kevin
Quoted 47 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Monday, December 17, 2018 10:21 PMQuoted 43 lines · Andrew Cooper
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
Quoted 7 lines
Quoted 2 lines
I see that the latest production microcode on otcshare is slightly newer than exists in the
microcode_ctlpackage. I'll give it a spin.The behaviour is still the same, even with the latest microcode:
(XEN) microcode: CPU0 updated from revision
0x60fto0x612, date = 2015-08-02Just confirmed that there is no erratum which could explain above behavior.
I see several options here:
a) load guest EFER in Xen context, just before vmentry. make sure no stack access between load and VM enter. but it sounds messy to add such sku specific workaround in that common path (especially just for an old one);
b) leave guest following Xen NXE setting on Harpertown. doing so bears with limitation as what
fd32dcfetries to fix, but it's better than syscall error in 64bit guest. also not clean since some ad-hoc logic that is removed byfd32dcfemay have to be added back;
Quoted 6 lines
Quoted 3 lines
c) leave above issue unfixed. Harpertown is pretty old...
d) more debug whether above is caused by other software bug
Option a) is not possible. While we could in principle turn the line of pop gpr's into movs and avoid the stack accesses,
How would this avoid stack accesses?
Quoted 8 lines
we will triple fault if an NMI/#MC hits.
As for option d), I'm quite certain at this point that it is a hardware/microcode issue, rather than a software issue.
I'd prefer to leave Harpertown cores working than simply dismissing them at this point, because they are still useful for compatibility testing. TBH, I was expecting option b) to be the outcome.
So did I, with ...
Quoted 2 lines
I don't suppose there is any chance of this being published as an erratum which I can reference in the source code?
... such a reference.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 70 lines · Jan Beulich
Quoted 70 lines
Quoted 1 line
Quoted 1 line · On 18.12.18 at 10:56, <[email protected]> wrote:
Quoted 68 lines · Kevin
Quoted 47 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Monday, December 17, 2018 10:21 PMQuoted 43 lines · Andrew Cooper
Quoted 24 lines · Kevin
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
After some investigation, it turns out that after vmentry, while the load list has the value
0xd01(NXE, LMA, LME, SCE), the value loaded into hardware is0xd00(NXE, LMA, LME).I.e. when an MSR load list is used for EFER, we resume the guest with SCE cleared. This is rather terminal for 64bit guests, as syscall/sysret instructions take a #UD fault.
I can't see anything relevant in the Specification Update for this processor.
I've confirmed that by not using a load list, the current value in EFER is preserved once the vmentry is complete, and by disabling the EFER intercept, I can re-set SCE in non-root context and have syscall/sysret work correctly.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
However, given this behaviour, I can't think of any way to context switch NX properly, and leave 64bit guests in a working state.
Do you have any suggestions?
I'm checking internally whether it's a known issue.
from feedbacks that I collected so far, no one is aware of this issue.
Quoted 8 lines
Quoted 2 lines
btw did you try upgrading to a newer microcode?
while I'm approaching more channels, does it work by directly WRMSR to EFER just before VMENTRY for above special case ( thus remove EFER from MSR load/save list), if ucode update also fails? there is just a small window where NX might be wrong setting for Xen, but it might be OK for that carefully-baked code snippet?
Apologies for the delay. I was travelling last week.
We cannot load the full guest's EFER value in Xen context. If the guest has NX disabled, the next stack access in Xen will fault because the NX bit becomes reserved when EFER.NXE is clear.
As for the more general case of loading the guests EFER value (ignoring NXE), we already know that works, because it is how Xen functioned for a decade.
Quoted 7 lines
Quoted 2 lines
I see that the latest production microcode on otcshare is slightly newer than exists in the
microcode_ctlpackage. I'll give it a spin.The behaviour is still the same, even with the latest microcode:
(XEN) microcode: CPU0 updated from revision
0x60fto0x612, date = 2015-08-02Just confirmed that there is no erratum which could explain above behavior.
I see several options here:
a) load guest EFER in Xen context, just before vmentry. make sure no stack access between load and VM enter. but it sounds messy to add such sku specific workaround in that common path (especially just for an old one);
b) leave guest following Xen NXE setting on Harpertown. doing so bears with limitation as what
fd32dcfetries to fix, but it's better than syscall error in 64bit guest. also not clean since some ad-hoc logic that is removed byfd32dcfemay have to be added back;
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
c) leave above issue unfixed. Harpertown is pretty old...
d) more debug whether above is caused by other software bug
Option a) is not possible. While we could in principle turn the line of pop gpr's into movs and avoid the stack accesses,
How would this avoid stack accesses?
Very good point. I blame a complete lack of coffee while writing this email.
The only option to make this work would be to map the stack as executable, and we most certainly aren't doing that as a workaround.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrew Cooper
Hello,
I realise this is an old CPU, but I've I've encountered a weird failure on it.
Specifically:
(XEN) CPU Vendor: Intel, Family 6 (
0x6), Model 23 (0x17), Stepping 6 (raw 00010676)
[root@harpertown ~]# head/proc/cpuinfo
Just to follow up on this thread (seeing as it is referenced in several places), it turns out that I need a dunce cap.
Igor discovered that this is caused by a software bug introduced by me. The proposed fix is
https://lists.xenproject.org/archives/html/xen-devel/2019-04/msg00390.html
The load lists appear to function just fine, even for MSR_EFER.SCE, when Xen programs the VMCS correctly.
Sorry for all the noise.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel