Skip to contentSkip to conversation

Xen fails to resume on AMD Fam15h (and Fam17h?) because of CPUID mismatch

Xen-devel Marek Marczykowski-Górecki 5 participants 9 messages Feb 9, 2020 – May 3, 2020

lore
Share & tools
lore
#0 lore raw

Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?

Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 12 lines · Marek Marczykowski-Górecki

Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Quoted 7 lines

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?

The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc). The OSXSAVE part is a little more surprising, as I wouldn't think behavior there should differ between Intel and AMD. I take your report though to imply that you see the issue on AMD systems only? (You also don't mention the Xen version, which may matter as there may have been ordering changes of when the full original CR4 value gets restored.)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 17 lines · Jan Beulich
Quoted 16 lines · Marek Marczykowski-Górecki

Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Quoted 5 lines
Quoted 3 lines

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?

The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]/

Code is correct.  Commit message needs rework, including in light of this discovery.  (I may eventually split it into two patches.)

Quoted 1 line

The OSXSAVE part is a little more surprising,

Not to me.  The checks only care if feature bits have gone missing, not if new ones have appeared.

mmu_cr4_features includes OSXSAVE (from much later on boot than features get cached), so the s3 path observing the gain of OSXSAVE will have been happening ever since the checks were introduced (even on Intel.)

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Jan Beulich
Quoted 19 lines · Marek Marczykowski-Górecki

Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?

Quoted 7 lines
Quoted 2 lines

The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]/

Code is correct.  Commit message needs rework, including in light of this discovery.  (I may eventually split it into two patches.)

Claudia, do you want to test with this patch?

Quoted 8 lines
Quoted 1 line

The OSXSAVE part is a little more surprising,

Not to me.  The checks only care if feature bits have gone missing, not if new ones have appeared.

mmu_cr4_features includes OSXSAVE (from much later on boot than features get cached), so the s3 path observing the gain of OSXSAVE will have been happening ever since the checks were introduced (even on Intel.)

Is "x86: store cr4 during suspend/resume" patch from Roger related to this?

Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 31 lines · Marek Marczykowski-Górecki
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Jan Beulich
Quoted 19 lines · Marek Marczykowski-Górecki

Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?

Quoted 6 lines
Quoted 2 lines

The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]/

Code is correct.  Commit message needs rework, including in light of this discovery.  (I may eventually split it into two patches.)

Claudia, do you want to test with this patch?

Quoted 1 line
Quoted 1 line

The OSXSAVE part is a little more surprising,

Quoted 8 lines
Quoted 6 lines

Not to me.  The checks only care if feature bits have gone missing, not if new ones have appeared.

mmu_cr4_features includes OSXSAVE (from much later on boot than features get cached), so the s3 path observing the gain of OSXSAVE will have been happening ever since the checks were introduced (even on Intel.)

Is "x86: store cr4 during suspend/resume" patch from Roger related to this?

No.  It wouldn't have any effect on this issue, and hasn't/won't been taken for the reasons I described out in the email chain.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
In reply to Marek Marczykowski-Górecki
Quoted 26 lines · Marek Marczykowski-Górecki
Quoted 24 lines · Andrew Cooper

On 10/02/2020 08:55, Jan Beulich wrote:
On 10.02.2020 00:06, Marek Marczykowski-Górecki wrote:
Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?
The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

Quoted 6 lines
Quoted 4 lines

https://lore.kernel.org/xen-devel/[email protected]

Code is correct. Commit message needs rework, including in light of this discovery. (I may eventually split it into two patches.)

Claudia, do you want to test with this patch?

I'm getting hunk failed in domctl.c applying to R4.1 default repo (fc31, Xen 4.13). I'll see if I can fix it but bear with me, I'm new at this.

Marek: Would you by any chance be willing to merge this into a test branch on your repo, so the rest of us can pull it directly into qubes-builder? It'll take you a fraction of the time it'll take me, plus then zachm and awokd and anyone else can pull it also.

Jan Beulich: Yes, based on symptoms this appears to only affect AMD from what I've seen so far, although I'm not sure if any Intel users have tried the workaround patch. In my case, I experience the exact same symptoms on 4.8, 4.12, and 4.13, and patching 4.8 resulted in successful resume and confirmed the cause of the issue, but I haven't tried patching any other versions.

Thank you everyone for your attention to this issue so far. This is all over my head but I'm happy to provide any additional information I can. I have the Ryzen 2500U.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 30 lines · Claudia
Quoted 28 lines · Marek Marczykowski-Górecki
Quoted 26 lines · Andrew Cooper

On 10/02/2020 08:55, Jan Beulich wrote:
On 10.02.2020 00:06, Marek Marczykowski-Górecki wrote:
Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?
The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Code is correct. Commit message needs rework, including in light of this discovery. (I may eventually split it into two patches.)

Claudia, do you want to test with this patch?

I'm getting hunk failed in domctl.c applying to R4.1 default repo (fc31, Xen 4.13). I'll see if I can fix it but bear with me, I'm new at this.

Marek: Would you by any chance be willing to merge this into a test branch on your repo, so the rest of us can pull it directly into qubes-builder? It'll take you a fraction of the time it'll take me, plus then zachm and awokd and anyone else can pull it also.

Here is one for Xen 4.13:
https://github.com/QubesOS/qubes-vmm-xen/pull/71
builder.conf snippet for qubes-builder:

    BRANCH_vmm_xen=xen-4.13-amd-suspend
    GIT_URL_vmm_xen=https://github.com/marmarek/qubes-vmm-xen

This is already v2 patch from the other thread.

Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 44 lines · Marek Marczykowski-Górecki
Quoted 33 lines · Claudia

February 10, 2020 12:14 PM, "Marek Marczykowski-Górecki" <[email protected]> wrote:

On Mon, Feb 10, 2020 at 11:17:34AM +0000, Andrew Cooper wrote:

On 10/02/2020 08:55, Jan Beulich wrote:
On 10.02.2020 00:06, Marek Marczykowski-Górecki wrote:
Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?
The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]

Code is correct. Commit message needs rework, including in light of this discovery. (I may eventually split it into two patches.)

Quoted 8 lines

Claudia, do you want to test with this patch?

I'm getting hunk failed in domctl.c applying to R4.1 default repo (fc31, Xen 4.13). I'll see if I can fix it but bear with me, I'm new at this.

Marek: Would you by any chance be willing to merge this into a test branch on your repo, so the rest of us can pull it directly into qubes-builder? It'll take you a fraction of the time it'll take me, plus then zachm and awokd and anyone else can pull it also.

Quoted 8 lines

Here is one for Xen 4.13:
https://github.com/QubesOS/qubes-vmm-xen/pull/71
builder.conf snippet for qubes-builder:

BRANCH_vmm_xen=xen-4.13-amd-suspend GIT_URL_vmm_xen=https://github.com/marmarek/qubes-vmm-xen

This is already v2 patch from the other thread.

Thanks! For anyone else trying this, I also had to add NO_CHECK=vmm-xen vmm-xen-stubdom-legacy, I guess because there are no tags on that branch. The RPMs built successfully, and I'll be able to test them as soon as I get the latest R4.1 build downloaded and installed (I'm currently running 4.0).

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Sorry to bump this ancient issue.. Claudia, did you try the RPMs out, or did anyone else? I've had xen* and python*-xen excluded from yum/dnf for a while on my R4.0 so I'm not getting patches on the Xen 4.8 branch. I guess we need to wait til R4.1 to use it in production as it's built for Xen 4.13 though. Unless there's some way to put Xen 4.13 on R4.0 safely.

Quoted 66 lines · Claudia

February 11, 2020 9:09 PM, "Marek Marczykowski-Górecki" <

Quoted 3 lines · [email protected]> wrote:
Quoted 1 line · Claudia

February 10, 2020 12:14 PM, "Marek Marczykowski-Górecki" <

Quoted 21 lines · [email protected]> wrote:
Quoted 21 lines · Andrew Cooper

On 10/02/2020 08:55, Jan Beulich wrote:
On 10.02.2020 00:06, Marek Marczykowski-Górecki wrote:
Hi,

Multiple Qubes users have reported issues with resuming from S3 on AMD systems (Ryzen 2500U, Ryzen Pro 3700U, maybe more). The error message is:

(XEN) CPU0: cap[ 1] is 7ed8320b (expected f6d8320b)

If I read it right, this is:
- OSXSAVE: 0 -> 1
- HYPERVISOR: 1 -> 0

Commenting out the panic on a failed recheck_cpu_features() in power.c makes the system work after resume, reportedly stable. But that doesn't sounds like a good idea generally.

Quoted 7 lines
Quoted 7 lines

Is this difference a Xen fault (some missing MSR / other register restore on resume)? Or BIOS vendor / AMD, that could be worked around in Xen?
The transition of the HYPERVISOR bit is definitely a Xen issue, with Andrew having sent a patch already (iirc).

https://lore.kernel.org/xen-devel/[email protected]

Quoted 7 lines
Quoted 7 lines

Code is correct. Commit message needs rework, including in light of this discovery. (I may eventually split it into two patches.)

Claudia, do you want to test with this patch?

I'm getting hunk failed in domctl.c applying to R4.1 default repo

(fc31, Xen 4.13). I'll see if I

Quoted 3 lines
Quoted 3 lines

can fix it but bear with me, I'm new at this.

Marek: Would you by any chance be willing to merge this into a test

branch on your repo, so the

Quoted 1 line
Quoted 1 line

rest of us can pull it directly into qubes-builder? It'll take you a

fraction of the time it'll

Quoted 10 lines
Quoted 1 line

take me, plus then zachm and awokd and anyone else can pull it also.

Here is one for Xen 4.13:
https://github.com/QubesOS/qubes-vmm-xen/pull/71
builder.conf snippet for qubes-builder:

BRANCH_vmm_xen=xen-4.13-amd-suspend GIT_URL_vmm_xen=https://github.com/marmarek/qubes-vmm-xen

This is already v2 patch from the other thread.

Thanks! For anyone else trying this, I also had to add NO_CHECK=vmm-xen vmm-xen-stubdom-legacy, I guess because there are no tags on that branch. The RPMs built successfully, and I'll be able to test them as soon as I get the latest R4.1 build downloaded and installed (I'm currently running 4.0).

Signature · 3 lines
- - - - - -
Zachary Muller
http://muller.is/