Yet another S3 issue in Xen 4.14
Marek Marczykowski-Górecki
Reviewed-by Jan BeulichHi,
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:
commit 4304ff420e51b973ec9eb9dafd64a917dd9c0fb1
Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000
x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in restore_rest_processor_state() was actually fighting later code in enter_state() which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.
Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.
The only remaing piece of restoration is load_system_tables(), so suspend.c can be deleted in its entirety.
Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Any idea?
PS This is different than "Xen crash after S3 suspend - Xen 4.13" thread, as this one broke with 4.13 -> 4.14 update.
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?
Quoted 30 lines · Marek Marczykowski-Górecki
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Quoted 8 lines
Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Since bisection may also point you at some intermediate breakage, which these last results of yours seem to support, could you check whether 55f8c389d434 put immediately on top of the above commit makes a difference, and if so resume bisecting from there?
Jan
Quoted 29 lines · Marek Marczykowski-Górecki
Hi,
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.
Quoted 6 lines
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
Reading the patch and discussion about it, I think the important details is this uses EFI boot.
That may also explain why I haven't see it while bisecting the other S3 issue, where I use legacy boot path.
Quoted 10 lines
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Any idea?
PS This is different than "Xen crash after S3 suspend - Xen 4.13" thread, as this one broke with 4.13 -> 4.14 update.
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?
Quoted 31 lines · Marek Marczykowski-Górecki
Quoted 30 lines · Marek Marczykowski-Górecki
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Quoted 8 lines
Quoted 3 lines
Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
Reading the patch and discussion about it, I think the important details is this uses EFI boot.
That may also explain why I haven't see it while bisecting the other S3 issue, where I use legacy boot path.
Hmm, interesting. I didn't think though that the code paths altered by the commit above would be in any way dependent upon the way Xen was booted. But if that's the observation, then perhaps there's something I'm unaware of.
Jan
Quoted 40 lines · Jan Beulich
Quoted 30 lines · Marek Marczykowski-Górecki
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 8 lines
Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Quoted 4 lines
Since bisection may also point you at some intermediate breakage, which these last results of yours seem to support, could you check whether
55f8c389d434put immediately on top of the above commit makes a difference, and if so resume bisecting from there?
Nope, 4304ff420e51b973ec9eb9dafd64a917dd9c0fb1 with 55f8c389d434 on top it still hangs on resume.
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?
Quoted 40 lines · Marek Marczykowski-Górecki
Quoted 39 lines · Jan Beulich
Quoted 38 lines · Marek Marczykowski-Górecki
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Quoted 6 lines
Quoted 4 lines
Since bisection may also point you at some intermediate breakage, which these last results of yours seem to support, could you check whether
55f8c389d434put immediately on top of the above commit makes a difference, and if so resume bisecting from there?Nope,
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1with55f8c389d434on top it still hangs on resume.
Ok. I'll see about breaking the change apart so we can bisect which specific bit of code movement broke things.
~Andrew
Quoted 45 lines · Andrew Cooper
Quoted 44 lines · Marek Marczykowski-Górecki
Quoted 43 lines · Jan Beulich
Quoted 30 lines · Marek Marczykowski-Górecki
After patching the previous issue ("x86/S3: Fix Shadow Stack resume path") I still encounter issues resume from S3.
Since I had it working on Xen 4.13 on this particular hardware (Thinkpad P52), I bisected it and got this:commit
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1Author: Andrew Cooper <[email protected]> Date: Wed Dec 11 20:59:19 2019 +0000x86/S3: Drop {save,restore}_rest_processor_state() completely
There is no need to save/restore FS/GS/XCR0 state. It will be handled suitably on the context switch away from the idle.
The CR4 restoration in
restore_rest_processor_state()was actually fighting later code inenter_state()which tried to keep CR4.MCE clear until everything was set up. Delete the intermediate restoration, and defer final restoration until after MCE is reconfigured.Restoring PAT can be done earlier, and ideally before paging is enabled. By moving it into the trampoline during the setup for 64bit, the call can be dropped from
cpu_init(). The EFI path boot path doesn't disable paging, so make the adjustment when switching onto Xen's pagetables.The only remaing piece of restoration is
load_system_tables(), sosuspend.ccan be deleted in its entirety.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 8 lines
Parent of this commit suspends and resumes just fine. With this commit applied, it (I think) it panics, at least I get reboot after 5s. Sadly, I don't have serial console there.
I tried also master and stable-4.14 with this commit reverted (and also the other fix applied), but it doesn't work. In this case I get a hang on resume (power led still flashing, but fan woke up). There are probably some other dependencies.
Since bisection may also point you at some intermediate breakage, which these last results of yours seem to support, could you check whether
55f8c389d434put immediately on top of the above commit makes a difference, and if so resume bisecting from there?
Quoted 5 lines
Quoted 2 lines
Nope,
4304ff420e51b973ec9eb9dafd64a917dd9c0fb1with55f8c389d434on top it still hangs on resume.Ok. I'll see about breaking the change apart so we can bisect which specific bit of code movement broke things.
I've done another bisect on the commit broken up in separate changes
(https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/dbg-s3)
and the bad part seems to be this:
From dbdb32f8c265295d6af7cd4cd0aa12b6d04a0430 Mon Sep 17 00:00:00 2001
From: Andrew Cooper <[email protected]>
Date: Fri, 2 Oct 2020 15:40:22 +0100
Subject: [PATCH 1/1] CR4
--- xen/arch/x86/acpi/power.c | 9 ++++----- xen/arch/x86/acpi/suspend.c | 3 --- 2 files changed, 4 insertions(+), 8 deletions(-)
xen/arch/x86/acpi/power.c +4 -5
@@ -195,7 +195,6 @@ static int enter_state(u32 state)unsigned long flags;int error;struct cpu_info *ci; -unsigned long cr4;if ( (state <=ACPI_STATE_S0 ) || (state >ACPI_S_STATES_MAX ) )return -EINVAL ;
@@ -270,15 +269,15 @@ static int enter_state(u32 state) system_state = SYS_STATE_resume; -/* Restore CR4 and EFER from cached values. */ - cr4 =read_cr4 (); -write_cr4 (cr4 & ~X86_CR4_MCE ); +/* Restore EFER from cached value. */ write_efer (read_efer ());device_power_up (SAVED_ALL );mcheck_init (&boot_cpu_data, false); -write_cr4 (cr4); + +/* Restore CR4 from cached value, now MCE is set up. */ +write_cr4 (read_cr4 ());printk (XENLOG_INFO "Finishing wakeup from ACPI S%d state.\n" , state);
xen/arch/x86/acpi/suspend.c +0 -3
@@ -23,7 +23,4 @@ void save_rest_processor_state(void)void restore_rest_processor_state (void ) {load_system_tables (); - -/* Restore full CR4 (inc MCE) now that the IDT is in place. */ -write_cr4 (mmu_cr4_features); }
Signature · 8 lines
2.20.1 -- 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?
Quoted 8 lines · Marek Marczykowski-Górecki
I've done another bisect on the commit broken up in separate changes
(https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/dbg-s3)
and the bad part seems to be this:From
dbdb32f8c265295d6af7cd4cd0aa12b6d04a0430Mon Sep 17 00:00:00 2001
From: Andrew Cooper <[email protected]>
Date: Fri, 2 Oct 2020 15:40:22 +0100
Subject: [PATCH 1/1] CR4
Interesting - I was wild guessing so yesterday, but couldn't come up with even a vague reason why this would be. I think you could further split it up:
Quoted 11 lines
xen/arch/x86/acpi/power.c +0
-1@@ -195,7 +195,6 @@ static int enter_state(u32 state)unsigned long flags;int error;struct cpu_info *ci; -unsigned long cr4;if ( (state <=ACPI_STATE_S0 ) || (state >ACPI_S_STATES_MAX ) )return -EINVAL ;
xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 273
Quoted 8 lines
xen/arch/x86/acpi/power.c +1
-3@@ -270,15 +269,15 @@ static int enter_state(u32 state) system_state = SYS_STATE_resume; -/* Restore CR4 and EFER from cached values. */ - cr4 =read_cr4 (); -write_cr4 (cr4 & ~X86_CR4_MCE ); +/* Restore EFER from cached value. */ write_efer (read_efer ());
This one should be possible to leave in place despite ...
xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 280
Quoted 7 lines
xen/arch/x86/acpi/power.c +3
-1device_power_up (SAVED_ALL );mcheck_init (&boot_cpu_data, false); -write_cr4 (cr4); + +/* Restore CR4 from cached value, now MCE is set up. */ +write_cr4 (read_cr4 ());
... this change.
Further, while I can't see how the set_in_cr4() in mcheck_init() could badly interact with the CR4 writes here, another option might be to suppress it when system_state == SYS_STATE_resume && c == &boot_cpu_data (or !bsp && c == &boot_cpu_data).
xen/arch/x86/acpi/suspend.c void save_rest_processor_state(void) · line 26
Quoted 10 lines
xen/arch/x86/acpi/suspend.c +0
-3@@ -23,7 +23,4 @@ void save_rest_processor_state(void)void restore_rest_processor_state (void ) {load_system_tables (); - -/* Restore full CR4 (inc MCE) now that the IDT is in place. */ -write_cr4 (mmu_cr4_features); }
This one should be possible to leave in place despite the other changes.
Jan
Quoted 48 lines · Jan Beulich
Quoted 8 lines · Marek Marczykowski-Górecki
I've done another bisect on the commit broken up in separate changes
(https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/dbg-s3)
and the bad part seems to be this:From
dbdb32f8c265295d6af7cd4cd0aa12b6d04a0430Mon Sep 17 00:00:00 2001
From: Andrew Cooper <[email protected]>
Date: Fri, 2 Oct 2020 15:40:22 +0100
Subject: [PATCH 1/1] CR4Interesting - I was wild guessing so yesterday, but couldn't come up with even a vague reason why this would be. I think you could further split it up:
Quoted 11 lines
xen/arch/x86/acpi/power.c +0
-1@@ -195,7 +195,6 @@ static int enter_state(u32 state)unsigned long flags;int error;struct cpu_info *ci; -unsigned long cr4;if ( (state <=ACPI_STATE_S0 ) || (state >ACPI_S_STATES_MAX ) )return -EINVAL ;xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 273
Quoted 8 lines
xen/arch/x86/acpi/power.c +1
-3@@ -270,15 +269,15 @@ static int enter_state(u32 state) system_state = SYS_STATE_resume; -/* Restore CR4 and EFER from cached values. */ - cr4 =read_cr4 (); -write_cr4 (cr4 & ~X86_CR4_MCE ); +/* Restore EFER from cached value. */ write_efer (read_efer ());This one should be possible to leave in place despite ...
xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 280
Quoted 7 lines
xen/arch/x86/acpi/power.c +3
-1device_power_up (SAVED_ALL );mcheck_init (&boot_cpu_data, false); -write_cr4 (cr4); + +/* Restore CR4 from cached value, now MCE is set up. */ +write_cr4 (read_cr4 ());... this change.
Further, while I can't see how the
set_in_cr4()inmcheck_init()could badly interact with the CR4 writes here, another option might be to suppress it whensystem_state==SYS_STATE_resume&& c ==&boot_cpu_data(or !bsp && c ==&boot_cpu_data).
Quoted 12 lines
xen/arch/x86/acpi/suspend.c void save_rest_processor_state(void) · line 26
Quoted 10 lines
xen/arch/x86/acpi/suspend.c +0
-3@@ -23,7 +23,4 @@ void save_rest_processor_state(void)void restore_rest_processor_state (void ) {load_system_tables (); - -/* Restore full CR4 (inc MCE) now that the IDT is in place. */ -write_cr4 (mmu_cr4_features); }This one should be possible to leave in place despite the other changes.
We're continuing to debug in private. mmu_cr4_features and read_cr4() are equivalent (as expected), but very different from MINIMAL_CR4 which is what the trampoline configures, so I think we're suffering a CR4-related #UD/#GP somewhere in device_power_up() or mcheck_init().
Its not INVPCID. Trying others.
~Andrew
Quoted 62 lines · Andrew Cooper
Quoted 48 lines · Jan Beulich
Quoted 8 lines · Marek Marczykowski-Górecki
I've done another bisect on the commit broken up in separate changes
(https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/dbg-s3)
and the bad part seems to be this:From
dbdb32f8c265295d6af7cd4cd0aa12b6d04a0430Mon Sep 17 00:00:00 2001
From: Andrew Cooper <[email protected]>
Date: Fri, 2 Oct 2020 15:40:22 +0100
Subject: [PATCH 1/1] CR4Interesting - I was wild guessing so yesterday, but couldn't come up with even a vague reason why this would be. I think you could further split it up:
Quoted 11 lines
xen/arch/x86/acpi/power.c +0
-1@@ -195,7 +195,6 @@ static int enter_state(u32 state)unsigned long flags;int error;struct cpu_info *ci; -unsigned long cr4;if ( (state <=ACPI_STATE_S0 ) || (state >ACPI_S_STATES_MAX ) )return -EINVAL ;xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 273
Quoted 8 lines
xen/arch/x86/acpi/power.c +1
-3@@ -270,15 +269,15 @@ static int enter_state(u32 state) system_state = SYS_STATE_resume; -/* Restore CR4 and EFER from cached values. */ - cr4 =read_cr4 (); -write_cr4 (cr4 & ~X86_CR4_MCE ); +/* Restore EFER from cached value. */ write_efer (read_efer ());This one should be possible to leave in place despite ...
xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 280
Quoted 7 lines
xen/arch/x86/acpi/power.c +3
-1device_power_up (SAVED_ALL );mcheck_init (&boot_cpu_data, false); -write_cr4 (cr4); + +/* Restore CR4 from cached value, now MCE is set up. */ +write_cr4 (read_cr4 ());... this change.
Further, while I can't see how the
set_in_cr4()inmcheck_init()could badly interact with the CR4 writes here, another option might be to suppress it whensystem_state==SYS_STATE_resume&& c ==&boot_cpu_data(or !bsp && c ==&boot_cpu_data).Quoted 12 lines
xen/arch/x86/acpi/suspend.c void save_rest_processor_state(void) · line 26
Quoted 10 lines
xen/arch/x86/acpi/suspend.c +0
-3@@ -23,7 +23,4 @@ void save_rest_processor_state(void)void restore_rest_processor_state (void ) {load_system_tables (); - -/* Restore full CR4 (inc MCE) now that the IDT is in place. */ -write_cr4 (mmu_cr4_features); }This one should be possible to leave in place despite the other changes.
Quoted 6 lines
We're continuing to debug in private.
mmu_cr4_featuresandread_cr4()are equivalent (as expected), but very different fromMINIMAL_CR4which is what the trampoline configures, so I think we're suffering a CR4-related #UD/#GP somewhere indevice_power_up()ormcheck_init().Its not INVPCID. Trying others.
Some update:
It's OSFXSR + probably other flags, the crash happens in enter_state()->device_power_up()->time_resume()->efi_get_time()
This also explains the difference between legacy / UEFI boot.
Disabling efi_get_time() or setting CR4 earlier solves _this_ issue, but applied on top of stable-4.14 still doesn't work. Looks like there is yet another S3 breakage in between. I'm bisecting it further...
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?
Quoted 3 lines · Marek Marczykowski-Górecki
Disabling
efi_get_time()or setting CR4 earlier solves _this_ issue, but applied on top of stable-4.14 still doesn't work. Looks like there is yet another S3 breakage in between. I'm bisecting it further...
This time I get to this commit:
commit 8e2aa76dc1670e82eaa15683353853bc66bf54fc (refs/bisect/bad)
Author: Dario Faggioli <[email protected]> Date: Thu May 28 23:29:44 2020 +0200
xen: credit2: limit the max number of CPUs in a runqueue
The failing effect after S3 resume is slightly different and not really deterministic - sometimes it hangs immediately, sometimes the system is interactive for few seconds and then hangs and sometimes it crashes (looks like panic).
I've tried to switch to credit1, but this seems to be broken in yet another way, much earlier (commits at which S3 works with credit2, crashes on S3 resume with credit1).
(few hours later)
I managed to setup kdump kernel and got a copy of vmcore after the crash. Then extracted crash message using strings:
(XEN) Entering ACPI S3 state.
(XEN) [VT-D]Passed iommu=no-igfx option. Disabling IGD VT-d engine. (XEN) mce_intel.c:773: MCA Capability: firstbank 0, extended MCE MSR 0, BCAST, CMCI (XEN) CPU0 CMCI LVT vector (0xf1) already installed
(XEN) Finishing wakeup from ACPI S3 state.
(XEN) Enabling non-boot CPUs ...
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) [VT-D]intremap.c:564: MSI index (65535) has an empty entry
(XEN) Assertion 'c2rqd(sched_unit_master(unit)) == svc->rqd' failed at credit2.c:2273
(XEN) ----[ Xen-4.14-unstable x86_64 debug=y Not tainted ]----
(XEN) CPU: 8
(XEN) RIP: e008:[<ffff82d040242725>] credit2.c#csched2_unit_wake+0x14f/0x151
(XEN) RFLAGS: 0000000000010087 CONTEXT: hypervisor (d0v0)
(XEN) rax: ffff830250b609e0 rbx: ffff830250b18f10 rcx: 0000003210631000 (XEN) rdx: ffff830250b604a0 rsi: 0000000000000008 rdi: ffff830250b60846 (XEN) rbp: ffff830250ba7d98 rsp: ffff830250ba7d78 r8: deadbeefdeadf00d (XEN) r9: deadbeefdeadf00d r10: 0000000000000000 r11: 0000000000000000 (XEN) r12: ffff830250b0e040 r13: ffff82d04044abc0 r14: 0000000000000008 (XEN) r15: 2f3d053d56f91b80 cr0: 0000000080050033 cr4: 0000000000362660 (XEN) cr3: 0000000210270000 cr2: 0000000000000000 (XEN) fsb: 000077a6b25a2b80 gsb: ffff8881b5400000 gss: 0000000000000000
(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d040242725> (credit2.c#csched2_unit_wake+0x14f/0x151):
(XEN) df e8 dc bd ff ff eb ad <0f> 0b 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 (XEN) Xen stack trace from rsp=ffff830250ba7d78:
(XEN) ffff830250b10000 ffff830250b18f10 ffff830250b18f10 ffff830250b60840 (XEN) ffff830250ba7de8 ffff82d04024b8eb 0000000000000202 ffff830250b60840 (XEN) ffff830250b66018 0000000000000001 0000000000000000 0000000000000000 (XEN) ffff830250b66018 ffff830250b10000 ffff830250ba7e58 ffff82d040207c3f (XEN) ffff82d0403673d4 ffff82d0403673c8 ffff82d0403673d4 ffff82d0403673c8 (XEN) ffff82d0403673d4 ffff82d0403673c8 ffff82d0403673d4 ffff830250ba7ef8 (XEN) 0000000000000180 ffff830250b45000 deadbeefdeadf00d 0000000000000003 (XEN) ffff830250ba7ee8 ffff82d0402e7759 0000000000000001 0000000000000005 (XEN) 0000000000000000 deadbeefdeadf00d deadbeefdeadf00d ffff82d0403673c8 (XEN) ffff82d0403673d4 ffff82d0403673c8 ffff82d0403673d4 ffff82d0403673c8 (XEN) ffff82d0403673d4 ffff830250b45000 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 00007cfdaf4580e7 ffff82d040367432 (XEN) ffff888192157320 0000000000000000 ffffffff810eb370 0000000000000000 (XEN) ffff8881b0a626c0 0000000000000005 0000000000000246 0000000000000001 (XEN) ffffea0006087608 ffffea0006087608 0000000000000018 ffffffff8100230a (XEN) 0000000000000000 0000000000000005 0000000000000001 0000010000000000 (XEN) ffffffff8100230a 000000000000e033 0000000000000246 ffffc90002653cf0 (XEN) 000000000000e02b d2c2c2c2c2c2c2c2 c2c2c2c2c2c2c282 c2c2c2c2c2c2c2c2 (XEN) c2e2c2c2c2c2c2c2 0000e01000000008 ffff830250b45000 0000003210631000 (XEN) 0000000000362660 0000000000000000 8000000250bc3002 0000060100000000 (XEN) Xen call trace: (XEN) [<ffff82d040242725>] R credit2.c#csched2_unit_wake+0x14f/0x151 (XEN) [<ffff82d04024b8eb>] F vcpu_wake+0x105/0x52c (XEN) [<ffff82d040207c3f>] F do_vcpu_op+0x1b0/0x631 (XEN) [<ffff82d0402e7759>] F pv_hypercall+0x28f/0x57d (XEN) [<ffff82d040367432>] F lstar_enter+0x112/0x120
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 8:
(XEN) Assertion 'c2rqd(sched_unit_master(unit)) == svc->rqd' failed at credit2.c:2273 (XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
(XEN) Executing kexec image on cpu8
(XEN) Shot down all CPUs
Looks pretty similar to the other thread "Xen crash after S3 suspend - Xen 4.13" - adding Jürgen. Since I've seen this one on Xen 4.13 before, I think the commit I've found just makes it much more likely to happen.
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?