summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch
new file mode 100644
index 00000000..524e6d1d
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.6/0029-PM-Hibernate-Fix-s2disk-regression-related-to-freezi.patch
@@ -0,0 +1,100 @@
1From d483054fe4c66eeb7a03fdc97519b07edb1dc803 Mon Sep 17 00:00:00 2001
2From: "Rafael J. Wysocki" <rjw@sisk.pl>
3Date: Sun, 29 Jan 2012 20:35:52 +0100
4Subject: [PATCH 29/87] PM / Hibernate: Fix s2disk regression related to
5 freezing workqueues
6
7commit 181e9bdef37bfcaa41f3ab6c948a2a0d60a268b5 upstream.
8
9Commit 2aede851ddf08666f68ffc17be446420e9d2a056
10
11 PM / Hibernate: Freeze kernel threads after preallocating memory
12
13introduced a mechanism by which kernel threads were frozen after
14the preallocation of hibernate image memory to avoid problems with
15frozen kernel threads not responding to memory freeing requests.
16However, it overlooked the s2disk code path in which the
17SNAPSHOT_CREATE_IMAGE ioctl was run directly after SNAPSHOT_FREE,
18which caused freeze_workqueues_begin() to BUG(), because it saw
19that worqueues had been already frozen.
20
21Although in principle this issue might be addressed by removing
22the relevant BUG_ON() from freeze_workqueues_begin(), that would
23reintroduce the very problem that commit 2aede851ddf08666f68ffc17be4
24attempted to avoid into that particular code path. For this reason,
25to fix the issue at hand, introduce thaw_kernel_threads() and make
26the SNAPSHOT_FREE ioctl execute it.
27
28Special thanks to Srivatsa S. Bhat for detailed analysis of the
29problem.
30
31Reported-and-tested-by: Jiri Slaby <jslaby@suse.cz>
32Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
33Acked-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
34Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35---
36 include/linux/freezer.h | 2 ++
37 kernel/power/process.c | 9 +++++++++
38 kernel/power/user.c | 9 +++++++++
39 3 files changed, 20 insertions(+), 0 deletions(-)
40
41diff --git a/include/linux/freezer.h b/include/linux/freezer.h
42index a5386e3..b5d6b6a 100644
43--- a/include/linux/freezer.h
44+++ b/include/linux/freezer.h
45@@ -51,6 +51,7 @@ extern void refrigerator(void);
46 extern int freeze_processes(void);
47 extern int freeze_kernel_threads(void);
48 extern void thaw_processes(void);
49+extern void thaw_kernel_threads(void);
50
51 static inline int try_to_freeze(void)
52 {
53@@ -185,6 +186,7 @@ static inline void refrigerator(void) {}
54 static inline int freeze_processes(void) { return -ENOSYS; }
55 static inline int freeze_kernel_threads(void) { return -ENOSYS; }
56 static inline void thaw_processes(void) {}
57+static inline void thaw_kernel_threads(void) {}
58
59 static inline int try_to_freeze(void) { return 0; }
60
61diff --git a/kernel/power/process.c b/kernel/power/process.c
62index addbbe5..3d4b954 100644
63--- a/kernel/power/process.c
64+++ b/kernel/power/process.c
65@@ -203,3 +203,12 @@ void thaw_processes(void)
66 printk("done.\n");
67 }
68
69+void thaw_kernel_threads(void)
70+{
71+ printk("Restarting kernel threads ... ");
72+ thaw_workqueues();
73+ thaw_tasks(true);
74+ schedule();
75+ printk("done.\n");
76+}
77+
78diff --git a/kernel/power/user.c b/kernel/power/user.c
79index 6d8f535..3565b15 100644
80--- a/kernel/power/user.c
81+++ b/kernel/power/user.c
82@@ -303,6 +303,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
83 swsusp_free();
84 memset(&data->handle, 0, sizeof(struct snapshot_handle));
85 data->ready = 0;
86+ /*
87+ * It is necessary to thaw kernel threads here, because
88+ * SNAPSHOT_CREATE_IMAGE may be invoked directly after
89+ * SNAPSHOT_FREE. In that case, if kernel threads were not
90+ * thawed, the preallocation of memory carried out by
91+ * hibernation_snapshot() might run into problems (i.e. it
92+ * might fail or even deadlock).
93+ */
94+ thaw_kernel_threads();
95 break;
96
97 case SNAPSHOT_SET_IMAGE_SIZE:
98--
991.7.7.4
100