Skip to contentSkip to conversation

PM: Fix crash on graph trace through x86 suspend

PATCH In review Todd Brandt 3 participants 7 messages Mar 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM: Fix crash on graph trace through x86 suspend

Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.

To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.

---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -0
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+	/*
+	 * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+	 * inconsistent call/return info after it jumps to the wakeup vector
+	 */
+	pause_graph_tracing();
 	do_suspend_lowlevel();
+	unpause_graph_tracing();
 	return 0;
 }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 11 lines · Todd Brandt

Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.

To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.

OK

I guess we'll need that in -stable, right?

Quoted 37 lines
---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -1
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       /*
+        * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+        * inconsistent call/return info after it jumps to the wakeup vector
+        */
+       pause_graph_tracing();
        do_suspend_lowlevel();
+       unpause_graph_tracing();
        return 0;
 }
 
--

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Todd Brandt

Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.

To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.

Quoted 5 lines
Quoted 1 line

OK

I guess we'll need that in -stable, right?

Sure, it's pretty important. The new analyze_suspend features are going to rely pretty heavily on full graph trace of suspend (all we can do is standby and freeze now because of the bug). Thanks!

Quoted 38 lines
Quoted 38 lines
---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -1
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       /*
+        * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+        * inconsistent call/return info after it jumps to the wakeup vector
+        */
+       pause_graph_tracing();
        do_suspend_lowlevel();
+       unpause_graph_tracing();
        return 0;
 }
 
--

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 15 lines · Todd Brandt
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Todd Brandt

Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.

To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.

Quoted 7 lines
Quoted 3 lines

OK

I guess we'll need that in -stable, right?

Sure, it's pretty important. The new analyze_suspend features are going to rely pretty heavily on full graph trace of suspend (all we can do is standby and freeze now because of the bug). Thanks!

OK, applied, but let Steven and the x86 folks see it.

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -0
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       /*
+        * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+        * inconsistent call/return info after it jumps to the wakeup vector
+        */
+       pause_graph_tracing();
        do_suspend_lowlevel();
+       unpause_graph_tracing();
        return 0;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

--
2.1.4

--

Thanks,
Rafael

#4 lore raw

Well, fix up the Steven's address.

Quoted 66 lines · Rafael J. Wysocki
Quoted 15 lines · Todd Brandt
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Todd Brandt

Pause/unpause graph tracing around do_suspend_lowlevel as it has inconsistent call/return info after it jumps to the wakeup vector. The graph trace buffer will otherwise become misaligned and may eventually crash and hang on suspend.

To reproduce the issue and test the fix:
Run a function_graph trace over suspend/resume and set the graph function to suspend_devices_and_enter. This consistently hangs the system without this fix.

Quoted 7 lines
Quoted 3 lines

OK

I guess we'll need that in -stable, right?

Sure, it's pretty important. The new analyze_suspend features are going to rely pretty heavily on full graph trace of suspend (all we can do is standby and freeze now because of the bug). Thanks!

OK, applied, but let Steven and the x86 folks see it.

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -0
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       /*
+        * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+        * inconsistent call/return info after it jumps to the wakeup vector
+        */
+       pause_graph_tracing();
        do_suspend_lowlevel();
+       unpause_graph_tracing();
        return 0;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

--
2.1.4

--

Thanks,
Rafael

#5 lore raw
Quoted 1 line · On Thu, 3 Mar 2016 02:36:26 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 1 line

OK, applied, but let Steven and the x86 folks see it.

The below patch looks fine to me. Anything else I should look at?

-- Steve

Quoted 40 lines
Quoted 40 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
 
 
---
 arch/x86/kernel/acpi/sleep.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kernel/acpi/sleep.c +7 -0
index d1daead..311360e 100644
@@ -16,6 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/realmode.h>
 
+#include <linux/ftrace.h>
 #include "../../realmode/rm/wakeup.h"
 #include "sleep.h"
 
@@ -107,7 +108,13 @@ int x86_acpi_suspend_lowlevel(void)
        saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
 
+       /*
+        * Pause/unpause graph tracing around do_suspend_lowlevel as it has
+        * inconsistent call/return info after it jumps to the wakeup vector
+        */
+       pause_graph_tracing();
        do_suspend_lowlevel();
+       unpause_graph_tracing();
        return 0;
 }
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

--
2.1.4

Thanks,
Rafael

#6 lore raw
Quoted 6 lines · Steven Rostedt
Quoted 1 line · On Thu, 3 Mar 2016 02:36:26 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 1 line

OK, applied, but let Steven and the x86 folks see it.

The below patch looks fine to me. Anything else I should look at?

No, that was it, thanks!