Skip to contentSkip to conversation

x86/suspend: disable watchdog before calling console_start_sync()

PATCH Superseded Igor Druzhinin 4 participants 7 messages Jan 27, 2020 – Jan 28, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/suspend: disable watchdog before calling console_start_sync()

... and enable it after exiting S-state. Otherwise accumulated output in serial buffer might easily trigger the watchdog if it's still enabled after entering sync transmission mode.

The issue observed on machines which, unfortunately, generate non-0 output in CPU offline callbacks.

---
 xen/arch/x86/acpi/power.c | 3 +++
 1 file changed, 3 insertions(+)
xen/arch/x86/acpi/power.c +3 -0
index 8078352..62384a4 100644
@@ -23,6 +23,7 @@
 #include <xen/domain.h>
 #include <xen/console.h>
 #include <xen/iommu.h>
+#include <xen/watchdog.h>
 #include <xen/cpu.h>
 #include <public/platform.h>
 #include <asm/tboot.h>
@@ -223,6 +224,7 @@ static int enter_state(u32 state)
 
     acpi_sleep_prepare(state);
 
+    watchdog_disable();
     console_start_sync();
     printk("Entering ACPI S%d state.\n", state);
 
@@ -281,6 +283,7 @@ static int enter_state(u32 state)
         tboot_s3_error(error);
 
     console_end_sync();
+    watchdog_enable();
 
     microcode_update_one(true);
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 3 lines · Igor Druzhinin

... and enable it after exiting S-state. Otherwise accumulated output in serial buffer might easily trigger the watchdog if it's still enabled after entering sync transmission mode.

Can't you just process the watchdog in serial_start_sync instead of disabling it?

Thanks, Roger.

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

#2 lore raw
Quoted 7 lines · Roger Pau Monné
Quoted 3 lines · Igor Druzhinin

... and enable it after exiting S-state. Otherwise accumulated output in serial buffer might easily trigger the watchdog if it's still enabled after entering sync transmission mode.

Can't you just process the watchdog in serial_start_sync instead of disabling it?

I think it would be layering violation. Plus in every other place we're enabling sync mode we're also disabling watchdog as well.

I also think it's beneficial to disable watchdog before entering firmware.

Igor

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

Reviewed-by
#3 lore raw
Quoted 11 lines · Igor Druzhinin
Quoted 7 lines · Roger Pau Monné
Quoted 3 lines · Igor Druzhinin

... and enable it after exiting S-state. Otherwise accumulated output in serial buffer might easily trigger the watchdog if it's still enabled after entering sync transmission mode.

Can't you just process the watchdog in serial_start_sync instead of disabling it?

I think it would be layering violation. Plus in every other place we're enabling sync mode we're also disabling watchdog as well.

Not in every place, but indeed there's quite a lot of callers that already disable the watchdog.

I wonder whether this should be put inside of console_start_sync itself, and a parameter added to the function if not all callers want the watchdog disabled (same for console_end_sync).

Quoted 1 line

I also think it's beneficial to disable watchdog before entering firmware.

I don't have objections.

Thanks.

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

#4 lore raw
Quoted 13 lines · Roger Pau Monné
Quoted 9 lines · Igor Druzhinin
Quoted 6 lines · Roger Pau Monné
Quoted 3 lines · Igor Druzhinin

... and enable it after exiting S-state. Otherwise accumulated output in serial buffer might easily trigger the watchdog if it's still enabled after entering sync transmission mode.

Can't you just process the watchdog in serial_start_sync instead of disabling it?

I think it would be layering violation. Plus in every other place we're enabling sync mode we're also disabling watchdog as well.

Not in every place, but indeed there's quite a lot of callers that already disable the watchdog.

Quoted 8 lines

I wonder whether this should be put inside of console_start_sync itself, and a parameter added to the function if not all callers want the watchdog disabled (same for console_end_sync).

Quoted 1 line

I also think it's beneficial to disable watchdog before entering firmware.

I don't have objections.

Lets go with this for now.  It needs backporting, whereas API cleanup probably wouldn't.

~Andrew

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

#5 lore raw
In reply to Igor Druzhinin
Quoted 9 lines · Igor Druzhinin
xen/arch/x86/acpi/power.c +1 -0
@@ -223,6 +224,7 @@ static int enter_state(u32 state)
 
     acpi_sleep_prepare(state);
 
+    watchdog_disable();
     console_start_sync();
     printk("Entering ACPI S%d state.\n", state);
 

xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 288

Quoted 6 lines
xen/arch/x86/acpi/power.c +1 -0
@@ -281,6 +283,7 @@ static int enter_state(u32 state)
         tboot_s3_error(error);
 
     console_end_sync();
+    watchdog_enable();
 
     microcode_update_one(true);

Between these two there's a "goto done;" which also wants watchdog_enable() added then.

Jan

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

#6 lore raw
Quoted 12 lines · Jan Beulich
Quoted 11 lines · Igor Druzhinin
xen/arch/x86/acpi/power.c +1 -0
@@ -223,6 +224,7 @@ static int enter_state(u32 state)
 
     acpi_sleep_prepare(state);
 
+    watchdog_disable();
     console_start_sync();
     printk("Entering ACPI S%d state.\n", state);
 
@@ -281,6 +283,7 @@ static int enter_state(u32 state)
         tboot_s3_error(error);
 
Quoted 7 lines

xen/arch/x86/acpi/power.c static int enter_state(u32 state) · line 288

Quoted 4 lines
xen/arch/x86/acpi/power.c +1 -0
     console_end_sync();
+    watchdog_enable();
 
     microcode_update_one(true);

Between these two there's a "goto done;" which also wants watchdog_enable() added then.

Indeed, thanks for noticing. Will send v2 shortly.

Igor

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