* [PATCH v3 01/16] freezer: add unsafe versions of freezable helpers for NFS
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS Colin Cross
` (14 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Trond Myklebust, Len Brown, J. Bruce Fields, David S. Miller
NFS calls the freezable helpers with locks held, which is unsafe
and will cause lockdep warnings when 6aa9707 "lockdep: check
that no locks held at freeze time" is reapplied (it was reverted
in dbf520a). NFS shouldn't be doing this, but it has
long-running syscalls that must hold a lock but also shouldn't
block suspend. Until NFS freeze handling is rewritten to use a
signal to exit out of the critical section, add new *_unsafe
versions of the helpers that will not run the lockdep test when
6aa9707 is reapplied, and call them from NFS.
In practice the likley result of holding the lock while freezing
is that a second task blocked on the lock will never freeze,
aborting suspend, but it is possible to manufacture a case using
the cgroup freezer, the lock, and the suspend freezer to create
a deadlock. Silencing the lockdep warning here will allow
problems to be found in other drivers that may have a more
serious deadlock risk, and prevent new problems from being added.
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
fs/nfs/inode.c | 2 +-
fs/nfs/nfs3proc.c | 2 +-
fs/nfs/nfs4proc.c | 4 ++--
include/linux/freezer.h | 42 +++++++++++++++++++++++++++++++++++++++++-
net/sunrpc/sched.c | 2 +-
5 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 1f94167..53cbee5 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -79,7 +79,7 @@ int nfs_wait_bit_killable(void *word)
{
if (fatal_signal_pending(current))
return -ERESTARTSYS;
- freezable_schedule();
+ freezable_schedule_unsafe();
return 0;
}
EXPORT_SYMBOL_GPL(nfs_wait_bit_killable);
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 43ea96c..ce90eb4 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -33,7 +33,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
res = rpc_call_sync(clnt, msg, flags);
if (res != -EJUKEBOX)
break;
- freezable_schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
+ freezable_schedule_timeout_killable_unsafe(NFS_JUKEBOX_RETRY_TIME);
res = -ERESTARTSYS;
} while (!fatal_signal_pending(current));
return res;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ad025e..a236077 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -266,7 +266,7 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
*timeout = NFS4_POLL_RETRY_MIN;
if (*timeout > NFS4_POLL_RETRY_MAX)
*timeout = NFS4_POLL_RETRY_MAX;
- freezable_schedule_timeout_killable(*timeout);
+ freezable_schedule_timeout_killable_unsafe(*timeout);
if (fatal_signal_pending(current))
res = -ERESTARTSYS;
*timeout <<= 1;
@@ -4309,7 +4309,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4
static unsigned long
nfs4_set_lock_task_retry(unsigned long timeout)
{
- freezable_schedule_timeout_killable(timeout);
+ freezable_schedule_timeout_killable_unsafe(timeout);
timeout <<= 1;
if (timeout > NFS4_LOCK_MAXTIMEOUT)
return NFS4_LOCK_MAXTIMEOUT;
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e70df40..5b31e21c 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -46,7 +46,11 @@ extern int freeze_kernel_threads(void);
extern void thaw_processes(void);
extern void thaw_kernel_threads(void);
-static inline bool try_to_freeze(void)
+/*
+ * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION
+ * If try_to_freeze causes a lockdep warning it means the caller may deadlock
+ */
+static inline bool try_to_freeze_unsafe(void)
{
might_sleep();
if (likely(!freezing(current)))
@@ -54,6 +58,11 @@ static inline bool try_to_freeze(void)
return __refrigerator(false);
}
+static inline bool try_to_freeze(void)
+{
+ return try_to_freeze_unsafe();
+}
+
extern bool freeze_task(struct task_struct *p);
extern bool set_freezable(void);
@@ -115,6 +124,14 @@ static inline void freezer_count(void)
try_to_freeze();
}
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+static inline void freezer_count_unsafe(void)
+{
+ current->flags &= ~PF_FREEZER_SKIP;
+ smp_mb();
+ try_to_freeze_unsafe();
+}
+
/**
* freezer_should_skip - whether to skip a task when determining frozen
* state is reached
@@ -152,6 +169,14 @@ static inline bool freezer_should_skip(struct task_struct *p)
freezer_count(); \
})
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+#define freezable_schedule_unsafe() \
+({ \
+ freezer_do_not_count(); \
+ schedule(); \
+ freezer_count_unsafe(); \
+})
+
/* Like schedule_timeout_killable(), but should not block the freezer. */
#define freezable_schedule_timeout_killable(timeout) \
({ \
@@ -162,6 +187,16 @@ static inline bool freezer_should_skip(struct task_struct *p)
__retval; \
})
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+#define freezable_schedule_timeout_killable_unsafe(timeout) \
+({ \
+ long __retval; \
+ freezer_do_not_count(); \
+ __retval = schedule_timeout_killable(timeout); \
+ freezer_count_unsafe(); \
+ __retval; \
+})
+
/*
* Freezer-friendly wrappers around wait_event_interruptible(),
* wait_event_killable() and wait_event_interruptible_timeout(), originally
@@ -225,9 +260,14 @@ static inline void set_freezable(void) {}
#define freezable_schedule() schedule()
+#define freezable_schedule_unsafe() schedule()
+
#define freezable_schedule_timeout_killable(timeout) \
schedule_timeout_killable(timeout)
+#define freezable_schedule_timeout_killable_unsafe(timeout) \
+ schedule_timeout_killable(timeout)
+
#define wait_event_freezable(wq, condition) \
wait_event_interruptible(wq, condition)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index f8529fc..8dcfadc 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -254,7 +254,7 @@ static int rpc_wait_bit_killable(void *word)
{
if (fatal_signal_pending(current))
return -ERESTARTSYS;
- freezable_schedule();
+ freezable_schedule_unsafe();
return 0;
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
2013-05-06 23:50 ` [PATCH v3 01/16] freezer: add unsafe versions of freezable helpers for NFS Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-07 10:07 ` Jeff Layton
[not found] ` <1367884221-20462-3-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2013-05-06 23:50 ` [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held Colin Cross
` (13 subsequent siblings)
15 siblings, 2 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Len Brown
CIFS calls wait_event_freezekillable_unsafe with a VFS lock held,
which is unsafe and will cause lockdep warnings when 6aa9707
"lockdep: check that no locks held at freeze time" is reapplied
(it was reverted in dbf520a). CIFS shouldn't be doing this, but
it has long-running syscalls that must hold a lock but also
shouldn't block suspend. Until CIFS freeze handling is rewritten
to use a signal to exit out of the critical section, add a new
wait_event_freezekillable_unsafe helper that will not run the
lockdep test when 6aa9707 is reapplied, and call it from CIFS.
In practice the likley result of holding the lock while freezing
is that a second task blocked on the lock will never freeze,
aborting suspend, but it is possible to manufacture a case using
the cgroup freezer, the lock, and the suspend freezer to create
a deadlock. Silencing the lockdep warning here will allow
problems to be found in other drivers that may have a more
serious deadlock risk, and prevent new problems from being added.
Signed-off-by: Colin Cross <ccross@android.com>
---
include/linux/freezer.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 5b31e21c..d3c038e 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -212,6 +212,16 @@ static inline bool freezer_should_skip(struct task_struct *p)
__retval; \
})
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+#define wait_event_freezekillable_unsafe(wq, condition) \
+({ \
+ int __retval; \
+ freezer_do_not_count(); \
+ __retval = wait_event_killable(wq, (condition)); \
+ freezer_count_unsafe(); \
+ __retval; \
+})
+
#define wait_event_freezable(wq, condition) \
({ \
int __retval; \
@@ -277,6 +287,9 @@ static inline void set_freezable(void) {}
#define wait_event_freezekillable(wq, condition) \
wait_event_killable(wq, condition)
+#define wait_event_freezekillable_unsafe(wq, condition) \
+ wait_event_killable(wq, condition)
+
#endif /* !CONFIG_FREEZER */
#endif /* FREEZER_H_INCLUDED */
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS
2013-05-06 23:50 ` [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS Colin Cross
@ 2013-05-07 10:07 ` Jeff Layton
[not found] ` <20130507060730.03364687-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
[not found] ` <1367884221-20462-3-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
1 sibling, 1 reply; 42+ messages in thread
From: Jeff Layton @ 2013-05-07 10:07 UTC (permalink / raw)
To: Colin Cross
Cc: linux-kernel, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Len Brown
On Mon, 6 May 2013 16:50:07 -0700
Colin Cross <ccross@android.com> wrote:
> CIFS calls wait_event_freezekillable_unsafe with a VFS lock held,
> which is unsafe and will cause lockdep warnings when 6aa9707
> "lockdep: check that no locks held at freeze time" is reapplied
> (it was reverted in dbf520a). CIFS shouldn't be doing this, but
> it has long-running syscalls that must hold a lock but also
> shouldn't block suspend. Until CIFS freeze handling is rewritten
> to use a signal to exit out of the critical section, add a new
> wait_event_freezekillable_unsafe helper that will not run the
> lockdep test when 6aa9707 is reapplied, and call it from CIFS.
>
> In practice the likley result of holding the lock while freezing
> is that a second task blocked on the lock will never freeze,
> aborting suspend, but it is possible to manufacture a case using
> the cgroup freezer, the lock, and the suspend freezer to create
> a deadlock. Silencing the lockdep warning here will allow
> problems to be found in other drivers that may have a more
> serious deadlock risk, and prevent new problems from being added.
>
> Signed-off-by: Colin Cross <ccross@android.com>
> ---
> include/linux/freezer.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/include/linux/freezer.h b/include/linux/freezer.h
> index 5b31e21c..d3c038e 100644
> --- a/include/linux/freezer.h
> +++ b/include/linux/freezer.h
> @@ -212,6 +212,16 @@ static inline bool freezer_should_skip(struct task_struct *p)
> __retval; \
> })
>
> +/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
> +#define wait_event_freezekillable_unsafe(wq, condition) \
> +({ \
> + int __retval; \
> + freezer_do_not_count(); \
> + __retval = wait_event_killable(wq, (condition)); \
> + freezer_count_unsafe(); \
> + __retval; \
> +})
> +
> #define wait_event_freezable(wq, condition) \
> ({ \
> int __retval; \
> @@ -277,6 +287,9 @@ static inline void set_freezable(void) {}
> #define wait_event_freezekillable(wq, condition) \
> wait_event_killable(wq, condition)
>
> +#define wait_event_freezekillable_unsafe(wq, condition) \
> + wait_event_killable(wq, condition)
> +
> #endif /* !CONFIG_FREEZER */
>
> #endif /* FREEZER_H_INCLUDED */
I think you also need to convert wait_for_response in the cifs code to
use this helper. While it's a pretty straightforward change, you should
probably cc linux-cifs@vger.kernel.org as well.
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 42+ messages in thread
[parent not found: <1367884221-20462-3-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS
[not found] ` <1367884221-20462-3-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
@ 2013-05-07 12:28 ` Pavel Machek
0 siblings, 0 replies; 42+ messages in thread
From: Pavel Machek @ 2013-05-07 12:28 UTC (permalink / raw)
To: Colin Cross
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rafael J. Wysocki,
Peter Zijlstra, Ingo Molnar, Andrew Morton, Mandeep Singh Baines,
Oleg Nesterov, linux-nfs-u79uwXL29TY76Z2rM5mHXA,
linux-pm-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Linus Torvalds, Tejun Heo, Len Brown
On Mon 2013-05-06 16:50:07, Colin Cross wrote:
> CIFS calls wait_event_freezekillable_unsafe with a VFS lock held,
> which is unsafe and will cause lockdep warnings when 6aa9707
> "lockdep: check that no locks held at freeze time" is reapplied
> (it was reverted in dbf520a). CIFS shouldn't be doing this, but
> it has long-running syscalls that must hold a lock but also
> shouldn't block suspend. Until CIFS freeze handling is rewritten
> to use a signal to exit out of the critical section, add a new
> wait_event_freezekillable_unsafe helper that will not run the
> lockdep test when 6aa9707 is reapplied, and call it from CIFS.
>
> In practice the likley result of holding the lock while freezing
> is that a second task blocked on the lock will never freeze,
> aborting suspend, but it is possible to manufacture a case using
> the cgroup freezer, the lock, and the suspend freezer to create
> a deadlock. Silencing the lockdep warning here will allow
> problems to be found in other drivers that may have a more
> serious deadlock risk, and prevent new problems from being added.
>
> Signed-off-by: Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
Acked-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
2013-05-06 23:50 ` [PATCH v3 01/16] freezer: add unsafe versions of freezable helpers for NFS Colin Cross
2013-05-06 23:50 ` [PATCH v3 02/16] freezer: add unsafe versions of freezable helpers for CIFS Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-07 12:28 ` Pavel Machek
2013-05-06 23:50 ` [PATCH v3 04/16] lockdep: check that no locks held at freeze time Colin Cross
` (12 subsequent siblings)
15 siblings, 1 reply; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Paul Walmsley, Al Viro, Eric W. Biederman, David Howells
The only existing caller to debug_check_no_locks_held calls it
with 'current' as the task, and the freezer needs to call
debug_check_no_locks_held but doesn't already have a current
task pointer, so remove the argument. It is already assuming
that the current task is relevant by dumping the current stack
trace as part of the warning.
This was originally part of 6aa9707099c (lockdep: check that
no locks held at freeze time) which was reverted in
dbf520a9d7d4.
Original-author: Mandeep Singh Baines <msb@chromium.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
include/linux/debug_locks.h | 4 ++--
kernel/exit.c | 2 +-
kernel/lockdep.c | 17 ++++++++---------
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 3bd46f7..a975de1 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
extern void debug_show_all_locks(void);
extern void debug_show_held_locks(struct task_struct *task);
extern void debug_check_no_locks_freed(const void *from, unsigned long len);
-extern void debug_check_no_locks_held(struct task_struct *task);
+extern void debug_check_no_locks_held(void);
#else
static inline void debug_show_all_locks(void)
{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
}
static inline void
-debug_check_no_locks_held(struct task_struct *task)
+debug_check_no_locks_held(void)
{
}
#endif
diff --git a/kernel/exit.c b/kernel/exit.c
index 60bc027..51e485c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -835,7 +835,7 @@ void do_exit(long code)
/*
* Make sure we are holding no locks:
*/
- debug_check_no_locks_held(tsk);
+ debug_check_no_locks_held();
/*
* We can do this unlocked here. The futex code uses this flag
* just to verify whether the pi state cleanup has been done
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 8a0efac..259db20 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -4088,7 +4088,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
}
EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
-static void print_held_locks_bug(struct task_struct *curr)
+static void print_held_locks_bug(void)
{
if (!debug_locks_off())
return;
@@ -4097,22 +4097,21 @@ static void print_held_locks_bug(struct task_struct *curr)
printk("\n");
printk("=====================================\n");
- printk("[ BUG: lock held at task exit time! ]\n");
+ printk("[ BUG: %s/%d still has locks held! ]\n",
+ current->comm, task_pid_nr(current));
print_kernel_ident();
printk("-------------------------------------\n");
- printk("%s/%d is exiting with locks still held!\n",
- curr->comm, task_pid_nr(curr));
- lockdep_print_held_locks(curr);
-
+ lockdep_print_held_locks(current);
printk("\nstack backtrace:\n");
dump_stack();
}
-void debug_check_no_locks_held(struct task_struct *task)
+void debug_check_no_locks_held(void)
{
- if (unlikely(task->lockdep_depth > 0))
- print_held_locks_bug(task);
+ if (unlikely(current->lockdep_depth > 0))
+ print_held_locks_bug();
}
+EXPORT_SYMBOL_GPL(debug_check_no_locks_held);
void debug_show_all_locks(void)
{
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held
2013-05-06 23:50 ` [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held Colin Cross
@ 2013-05-07 12:28 ` Pavel Machek
0 siblings, 0 replies; 42+ messages in thread
From: Pavel Machek @ 2013-05-07 12:28 UTC (permalink / raw)
To: Colin Cross
Cc: linux-kernel, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Oleg Nesterov, linux-nfs,
linux-pm, netdev, Linus Torvalds, Tejun Heo, Paul Walmsley,
Al Viro, Eric W. Biederman, David Howells
On Mon 2013-05-06 16:50:08, Colin Cross wrote:
> The only existing caller to debug_check_no_locks_held calls it
> with 'current' as the task, and the freezer needs to call
> debug_check_no_locks_held but doesn't already have a current
> task pointer, so remove the argument. It is already assuming
> that the current task is relevant by dumping the current stack
> trace as part of the warning.
>
> This was originally part of 6aa9707099c (lockdep: check that
> no locks held at freeze time) which was reverted in
> dbf520a9d7d4.
>
> Original-author: Mandeep Singh Baines <msb@chromium.org>
> Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v3 04/16] lockdep: check that no locks held at freeze time
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (2 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
[not found] ` <1367884221-20462-5-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
[not found] ` <1367884221-20462-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
` (11 subsequent siblings)
15 siblings, 1 reply; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo, Ben Chan,
Len Brown
From: Mandeep Singh Baines <msb@chromium.org>
We shouldn't try_to_freeze if locks are held. Holding a lock can cause a
deadlock if the lock is later acquired in the suspend or hibernate path
(e.g. by dpm). Holding a lock can also cause a deadlock in the case of
cgroup_freezer if a lock is held inside a frozen cgroup that is later
acquired by a process outside that group.
History:
This patch was originally applied as 6aa9707099c and reverted in
dbf520a9d7d4 because NFS was freezing with locks held. It was
deemed better to keep the bad freeze point in NFS to allow laptops
to suspend consistently. The previous patch in this series converts
NFS to call _unsafe versions of the freezable helpers so that
lockdep doesn't complain about them until a more correct fix
can be applied.
[akpm@linux-foundation.org: export debug_check_no_locks_held]
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Cc: Ben Chan <benchan@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ccross@android.com: don't warn if try_to_freeze_unsafe is called]
Signed-off-by: Colin Cross <ccross@android.com>
---
include/linux/freezer.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index d3c038e..bcf9e65 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
#ifndef FREEZER_H_INCLUDED
#define FREEZER_H_INCLUDED
+#include <linux/debug_locks.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/atomic.h>
@@ -60,6 +61,8 @@ static inline bool try_to_freeze_unsafe(void)
static inline bool try_to_freeze(void)
{
+ if (!(current->flags & PF_NOFREEZE))
+ debug_check_no_locks_held();
return try_to_freeze_unsafe();
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
[parent not found: <1367884221-20462-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>]
* [PATCH v3 05/16] freezer: shorten freezer sleep time using exponential backoff
[not found] ` <1367884221-20462-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 06/16] freezer: skip waking up tasks with PF_FREEZER_SKIP set Colin Cross
1 sibling, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs-u79uwXL29TY76Z2rM5mHXA,
linux-pm-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Linus Torvalds, Tejun Heo, Len Brown
All tasks can easily be frozen in under 10 ms, switch to using
an initial 1 ms sleep followed by exponential backoff until
8 ms. Also convert the printed time to ms instead of centiseconds.
Acked-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
---
kernel/power/process.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 98088e0..fc0df84 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -30,9 +30,10 @@ static int try_to_freeze_tasks(bool user_only)
unsigned int todo;
bool wq_busy = false;
struct timeval start, end;
- u64 elapsed_csecs64;
- unsigned int elapsed_csecs;
+ u64 elapsed_msecs64;
+ unsigned int elapsed_msecs;
bool wakeup = false;
+ int sleep_usecs = USEC_PER_MSEC;
do_gettimeofday(&start);
@@ -68,22 +69,25 @@ static int try_to_freeze_tasks(bool user_only)
/*
* We need to retry, but first give the freezing tasks some
- * time to enter the refrigerator.
+ * time to enter the refrigerator. Start with an initial
+ * 1 ms sleep followed by exponential backoff until 8 ms.
*/
- msleep(10);
+ usleep_range(sleep_usecs / 2, sleep_usecs);
+ if (sleep_usecs < 8 * USEC_PER_MSEC)
+ sleep_usecs *= 2;
}
do_gettimeofday(&end);
- elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
- do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
- elapsed_csecs = elapsed_csecs64;
+ elapsed_msecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
+ do_div(elapsed_msecs64, NSEC_PER_MSEC);
+ elapsed_msecs = elapsed_msecs64;
if (todo) {
printk("\n");
- printk(KERN_ERR "Freezing of tasks %s after %d.%02d seconds "
+ printk(KERN_ERR "Freezing of tasks %s after %d.%03d seconds "
"(%d tasks refusing to freeze, wq_busy=%d):\n",
wakeup ? "aborted" : "failed",
- elapsed_csecs / 100, elapsed_csecs % 100,
+ elapsed_msecs / 1000, elapsed_msecs % 1000,
todo - wq_busy, wq_busy);
if (!wakeup) {
@@ -96,8 +100,8 @@ static int try_to_freeze_tasks(bool user_only)
read_unlock(&tasklist_lock);
}
} else {
- printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
- elapsed_csecs % 100);
+ printk("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
+ elapsed_msecs % 1000);
}
return todo ? -EBUSY : 0;
--
1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 06/16] freezer: skip waking up tasks with PF_FREEZER_SKIP set
[not found] ` <1367884221-20462-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2013-05-06 23:50 ` [PATCH v3 05/16] freezer: shorten freezer sleep time using exponential backoff Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
1 sibling, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs-u79uwXL29TY76Z2rM5mHXA,
linux-pm-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Linus Torvalds, Tejun Heo
Android goes through suspend/resume very often (every few seconds when
on a busy wifi network with the screen off), and a significant portion
of the energy used to go in and out of suspend is spent in the
freezer. If a task has called freezer_do_not_count(), don't bother
waking it up. If it happens to wake up later it will call
freezer_count() and immediately enter the refrigerator.
Combined with patches to convert freezable helpers to use
freezer_do_not_count() and convert common sites where idle userspace
tasks are blocked to use the freezable helpers, this reduces the
time and energy required to suspend and resume.
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Acked-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
Signed-off-by: Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
---
v2: move check to freeze_task()
kernel/freezer.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/kernel/freezer.c b/kernel/freezer.c
index c38893b..8b2afc1 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -110,6 +110,18 @@ bool freeze_task(struct task_struct *p)
{
unsigned long flags;
+ /*
+ * This check can race with freezer_do_not_count, but worst case that
+ * will result in an extra wakeup being sent to the task. It does not
+ * race with freezer_count(), the barriers in freezer_count() and
+ * freezer_should_skip() ensure that either freezer_count() sees
+ * freezing == true in try_to_freeze() and freezes, or
+ * freezer_should_skip() sees !PF_FREEZE_SKIP and freezes the task
+ * normally.
+ */
+ if (freezer_should_skip(p))
+ return false;
+
spin_lock_irqsave(&freezer_lock, flags);
if (!freezing(p) || frozen(p)) {
spin_unlock_irqrestore(&freezer_lock, flags);
--
1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 07/16] freezer: convert freezable helpers to freezer_do_not_count()
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (4 preceding siblings ...)
[not found] ` <1367884221-20462-1-git-send-email-ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 08/16] freezer: convert freezable helpers to static inline where possible Colin Cross
` (9 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Len Brown
Freezing tasks will wake up almost every userspace task from
where it is blocking and force it to run until it hits a
call to try_to_sleep(), generally on the exit path from the syscall
it is blocking in. On resume each task will run again, usually
restarting the syscall and running until it hits the same
blocking call as it was originally blocked in.
Convert the existing wait_event_freezable* wrappers to use
freezer_do_not_count(). Combined with a previous patch,
these tasks will not run during suspend or resume unless they wake
up for another reason, in which case they will run until they hit
the try_to_freeze() in freezer_count(), and then continue processing
the wakeup after tasks are thawed.
This results in a small change in behavior, previously a race
between freezing and a normal wakeup would be won by the wakeup,
now the task will freeze and then handle the wakeup after thawing.
Signed-off-by: Colin Cross <ccross@android.com>
---
v3:
split this out of the patch that adds new freezable helpers
include/linux/freezer.h | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index bcf9e65..c71337af 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -228,27 +228,19 @@ static inline bool freezer_should_skip(struct task_struct *p)
#define wait_event_freezable(wq, condition) \
({ \
int __retval; \
- for (;;) { \
- __retval = wait_event_interruptible(wq, \
- (condition) || freezing(current)); \
- if (__retval || (condition)) \
- break; \
- try_to_freeze(); \
- } \
+ freezer_do_not_count(); \
+ __retval = wait_event_interruptible(wq, (condition)); \
+ freezer_count(); \
__retval; \
})
#define wait_event_freezable_timeout(wq, condition, timeout) \
({ \
long __retval = timeout; \
- for (;;) { \
- __retval = wait_event_interruptible_timeout(wq, \
- (condition) || freezing(current), \
- __retval); \
- if (__retval <= 0 || (condition)) \
- break; \
- try_to_freeze(); \
- } \
+ freezer_do_not_count(); \
+ __retval = wait_event_interruptible_timeout(wq, (condition), \
+ __retval); \
+ freezer_count(); \
__retval; \
})
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 08/16] freezer: convert freezable helpers to static inline where possible
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (5 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 07/16] freezer: convert freezable helpers to freezer_do_not_count() Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 09/16] freezer: add new freezable helpers using freezer_do_not_count() Colin Cross
` (8 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Len Brown
Some of the freezable helpers have to be macros because their
condition argument needs to get evaluated every time through
the wait loop. Convert the others to static inline to make
future changes easier.
Signed-off-by: Colin Cross <ccross@android.com>
---
include/linux/freezer.h | 58 ++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index c71337af..8430d4c5 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -159,46 +159,46 @@ static inline bool freezer_should_skip(struct task_struct *p)
}
/*
- * These macros are intended to be used whenever you want allow a sleeping
+ * These functions are intended to be used whenever you want allow a sleeping
* task to be frozen. Note that neither return any clear indication of
* whether a freeze event happened while in this function.
*/
/* Like schedule(), but should not block the freezer. */
-#define freezable_schedule() \
-({ \
- freezer_do_not_count(); \
- schedule(); \
- freezer_count(); \
-})
+static inline void freezable_schedule(void)
+{
+ freezer_do_not_count();
+ schedule();
+ freezer_count();
+}
/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
-#define freezable_schedule_unsafe() \
-({ \
- freezer_do_not_count(); \
- schedule(); \
- freezer_count_unsafe(); \
-})
+static inline void freezable_schedule_unsafe(void)
+{
+ freezer_do_not_count();
+ schedule();
+ freezer_count_unsafe();
+}
/* Like schedule_timeout_killable(), but should not block the freezer. */
-#define freezable_schedule_timeout_killable(timeout) \
-({ \
- long __retval; \
- freezer_do_not_count(); \
- __retval = schedule_timeout_killable(timeout); \
- freezer_count(); \
- __retval; \
-})
+static inline long freezable_schedule_timeout_killable(long timeout)
+{
+ long __retval;
+ freezer_do_not_count();
+ __retval = schedule_timeout_killable(timeout);
+ freezer_count();
+ return __retval;
+}
/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
-#define freezable_schedule_timeout_killable_unsafe(timeout) \
-({ \
- long __retval; \
- freezer_do_not_count(); \
- __retval = schedule_timeout_killable(timeout); \
- freezer_count_unsafe(); \
- __retval; \
-})
+static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
+{
+ long __retval;
+ freezer_do_not_count();
+ __retval = schedule_timeout_killable(timeout);
+ freezer_count_unsafe();
+ return __retval;
+}
/*
* Freezer-friendly wrappers around wait_event_interruptible(),
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 09/16] freezer: add new freezable helpers using freezer_do_not_count()
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (6 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 08/16] freezer: convert freezable helpers to static inline where possible Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 10/16] binder: use freezable blocking calls Colin Cross
` (7 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Len Brown
Freezing tasks will wake up almost every userspace task from
where it is blocking and force it to run until it hits a
call to try_to_sleep(), generally on the exit path from the syscall
it is blocking in. On resume each task will run again, usually
restarting the syscall and running until it hits the same
blocking call as it was originally blocked in.
To allow tasks to avoid running on every suspend/resume cycle,
this patch adds additional freezable wrappers around blocking calls
that call freezer_do_not_count(). Combined with the previous patch,
these tasks will not run during suspend or resume unless they wake
up for another reason, in which case they will run until they hit
the try_to_freeze() in freezer_count(), and then continue processing
the wakeup after tasks are thawed.
Additional patches will convert the most common locations that
userspace blocks in to use freezable helpers.
Signed-off-by: Colin Cross <ccross@android.com>
---
v3:
split out the changes to existing helpers to a separate patch
include/linux/freezer.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 8430d4c5..7fd81b8 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -180,6 +180,32 @@ static inline void freezable_schedule_unsafe(void)
freezer_count_unsafe();
}
+/*
+ * Like freezable_schedule_timeout(), but should not block the freezer. Do not
+ * call this with locks held.
+ */
+static inline long freezable_schedule_timeout(long timeout)
+{
+ long __retval;
+ freezer_do_not_count();
+ __retval = schedule_timeout(timeout);
+ freezer_count();
+ return __retval;
+}
+
+/*
+ * Like schedule_timeout_interruptible(), but should not block the freezer. Do not
+ * call this with locks held.
+ */
+static inline long freezable_schedule_timeout_interruptible(long timeout)
+{
+ long __retval;
+ freezer_do_not_count();
+ __retval = schedule_timeout_interruptible(timeout);
+ freezer_count();
+ return __retval;
+}
+
/* Like schedule_timeout_killable(), but should not block the freezer. */
static inline long freezable_schedule_timeout_killable(long timeout)
{
@@ -201,6 +227,20 @@ static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
}
/*
+ * Like schedule_hrtimeout_range(), but should not block the freezer. Do not
+ * call this with locks held.
+ */
+static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
+ unsigned long delta, const enum hrtimer_mode mode)
+{
+ int __retval;
+ freezer_do_not_count();
+ __retval = schedule_hrtimeout_range(expires, delta, mode);
+ freezer_count();
+ return __retval;
+}
+
+/*
* Freezer-friendly wrappers around wait_event_interruptible(),
* wait_event_killable() and wait_event_interruptible_timeout(), originally
* defined in <linux/wait.h>
@@ -244,6 +284,16 @@ static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
__retval; \
})
+#define wait_event_freezable_exclusive(wq, condition) \
+({ \
+ int __retval; \
+ freezer_do_not_count(); \
+ __retval = wait_event_interruptible_exclusive(wq, condition); \
+ freezer_count(); \
+ __retval; \
+})
+
+
#else /* !CONFIG_FREEZER */
static inline bool frozen(struct task_struct *p) { return false; }
static inline bool freezing(struct task_struct *p) { return false; }
@@ -267,18 +317,29 @@ static inline void set_freezable(void) {}
#define freezable_schedule_unsafe() schedule()
+#define freezable_schedule_timeout(timeout) schedule_timeout(timeout)
+
+#define freezable_schedule_timeout_interruptible(timeout) \
+ schedule_timeout_interruptible(timeout)
+
#define freezable_schedule_timeout_killable(timeout) \
schedule_timeout_killable(timeout)
#define freezable_schedule_timeout_killable_unsafe(timeout) \
schedule_timeout_killable(timeout)
+#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
+ schedule_hrtimeout_range(expires, delta, mode)
+
#define wait_event_freezable(wq, condition) \
wait_event_interruptible(wq, condition)
#define wait_event_freezable_timeout(wq, condition, timeout) \
wait_event_interruptible_timeout(wq, condition, timeout)
+#define wait_event_freezable_exclusive(wq, condition) \
+ wait_event_interruptible_exclusive(wq, condition)
+
#define wait_event_freezekillable(wq, condition) \
wait_event_killable(wq, condition)
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 10/16] binder: use freezable blocking calls
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (7 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 09/16] freezer: add new freezable helpers using freezer_do_not_count() Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 11/16] epoll: use freezable blocking call Colin Cross
` (6 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Greg Kroah-Hartman, Al Viro, Arve Hjønnevåg,
Eric W. Biederman, Sachin Kamat, devel
Avoid waking up every thread sleeping in a binder call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
drivers/staging/android/binder.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 24456a0..af8fba4 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -20,6 +20,7 @@
#include <asm/cacheflush.h>
#include <linux/fdtable.h>
#include <linux/file.h>
+#include <linux/freezer.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
@@ -2140,13 +2141,13 @@ retry:
if (!binder_has_proc_work(proc, thread))
ret = -EAGAIN;
} else
- ret = wait_event_interruptible_exclusive(proc->wait, binder_has_proc_work(proc, thread));
+ ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread));
} else {
if (non_block) {
if (!binder_has_thread_work(thread))
ret = -EAGAIN;
} else
- ret = wait_event_interruptible(thread->wait, binder_has_thread_work(thread));
+ ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
}
binder_lock(__func__);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 11/16] epoll: use freezable blocking call
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (8 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 10/16] binder: use freezable blocking calls Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 12/16] select: " Colin Cross
` (5 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Alexander Viro, linux-fsdevel
Avoid waking up every thread sleeping in an epoll_wait call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
fs/eventpoll.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 9fec183..65245e7 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -34,6 +34,7 @@
#include <linux/mutex.h>
#include <linux/anon_inodes.h>
#include <linux/device.h>
+#include <linux/freezer.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/mman.h>
@@ -1543,7 +1544,8 @@ fetch_events:
}
spin_unlock_irqrestore(&ep->lock, flags);
- if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))
+ if (!freezable_schedule_hrtimeout_range(to, slack,
+ HRTIMER_MODE_ABS))
timed_out = 1;
spin_lock_irqsave(&ep->lock, flags);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 12/16] select: use freezable blocking call
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (9 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 11/16] epoll: use freezable blocking call Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 13/16] futex: " Colin Cross
` (4 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Alexander Viro, linux-fsdevel
Avoid waking up every thread sleeping in a select call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
fs/select.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/select.c b/fs/select.c
index 8c1c96c..6b14dc7 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -27,6 +27,7 @@
#include <linux/rcupdate.h>
#include <linux/hrtimer.h>
#include <linux/sched/rt.h>
+#include <linux/freezer.h>
#include <asm/uaccess.h>
@@ -236,7 +237,8 @@ int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
set_current_state(state);
if (!pwq->triggered)
- rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS);
+ rc = freezable_schedule_hrtimeout_range(expires, slack,
+ HRTIMER_MODE_ABS);
__set_current_state(TASK_RUNNING);
/*
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 13/16] futex: use freezable blocking call
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (10 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 12/16] select: " Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-07-22 23:02 ` 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call) Michael Leun
2013-05-06 23:50 ` [PATCH v3 14/16] nanosleep: use freezable blocking call Colin Cross
` (3 subsequent siblings)
15 siblings, 1 reply; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
Avoid waking up every thread sleeping in a futex_wait call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Colin Cross <ccross@android.com>
---
kernel/futex.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index b26dcfc..d710fae 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -61,6 +61,7 @@
#include <linux/nsproxy.h>
#include <linux/ptrace.h>
#include <linux/sched/rt.h>
+#include <linux/freezer.h>
#include <asm/futex.h>
@@ -1807,7 +1808,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
* is no timeout, or if it has yet to expire.
*/
if (!timeout || timeout->task)
- schedule();
+ freezable_schedule();
}
__set_current_state(TASK_RUNNING);
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-05-06 23:50 ` [PATCH v3 13/16] futex: " Colin Cross
@ 2013-07-22 23:02 ` Michael Leun
2013-07-22 23:55 ` Colin Cross
[not found] ` <20130723010250.5a3465ec-gjVD6BTPoEbYa4IuQwzu8g@public.gmane.org>
0 siblings, 2 replies; 42+ messages in thread
From: Michael Leun @ 2013-07-22 23:02 UTC (permalink / raw)
To: Colin Cross
Cc: linux-kernel, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
On Mon, 6 May 2013 16:50:18 -0700
Colin Cross <ccross@android.com> wrote:
> Avoid waking up every thread sleeping in a futex_wait call during
[...]
With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
displaying 0% of saving image to disk.
echo "1" >/sys/power/state still works.
Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4, reverting
that from 3.11-rc2 makes s2disk working again.
--
MfG,
Michael Leun
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-22 23:02 ` 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call) Michael Leun
@ 2013-07-22 23:55 ` Colin Cross
2013-07-23 0:32 ` Linus Torvalds
2013-07-23 18:08 ` Michael Leun
[not found] ` <20130723010250.5a3465ec-gjVD6BTPoEbYa4IuQwzu8g@public.gmane.org>
1 sibling, 2 replies; 42+ messages in thread
From: Colin Cross @ 2013-07-22 23:55 UTC (permalink / raw)
To: Michael Leun
Cc: lkml, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, Linux PM list, netdev, Linus Torvalds, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
<lkml20130126@newton.leun.net> wrote:
> On Mon, 6 May 2013 16:50:18 -0700
> Colin Cross <ccross@android.com> wrote:
>
>> Avoid waking up every thread sleeping in a futex_wait call during
> [...]
>
> With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> displaying 0% of saving image to disk.
>
> echo "1" >/sys/power/state still works.
>
> Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4, reverting
> that from 3.11-rc2 makes s2disk working again.
>
I think the expanded use of the freezable_* helpers is exposing an
existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
freeze_processes(), which sets the global system_freezing_cnt and
pm_freezing. try_to_freeze_tasks then sends every process except
current a signal which causes them all to end up in the refrigerator.
The current task then returns back to userspace and continues its work
to suspend to disk. If that task ever hits a call to try_to_freeze()
in the kernel, it will see system_freezing_cnt and pm_freezing=true
and freeze, and suspend to disk will hang forever. It could hit
try_to_freeze() because of a signal delivered to the task, or from
calling any syscall that uses a freezable_* helper like the one I
added to sys_futex.
I think the right solution is to add a flag to the freezing task that
marks it unfreezable. I think PF_NOFREEZE would work, although it is
normally used on kernel threads, can you see if the attached patch
helps?
[-- Attachment #2: 0001-power-set-PF_NOFREEZE-flag-on-SNAPSHOT_FREEZE-task.patch --]
[-- Type: application/octet-stream, Size: 1217 bytes --]
From 0f22f2b357b06208fc7c0b82ce3f0929d00877ca Mon Sep 17 00:00:00 2001
From: Colin Cross <ccross@android.com>
Date: Mon, 22 Jul 2013 16:53:15 -0700
Subject: [PATCH] power: set PF_NOFREEZE flag on SNAPSHOT_FREEZE task
The task that calls the SNAPSHOT_FREEZE ioctl needs to return back
to userspace and continue preparing a suspend-to-disk image. Set
the PF_NOFREEZE flag on it so that it doesn't accidentally freeze
if it comes across a call to try_to_freeze().
Reported-by: Michael Leun <lkml20130126@newton.leun.net>
Signed-off-by: Colin Cross <ccross@android.com>
---
kernel/power/user.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 4ed81e7..17f9c20 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -219,6 +219,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
sys_sync();
printk("done.\n");
+ current->flags |= PF_NOFREEZE;
error = freeze_processes();
if (!error)
data->frozen = 1;
@@ -229,6 +230,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
break;
pm_restore_gfp_mask();
thaw_processes();
+ current->flags &= ~PF_NOFREEZE;
data->frozen = 0;
break;
--
1.8.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-22 23:55 ` Colin Cross
@ 2013-07-23 0:32 ` Linus Torvalds
[not found] ` <CA+55aFzUVPJe96z8V0F-znc8ZcpJid7LEeYww80M-Mx=S91tAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-23 18:08 ` Michael Leun
1 sibling, 1 reply; 42+ messages in thread
From: Linus Torvalds @ 2013-07-23 0:32 UTC (permalink / raw)
To: Colin Cross
Cc: Michael Leun, lkml, Pavel Machek, Rafael J. Wysocki,
Peter Zijlstra, Ingo Molnar, Andrew Morton, Mandeep Singh Baines,
Oleg Nesterov, linux-nfs, Linux PM list, netdev, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
On Mon, Jul 22, 2013 at 4:55 PM, Colin Cross <ccross@android.com> wrote:
>
> I think the right solution is to add a flag to the freezing task that
> marks it unfreezable. I think PF_NOFREEZE would work, although it is
> normally used on kernel threads, can you see if the attached patch
> helps?
Hmm. That does seem to be the right thing to do, but I wonder about
the *other* callers of freeze_processes() IOW, kexec and friends.
So maybe we should do this in {freeze|thaw}_processes() itself, and
just make the rule be that the caller of freeze_processes() itself is
obviously not frozen, and has to be the same one that then thaws
things?
Colin? Rafael? Comments?
Linus
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-22 23:55 ` Colin Cross
2013-07-23 0:32 ` Linus Torvalds
@ 2013-07-23 18:08 ` Michael Leun
2013-07-23 18:24 ` Darren Hart
2013-07-23 18:29 ` Colin Cross
1 sibling, 2 replies; 42+ messages in thread
From: Michael Leun @ 2013-07-23 18:08 UTC (permalink / raw)
To: Colin Cross
Cc: Michael Leun, lkml, Pavel Machek, Rafael J. Wysocki,
Peter Zijlstra, Ingo Molnar, Andrew Morton, Mandeep Singh Baines,
Oleg Nesterov, linux-nfs, Linux PM list, netdev, Linus Torvalds,
Tejun Heo, Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
On Mon, 22 Jul 2013 16:55:58 -0700
Colin Cross <ccross@android.com> wrote:
> On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
> <lkml20130126@newton.leun.net> wrote:
> > On Mon, 6 May 2013 16:50:18 -0700
> > Colin Cross <ccross@android.com> wrote:
> >
> >> Avoid waking up every thread sleeping in a futex_wait call during
> > [...]
> >
> > With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> > displaying 0% of saving image to disk.
> >
> > echo "1" >/sys/power/state still works.
> >
> > Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4,
> > reverting that from 3.11-rc2 makes s2disk working again.
> >
>
> I think the expanded use of the freezable_* helpers is exposing an
> existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
> freeze_processes(), which sets the global system_freezing_cnt and
> pm_freezing. try_to_freeze_tasks then sends every process except
> current a signal which causes them all to end up in the refrigerator.
> The current task then returns back to userspace and continues its work
> to suspend to disk. If that task ever hits a call to try_to_freeze()
> in the kernel, it will see system_freezing_cnt and pm_freezing=true
> and freeze, and suspend to disk will hang forever. It could hit
> try_to_freeze() because of a signal delivered to the task, or from
> calling any syscall that uses a freezable_* helper like the one I
> added to sys_futex.
>
> I think the right solution is to add a flag to the freezing task that
> marks it unfreezable. I think PF_NOFREEZE would work, although it is
> normally used on kernel threads, can you see if the attached patch
> helps?
That patch helps.
BTW, the only machine I can reproduce this bug with is an i7-3630QM
notebook. Cannot reproduce on an Core Duo U1400 and cannot reproduce on
an i7 M 620.
Are the sysreq backtraces still wanted? If so, any tip, how I could get
them saved?
--
MfG,
Michael Leun
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-23 18:08 ` Michael Leun
@ 2013-07-23 18:24 ` Darren Hart
2013-07-23 18:29 ` Colin Cross
1 sibling, 0 replies; 42+ messages in thread
From: Darren Hart @ 2013-07-23 18:24 UTC (permalink / raw)
To: Michael Leun
Cc: Colin Cross, lkml, Pavel Machek, Rafael J. Wysocki,
Peter Zijlstra, Ingo Molnar, Andrew Morton, Mandeep Singh Baines,
Oleg Nesterov, linux-nfs, Linux PM list, netdev, Linus Torvalds,
Tejun Heo, Thomas Gleixner, Randy Dunlap, Al Viro
On Tue, 2013-07-23 at 20:08 +0200, Michael Leun wrote:
> On Mon, 22 Jul 2013 16:55:58 -0700
> Colin Cross <ccross@android.com> wrote:
>
> > On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
> > <lkml20130126@newton.leun.net> wrote:
> > > On Mon, 6 May 2013 16:50:18 -0700
> > > Colin Cross <ccross@android.com> wrote:
> > >
> > >> Avoid waking up every thread sleeping in a futex_wait call during
> > > [...]
> > >
> > > With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> > > displaying 0% of saving image to disk.
> > >
> > > echo "1" >/sys/power/state still works.
> > >
> > > Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4,
> > > reverting that from 3.11-rc2 makes s2disk working again.
> > >
> >
> > I think the expanded use of the freezable_* helpers is exposing an
> > existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
> > freeze_processes(), which sets the global system_freezing_cnt and
> > pm_freezing. try_to_freeze_tasks then sends every process except
> > current a signal which causes them all to end up in the refrigerator.
> > The current task then returns back to userspace and continues its work
> > to suspend to disk. If that task ever hits a call to try_to_freeze()
> > in the kernel, it will see system_freezing_cnt and pm_freezing=true
> > and freeze, and suspend to disk will hang forever. It could hit
> > try_to_freeze() because of a signal delivered to the task, or from
> > calling any syscall that uses a freezable_* helper like the one I
> > added to sys_futex.
> >
> > I think the right solution is to add a flag to the freezing task that
> > marks it unfreezable. I think PF_NOFREEZE would work, although it is
> > normally used on kernel threads, can you see if the attached patch
> > helps?
>
> That patch helps.
>
> BTW, the only machine I can reproduce this bug with is an i7-3630QM
> notebook. Cannot reproduce on an Core Duo U1400 and cannot reproduce on
> an i7 M 620.
>
> Are the sysreq backtraces still wanted? If so, any tip, how I could get
> them saved?
Typically by setting up a serial console or a netconsole and saving the
log from the attached terminal emulator (such as screen or minicom).
Is this what you are asking?
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-23 18:08 ` Michael Leun
2013-07-23 18:24 ` Darren Hart
@ 2013-07-23 18:29 ` Colin Cross
2013-07-23 19:16 ` Michael Leun
[not found] ` <CAMbhsRT6zOKLhG_uh=nA8H_3d7afhG+4jvWjvidY3fEguryP_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 2 replies; 42+ messages in thread
From: Colin Cross @ 2013-07-23 18:29 UTC (permalink / raw)
To: Michael Leun
Cc: lkml, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, Linux PM list, netdev, Linus Torvalds, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
On Tue, Jul 23, 2013 at 11:08 AM, Michael Leun
<lkml20130126@newton.leun.net> wrote:
> On Mon, 22 Jul 2013 16:55:58 -0700
> Colin Cross <ccross@android.com> wrote:
>
>> On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
>> <lkml20130126@newton.leun.net> wrote:
>> > On Mon, 6 May 2013 16:50:18 -0700
>> > Colin Cross <ccross@android.com> wrote:
>> >
>> >> Avoid waking up every thread sleeping in a futex_wait call during
>> > [...]
>> >
>> > With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
>> > displaying 0% of saving image to disk.
>> >
>> > echo "1" >/sys/power/state still works.
>> >
>> > Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4,
>> > reverting that from 3.11-rc2 makes s2disk working again.
>> >
>>
>> I think the expanded use of the freezable_* helpers is exposing an
>> existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
>> freeze_processes(), which sets the global system_freezing_cnt and
>> pm_freezing. try_to_freeze_tasks then sends every process except
>> current a signal which causes them all to end up in the refrigerator.
>> The current task then returns back to userspace and continues its work
>> to suspend to disk. If that task ever hits a call to try_to_freeze()
>> in the kernel, it will see system_freezing_cnt and pm_freezing=true
>> and freeze, and suspend to disk will hang forever. It could hit
>> try_to_freeze() because of a signal delivered to the task, or from
>> calling any syscall that uses a freezable_* helper like the one I
>> added to sys_futex.
>>
>> I think the right solution is to add a flag to the freezing task that
>> marks it unfreezable. I think PF_NOFREEZE would work, although it is
>> normally used on kernel threads, can you see if the attached patch
>> helps?
>
> That patch helps.
>
> BTW, the only machine I can reproduce this bug with is an i7-3630QM
> notebook. Cannot reproduce on an Core Duo U1400 and cannot reproduce on
> an i7 M 620.
>
> Are the sysreq backtraces still wanted? If so, any tip, how I could get
> them saved?
>
>
> --
> MfG,
>
> Michael Leun
>
Any chance that the failing machine has threads=y in the suspend.conf file?
Rafael, it appears that swsusp's suspend.c spawns new threads after
calling the SNAPSHOT_FREEZE ioctl. The PF_NOFREEZE (or the new flag)
will get copied to those new threads, but nothing will clear the flag.
Should I just assume that the userspace suspend code will kill those
threads before continuing with suspend? Or maybe add a WARN_ON in the
kernel if any threads besides current have the new flag set when the
suspend ops that assume all of userspace is frozen are called?
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
2013-07-23 18:29 ` Colin Cross
@ 2013-07-23 19:16 ` Michael Leun
[not found] ` <20130723211622.50f75087-gjVD6BTPoEbYa4IuQwzu8g@public.gmane.org>
[not found] ` <CAMbhsRT6zOKLhG_uh=nA8H_3d7afhG+4jvWjvidY3fEguryP_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 1 reply; 42+ messages in thread
From: Michael Leun @ 2013-07-23 19:16 UTC (permalink / raw)
To: Colin Cross
Cc: lkml, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, Linux PM list, netdev, Linus Torvalds, Tejun Heo,
Darren Hart, Thomas Gleixner, Randy Dunlap, Al Viro
On Tue, 23 Jul 2013 11:29:57 -0700
Colin Cross <ccross@android.com> wrote:
> On Tue, Jul 23, 2013 at 11:08 AM, Michael Leun
> <lkml20130126@newton.leun.net> wrote:
> > On Mon, 22 Jul 2013 16:55:58 -0700
> > Colin Cross <ccross@android.com> wrote:
> >
> >> On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
> >> <lkml20130126@newton.leun.net> wrote:
> >> > On Mon, 6 May 2013 16:50:18 -0700
> >> > Colin Cross <ccross@android.com> wrote:
> >> >
> >> >> Avoid waking up every thread sleeping in a futex_wait call
> >> >> during
> >> > [...]
> >> >
> >> > With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> >> > displaying 0% of saving image to disk.
> >> >
> >> > echo "1" >/sys/power/state still works.
> >> >
> >> > Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4,
> >> > reverting that from 3.11-rc2 makes s2disk working again.
> >> >
> >>
> >> I think the expanded use of the freezable_* helpers is exposing an
> >> existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
> >> freeze_processes(), which sets the global system_freezing_cnt and
> >> pm_freezing. try_to_freeze_tasks then sends every process except
> >> current a signal which causes them all to end up in the
> >> refrigerator. The current task then returns back to userspace and
> >> continues its work to suspend to disk. If that task ever hits a
> >> call to try_to_freeze() in the kernel, it will see
> >> system_freezing_cnt and pm_freezing=true and freeze, and suspend
> >> to disk will hang forever. It could hit try_to_freeze() because
> >> of a signal delivered to the task, or from calling any syscall
> >> that uses a freezable_* helper like the one I added to sys_futex.
> >>
> >> I think the right solution is to add a flag to the freezing task
> >> that marks it unfreezable. I think PF_NOFREEZE would work,
> >> although it is normally used on kernel threads, can you see if the
> >> attached patch helps?
> >
> > That patch helps.
> >
> > BTW, the only machine I can reproduce this bug with is an i7-3630QM
> > notebook. Cannot reproduce on an Core Duo U1400 and cannot
> > reproduce on an i7 M 620.
> >
> > Are the sysreq backtraces still wanted? If so, any tip, how I could
> > get them saved?
Darren Hart <dvhart@linux.intel.com> wrote:
> Typically by setting up a serial console or a netconsole and saving
[...]
> Is this what you are asking?
Yes, and it indeed works - I halfway expected the net / netconsole
stuff being already frozen in that situation...
Thanks, Darren - see below for the backtraces.
>
> Any chance that the failing machine has threads=y in the suspend.conf
> file?
Yes, that indeed is the trigger / difference, enabling that on the
U4100 (its not a U1400) machine makes that fail also and disabling
makes it work on the i7-3630QM.
[ 1405.527138] SysRq : Changing Loglevel
[ 1405.527220] Loglevel set to 9
[ 1407.845730] SysRq : Show backtrace of all active CPUs
[ 1407.845818] sending NMI to all CPUs:
[ 1407.845835] NMI backtrace for cpu 4
[ 1407.845870] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 3.11.0-rc2 #1
[ 1407.845911] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1407.845967] task: ffff880803540000 ti: ffff88080353a000 task.ti: ffff88080353a000
[ 1407.846002] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1407.846046] RSP: 0000:ffff88080353bde8 EFLAGS: 00000046
[ 1407.846072] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1407.846104] RDX: 0000000000000000 RSI: ffff88080353bfd8 RDI: 0000000000000004
[ 1407.846137] RBP: ffff88080353be18 R08: 0000000000000057 R09: 000000000fde67ee
[ 1407.846169] R10: 0000000000000000 R11: 00000000003567bb R12: 0000000000000005
[ 1407.846201] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1407.846246] FS: 0000000000000000(0000) GS:ffff88082f300000(0000) knlGS:0000000000000000
[ 1407.846283] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1407.846310] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1407.846342] Stack:
[ 1407.846355] ffff88080353be18 0000000481098d4d ffff88082f319e00 ffffffff81a56c00
[ 1407.846401] 000001473bc66eed 0000000000000005 ffff88080353be78 ffffffff81371eea
[ 1407.846452] 000000000000010a 000000000df017f3 000000000000010a 000000000df017f3
[ 1407.846498] Call Trace:
[ 1407.846520] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1407.846550] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1407.846580] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1407.846607] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1407.846637] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1407.846672] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1407.846709] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1407.847137] NMI backtrace for cpu 0
[ 1407.847140] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 1.301 msecs
[ 1407.847198] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.11.0-rc2 #1
[ 1407.847220] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1407.847254] task: ffffffff81a10440 ti: ffffffff81a00000 task.ti: ffffffff81a00000
[ 1407.847283] RIP: 0010:[<ffffffff8126667f>] [ 1407.847387] RBP: ffff88082f203b98 R08: 0000000000000001 R09: 000000000000066c
[ 1407.847414] R10: ffffffff81a1ec40 R11: 0000000000000000 R12: 000000000000006c
[ 1407.847441] R13: 0000000000000086 R14: 0000000000000001 R15: 0000000000000009
[ 1407.847467] FS: 0000000000000000(0000) GS:ffff88082f200000(0000) knlGS:0000000000000000
[ 1407.847495] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1407.847516] CR2: 00007fffb526ebdc CR3: 0000000001a0b000 CR4: 00000000001407f0
[ 1407.847540] Stack:
[ 1407.847550] ffff88082f203bb8 ffffffff81030500 0000000000000000 ffffffff81a5bd40
[ 1407.847589] ffff88082f203bc8 ffffffff812ec099 ffff88082f203c08 ffffffff812ec547
[ 1407.847624] ffff88082f203c88 ffff88080e80b400 0000000000000026 0000000000000001
[ 1407.848858] Call Trace:
[ 1407.850070] <IRQ>
[ 1407.850079] [<ffffffff81030500>] arch_trigger_all_cpu_backtrace+0x80/0xa0
[ 1407.852518] [<ffffffff812ec099>] sysrq_handle_showallcpus+0x9/0x10
[ 1407.853731] [<ffffffff812ec547>] __handle_sysrq+0x127/0x190
[ 1407.854922] [<ffffffff812ec92e>] sysrq_filter+0x33e/0x380
[ 1407.856114] [<ffffffff81335522>] input_to_handler+0x52/0xf0
[ 1407.857308] [<ffffffff813375a9>] input_pass_values.part.9+0x169/0x170
[ 1407.858508] [<ffffffff813388c7>] input_handle_event+0x117/0x530
[ 1407.859706] [<ffffffff81338de2>] input_event+0x52/0x70
[ 1407.860910] [<ffffffff81340457>] atkbd_interrupt+0x5e7/0x6b0
[ 1407.862117] [<ffffffff813329ed>] serio_interrupt+0x4d/0xa0
[ 1407.863317] [<ffffffff81333e4a>] i8042_interrupt+0x1ba/0x3a0
[ 1407.864513] [<ffffffff810708a1>] ? raw_notifier_call_chain+0x11/0x20
[ 1407.865716] [<ffffffff810984f8>] ? timekeeping_update.constprop.8+0x38/0x80
[ 1407.866926] [<ffffffff812a1bb0>] ? fbcon_add_cursor_timer+0x100/0x100
[ 1407.868139] [<ffffffff810cc78d>] handle_irq_event_percpu+0x6d/0x240
[ 1407.869357] [<ffffffff810cc9a3>] handle_irq_event+0x43/0x70
[ 1407.870572] [<ffffffff810cf07f>] handle_edge_irq+0x6f/0x110
[ 1407.871788] [<ffffffff81004aed>] handle_irq+0x1d/0x30
[ 1407.872996] [<ffffffff810045c5>] do_IRQ+0x55/0xd0
[ 1407.874202] [<ffffffff814989ea>] common_interrupt+0x6a/0x6a
[ 1407.875410] <EOI>
[ 1407.875419] [<ffffffff810a0b7f>] ? tick_program_event+0x1f/0x30
[ 1407.877811] [<ffffffff81371ef6>] ? cpuidle_enter_state+0x56/0xd0
[ 1407.879001] [<ffffffff81371ef2>] ? cpuidle_enter_state+0x52/0xd0
[ 1407.880171] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1407.881330] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1407.882484] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1407.883642] [<ffffffff81485380>] rest_init+0x80/0x90
[ 1407.884795] [<ffffffff81ab2e49>] start_kernel+0x3aa/0x3b7
[ 1407.885944] [<ffffffff81ab289e>] ? repair_env_string+0x5e/0x5e
[ 1407.887093] [<ffffffff81ab25a3>] x86_64_start_reservations+0x2a/0x2c
[ 1407.888236] [<ffffffff81ab269d>] x86_64_start_kernel+0xf8/0xfc
[ 1407.889366] Code: 4c 89 4d f8 c7 45 b8 10 00 00 00 48 89 45 c8 e8 38 ff ff ff c9 c3 66 0f 1f 44 00 00 8d 4e 3f 85 f6 55 0f 49 ce 48 89 e5 c1 f9 06 <85> c9 7e 61 48 83 3f 00 75 57 48 8d 57 08 31 c0 eb 12 0f 1f 80
[ 1407.890771] NMI backtrace for cpu 1
[ 1407.890773] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 44.935 msecs
[ 1407.894228] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.11.0-rc2 #1
[ 1407.895746] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1407.897286] task: ffff88080350aea0 ti: ffff880803534000 task.ti: ffff880803534000
[ 1407.899298] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1407.901326] RSP: 0018:ffff880803535de8 EFLAGS: 00000046
[ 1407.902884] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1407.904456] RDX: 0000000000000000 RSI: ffff880803535fd8 RDI: 0000000000000001
[ 1407.906026] RBP: ffff880803535e18 R08: 0000000000000057 R09: 000000000ff56e74
[ 1407.907597] R10: 0000000000000000 R11: 00000000003567c1 R12: 0000000000000005
[ 1407.909164] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1407.910669] FS: 0000000000000000(0000) GS:ffff88082f240000(0000) knlGS:0000000000000000
[ 1407.912575] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1407.914455] CR2: 00007ff17fd28000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1407.915879] Stack:
[ 1407.917716] ffff880803535e18 0000000181098d4d ffff88082f259e00 ffffffff81a56c00
[ 1407.919152] 00000146e25e4673 0000000000000005 ffff880803535e78 ffffffff81371eea
[ 1407.920573] 000000000000010b 000000002c46c98c 000000000000010b 000000002c46c98c
[ 1407.921986] Call Trace:
[ 1407.923370] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1407.924769] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1407.926166] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1407.927561] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1407.928963] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1407.930368] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1407.932200] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1407.933922] NMI backtrace for cpu 5
[ 1407.933924] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 88.055 msecs
[ 1407.936433] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 3.11.0-rc2 #1
[ 1407.937700] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1407.938987] task: ffff880803541750 ti: ffff88080353c000 task.ti: ffff88080353c000
[ 1407.940270] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1407.941576] RSP: 0000:ffff88080353dde8 EFLAGS: 00000046
[ 1407.942873] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1407.944181] RDX: 0000000000000000 RSI: ffff88080353dfd8 RDI: 0000000000000005
[ 1407.945488] RBP: ffff88080353de18 R08: 0000000000000057 R09: 000000000fd6bb17
[ 1407.946798] R10: 0000000000000000 R11: 00000000003567d7 R12: 0000000000000005
[ 1407.948105] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1407.949415] FS: 0000000000000000(0000) GS:ffff88082f340000(0000) knlGS:0000000000000000
[ 1407.950735] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1407.952055] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1407.953389] Stack:
[ 1407.954719] ffff88080353de18 0000000581098d4d ffff88082f359e00 ffffffff81a56c00
[ 1407.956084] 000001475993cee2 0000000000000005 ffff88080353de78 ffffffff81371eea
[ 1407.957448] 0000000000000109 000000002b8fbaa2 0000000000000109 000000002b8fbaa2
[ 1407.958812] Call Trace:
[ 1407.960160] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1407.961519] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1407.962879] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1407.964240] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1407.965602] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1407.966978] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1407.968352] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1407.970046] NMI backtrace for cpu 6
[ 1407.970048] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 124.179 msecs
[ 1407.974761] CPU: 6 PID: 0 Comm: swapper/6 Not tainted 3.11.0-rc2 #1
[ 1407.976613] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1407.978491] task: ffff880803542ea0 ti: ffff88080353e000 task.ti: ffff88080353e000
[ 1407.980381] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1407.982855] RSP: 0018:ffff88080353fde8 EFLAGS: 00000046
[ 1407.984756] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1407.986674] RDX: 0000000000000000 RSI: ffff88080353ffd8 RDI: 0000000000000006
[ 1407.988590] RBP: ffff88080353fe18 R08: 0000000000000057 R09: 000000000fcf0e3f
[ 1407.991088] R10: 0000000000000000 R11: 00000000003567da R12: 0000000000000005
[ 1407.993018] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1407.994875] FS: 0000000000000000(0000) GS:ffff88082f380000(0000) knlGS:0000000000000000
[ 1407.996698] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1407.998485] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1408.000272] Stack:
[ 1408.002572] ffff88080353fe18 0000000681098d4d ffff88082f399e00 ffffffff81a56c00
[ 1408.004361] 0000014777613532 0000000000000005 ffff88080353fe78 ffffffff81371eea
[ 1408.006674] 0000000000000109 000000000d948c6f 0000000000000109 000000000d948c6f
[ 1408.008443] Call Trace:
[ 1408.010189] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1408.011951] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1408.014250] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1408.016546] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1408.018843] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1408.021144] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1408.022885] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1408.024957] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 179.088 msecs
[ 1408.024958] NMI backtrace for cpu 2
[ 1408.024960] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.11.0-rc2 #1
[ 1408.024961] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1408.024962] task: ffff88080350c5f0 ti: ffff880803536000 task.ti: ffff880803536000
[ 1408.024964] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1408.024965] RSP: 0000:ffff880803537de8 EFLAGS: 00000046
[ 1408.024966] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1408.024967] RDX: 0000000000000000 RSI: ffff880803537fd8 RDI: 0000000000000002
[ 1408.024967] RBP: ffff880803537e18 R08: 0000000000000057 R09: 000000000fedc1a1
[ 1408.024968] R10: 0000000000000000 R11: 00000000003567d7 R12: 0000000000000005
[ 1408.024969] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1408.024970] FS: 0000000000000000(0000) GS:ffff88082f280000(0000) knlGS:0000000000000000
[ 1408.024971] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1408.024971] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1408.024972] Stack:
[ 1408.024974] ffff880803537e18 0000000281098d4d ffff88082f299e00 ffffffff81a56c00
[ 1408.024975] 00000147002b9b55 0000000000000005 ffff880803537e78 ffffffff81371eea
[ 1408.024976] 000000000000010b 000000000e4baf99 000000000000010b 000000000e4baf99
[ 1408.024977] Call Trace:
[ 1408.024979] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1408.024982] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1408.024984] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1408.024985] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1408.024987] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1408.024989] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1408.025006] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1408.025008] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 179.139 msecs
[ 1408.025009] NMI backtrace for cpu 7
[ 1408.025011] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 3.11.0-rc2 #1
[ 1408.025011] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1408.025013] task: ffff8808035445f0 ti: ffff880803550000 task.ti: ffff880803550000
[ 1408.025016] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1408.025016] RSP: 0000:ffff880803551de8 EFLAGS: 00000046
[ 1408.025017] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1408.025018] RDX: 0000000000000000 RSI: ffff880803551fd8 RDI: 0000000000000007
[ 1408.025018] RBP: ffff880803551e18 R08: 0000000000000057 R09: 000000000007a079
[ 1408.025019] R10: 0000000000000000 R11: 000000000020e8dc R12: 0000000000000005
[ 1408.025020] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1408.025021] FS: 0000000000000000(0000) GS:ffff88082f3c0000(0000) knlGS:0000000000000000
[ 1408.025022] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1408.025022] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1408.025023] Stack:
[ 1408.025025] ffff880803551e18 0000000781098d4d ffff88082f3d9e00 ffffffff81a56c00
[ 1408.025026] 0000014777614583 0000000000000005 ffff880803551e78 ffffffff81371eea
[ 1408.025027] 0000000000000000 000000001dcad99a 0000000000000000 000000001dcad99a
[ 1408.025028] Call Trace:
[ 1408.025030] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1408.025032] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1408.025035] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1408.025036] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1408.025038] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1408.025040] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1408.025057] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1408.025057] NMI backtrace for cpu 3
[ 1408.025059] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 179.189 msecs
[ 1408.025061] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 3.11.0-rc2 #1
[ 1408.025061] Hardware name: CLEVO P15xEMx/P15xEMx, BIOS 4.6.5 01/24/2013
[ 1408.025062] task: ffff88080350dd40 ti: ffff880803538000 task.ti: ffff880803538000
[ 1408.025064] RIP: 0010:[<ffffffff812ac403>] [<ffffffff812ac403>] intel_idle+0xa3/0xf0
[ 1408.025065] RSP: 0000:ffff880803539de8 EFLAGS: 00000046
[ 1408.025065] RAX: 0000000000000030 RBX: 0000000000000010 RCX: 0000000000000001
[ 1408.025066] RDX: 0000000000000000 RSI: ffff880803539fd8 RDI: 0000000000000003
[ 1408.025066] RBP: ffff880803539e18 R08: 0000000000000057 R09: 00000000001e939c
[ 1408.025067] R10: 0000000000000000 R11: 00000000001c6983 R12: 0000000000000005
[ 1408.025067] R13: 0000000000000030 R14: 0000000000000004 R15: ffffffff81a56dd0
[ 1408.025068] FS: 0000000000000000(0000) GS:ffff88082f2c0000(0000) knlGS:0000000000000000
[ 1408.025068] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1408.025069] CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000001407e0
[ 1408.025069] Stack:
[ 1408.025070] ffff880803539e18 0000000381098d4d ffff88082f2d9e00 ffffffff81a56c00
[ 1408.025071] 0000014780148c27 0000000000000005 ffff880803539e78 ffffffff81371eea
[ 1408.025071] 0000000000000002 00000000003b0659 0000000000000002 00000000003b0659
[ 1408.025072] Call Trace:
[ 1408.025073] [<ffffffff81371eea>] cpuidle_enter_state+0x4a/0xd0
[ 1408.025075] [<ffffffff81372026>] cpuidle_idle_call+0xb6/0x260
[ 1408.025076] [<ffffffff8100c699>] arch_cpu_idle+0x9/0x20
[ 1408.025078] [<ffffffff81097800>] cpu_startup_entry+0x80/0x280
[ 1408.025079] [<ffffffff8109f301>] ? clockevents_config_and_register+0x21/0x30
[ 1408.025080] [<ffffffff8102cc2c>] start_secondary+0x1cc/0x270
[ 1408.025090] Code: 28 e0 ff ff 83 e2 08 75 22 31 d2 48 83 c0 10 48 89 d1 0f 01 c8 0f ae f0 48 8b 86 38 e0 ff ff a8 08 75 08 b1 01 4c 89 e8 0f 01 c9 <85> 1d 8f ab 7a 00 75 0e 48 8d 75 dc bf 05 00 00 00 e8 37 2a df
[ 1408.025091] INFO: NMI handler (arch_trigger_all_cpu_backtrace_handler) took too long to run: 179.222 msecs
--
MfG,
Michael Leun
^ permalink raw reply [flat|nested] 42+ messages in thread
[parent not found: <CAMbhsRT6zOKLhG_uh=nA8H_3d7afhG+4jvWjvidY3fEguryP_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
[not found] ` <CAMbhsRT6zOKLhG_uh=nA8H_3d7afhG+4jvWjvidY3fEguryP_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-07-23 21:43 ` Rafael J. Wysocki
0 siblings, 0 replies; 42+ messages in thread
From: Rafael J. Wysocki @ 2013-07-23 21:43 UTC (permalink / raw)
To: Colin Cross
Cc: Michael Leun, lkml, Pavel Machek, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Oleg Nesterov, linux-nfs,
Linux PM list, netdev, Linus Torvalds, Tejun Heo, Darren Hart,
Thomas Gleixner, Randy Dunlap, Al Viro
On Tuesday, July 23, 2013 11:29:57 AM Colin Cross wrote:
> On Tue, Jul 23, 2013 at 11:08 AM, Michael Leun
> <lkml20130126-yS7QfQBdiAdyjo5WHAzKoQ@public.gmane.org> wrote:
> > On Mon, 22 Jul 2013 16:55:58 -0700
> > Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
> >
> >> On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
> >> <lkml20130126-yS7QfQBdiAdyjo5WHAzKoQ@public.gmane.org> wrote:
> >> > On Mon, 6 May 2013 16:50:18 -0700
> >> > Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
> >> >
> >> >> Avoid waking up every thread sleeping in a futex_wait call during
> >> > [...]
> >> >
> >> > With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> >> > displaying 0% of saving image to disk.
> >> >
> >> > echo "1" >/sys/power/state still works.
> >> >
> >> > Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4,
> >> > reverting that from 3.11-rc2 makes s2disk working again.
> >> >
> >>
> >> I think the expanded use of the freezable_* helpers is exposing an
> >> existing bug in hibernation. The SNAPSHOT_FREEZE ioctl calls
> >> freeze_processes(), which sets the global system_freezing_cnt and
> >> pm_freezing. try_to_freeze_tasks then sends every process except
> >> current a signal which causes them all to end up in the refrigerator.
> >> The current task then returns back to userspace and continues its work
> >> to suspend to disk. If that task ever hits a call to try_to_freeze()
> >> in the kernel, it will see system_freezing_cnt and pm_freezing=true
> >> and freeze, and suspend to disk will hang forever. It could hit
> >> try_to_freeze() because of a signal delivered to the task, or from
> >> calling any syscall that uses a freezable_* helper like the one I
> >> added to sys_futex.
> >>
> >> I think the right solution is to add a flag to the freezing task that
> >> marks it unfreezable. I think PF_NOFREEZE would work, although it is
> >> normally used on kernel threads, can you see if the attached patch
> >> helps?
> >
> > That patch helps.
> >
> > BTW, the only machine I can reproduce this bug with is an i7-3630QM
> > notebook. Cannot reproduce on an Core Duo U1400 and cannot reproduce on
> > an i7 M 620.
> >
> > Are the sysreq backtraces still wanted? If so, any tip, how I could get
> > them saved?
> >
> >
> > --
> > MfG,
> >
> > Michael Leun
> >
>
> Any chance that the failing machine has threads=y in the suspend.conf file?
>
> Rafael, it appears that swsusp's suspend.c spawns new threads after
> calling the SNAPSHOT_FREEZE ioctl. The PF_NOFREEZE (or the new flag)
> will get copied to those new threads, but nothing will clear the flag.
> Should I just assume that the userspace suspend code will kill those
> threads before continuing with suspend? Or maybe add a WARN_ON in the
> kernel if any threads besides current have the new flag set when the
> suspend ops that assume all of userspace is frozen are called?
Those threads should be killed by user space. They are only spawned for
image saving/compression/encryption and should be waited for after that.
Thanks,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
[parent not found: <20130723010250.5a3465ec-gjVD6BTPoEbYa4IuQwzu8g@public.gmane.org>]
* Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCH v3 13/16] futex: use freezable blocking call)
[not found] ` <20130723010250.5a3465ec-gjVD6BTPoEbYa4IuQwzu8g@public.gmane.org>
@ 2013-07-23 0:26 ` Pavel Machek
0 siblings, 0 replies; 42+ messages in thread
From: Pavel Machek @ 2013-07-23 0:26 UTC (permalink / raw)
To: Michael Leun
Cc: Colin Cross, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar, Andrew Morton,
Mandeep Singh Baines, Oleg Nesterov,
linux-nfs-u79uwXL29TY76Z2rM5mHXA,
linux-pm-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Linus Torvalds, Tejun Heo, Darren Hart, Thomas Gleixner,
Randy Dunlap, Al Viro
On Tue 2013-07-23 01:02:50, Michael Leun wrote:
> On Mon, 6 May 2013 16:50:18 -0700
> Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
>
> > Avoid waking up every thread sleeping in a futex_wait call during
> [...]
>
> With 3.11-rc s2disk from suspend-utils stopped working: Frozen at
> displaying 0% of saving image to disk.
>
> echo "1" >/sys/power/state still works.
>
> Bisecting yielded 88c8004fd3a5fdd2378069de86b90b21110d33a4, reverting
> that from 3.11-rc2 makes s2disk working again.
Would id be possible to get all the backtraces using magic sysrq?
...actually...
I see what could happen. Before, system hibernated in state where all
the futexes were unlocked. Now, it can happen that we attempt s2disk
with futex held. s2disk should not depend on other parts of userspace,
and should not take futexes, but maybe it does...?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v3 14/16] nanosleep: use freezable blocking call
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (11 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 13/16] futex: " Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 15/16] sigtimedwait: " Colin Cross
` (2 subsequent siblings)
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
Thomas Gleixner
Avoid waking up every thread sleeping in a nanosleep call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Colin Cross <ccross@android.com>
---
kernel/hrtimer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 14be27f..e036276 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -47,6 +47,7 @@
#include <linux/sched/sysctl.h>
#include <linux/sched/rt.h>
#include <linux/timer.h>
+#include <linux/freezer.h>
#include <asm/uaccess.h>
@@ -1525,7 +1526,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
t->task = NULL;
if (likely(t->task))
- schedule();
+ freezable_schedule();
hrtimer_cancel(&t->timer);
mode = HRTIMER_MODE_ABS;
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 15/16] sigtimedwait: use freezable blocking call
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (12 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 14/16] nanosleep: use freezable blocking call Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-06 23:50 ` [PATCH v3 16/16] af_unix: use freezable blocking calls in read Colin Cross
2013-05-07 18:12 ` [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Tejun Heo
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo, Al Viro,
Eric W. Biederman, Kees Cook
Avoid waking up every thread sleeping in a sigtimedwait call during
suspend and resume by calling a freezable blocking call. Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
kernel/signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index 598dc06..10a70a0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2845,7 +2845,7 @@ int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
recalc_sigpending();
spin_unlock_irq(&tsk->sighand->siglock);
- timeout = schedule_timeout_interruptible(timeout);
+ timeout = freezable_schedule_timeout_interruptible(timeout);
spin_lock_irq(&tsk->sighand->siglock);
__set_task_blocked(tsk, &tsk->real_blocked);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v3 16/16] af_unix: use freezable blocking calls in read
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (13 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 15/16] sigtimedwait: " Colin Cross
@ 2013-05-06 23:50 ` Colin Cross
2013-05-07 18:12 ` [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Tejun Heo
15 siblings, 0 replies; 42+ messages in thread
From: Colin Cross @ 2013-05-06 23:50 UTC (permalink / raw)
To: linux-kernel
Cc: Pavel Machek, Rafael J. Wysocki, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Colin Cross, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds, Tejun Heo,
David S. Miller, Eric Dumazet, Al Viro, Eric W. Biederman,
Gao feng
Avoid waking up every thread sleeping in read call on an AF_UNIX
socket during suspend and resume by calling a freezable blocking
call. Previous patches modified the freezer to avoid sending
wakeups to threads that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
---
net/unix/af_unix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2db702d..2bcac57 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -114,6 +114,7 @@
#include <linux/mount.h>
#include <net/checksum.h>
#include <linux/security.h>
+#include <linux/freezer.h>
struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE];
EXPORT_SYMBOL_GPL(unix_socket_table);
@@ -1880,7 +1881,7 @@ static long unix_stream_data_wait(struct sock *sk, long timeo)
set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
unix_state_unlock(sk);
- timeo = schedule_timeout(timeo);
+ timeo = freezable_schedule_timeout(timeo);
unix_state_lock(sk);
clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
}
--
1.8.2.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups
2013-05-06 23:50 [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Colin Cross
` (14 preceding siblings ...)
2013-05-06 23:50 ` [PATCH v3 16/16] af_unix: use freezable blocking calls in read Colin Cross
@ 2013-05-07 18:12 ` Tejun Heo
2013-05-08 0:02 ` Rafael J. Wysocki
15 siblings, 1 reply; 42+ messages in thread
From: Tejun Heo @ 2013-05-07 18:12 UTC (permalink / raw)
To: Colin Cross
Cc: linux-kernel, Pavel Machek, Rafael J. Wysocki, Peter Zijlstra,
Ingo Molnar, Andrew Morton, Mandeep Singh Baines, Oleg Nesterov,
linux-nfs, linux-pm, netdev, Linus Torvalds
Hello,
On Mon, May 06, 2013 at 04:50:05PM -0700, Colin Cross wrote:
> On slow cpus the large number of task wakeups and context switches
> triggered by freezing and thawing tasks can take a significant amount
> of cpu time. This patch series reduces the amount of work done during
> freezing tasks by avoiding waking up tasks that are already in a freezable
> state.
For the whole series,
Acked-by: Tejun Heo <tj@kernel.org>
Thanks a lot!
--
tejun
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups
2013-05-07 18:12 ` [PATCH v2 00/10] optimize freezing tasks by reducing task wakeups Tejun Heo
@ 2013-05-08 0:02 ` Rafael J. Wysocki
0 siblings, 0 replies; 42+ messages in thread
From: Rafael J. Wysocki @ 2013-05-08 0:02 UTC (permalink / raw)
To: Tejun Heo, Colin Cross
Cc: linux-kernel, Pavel Machek, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Mandeep Singh Baines, Oleg Nesterov, linux-nfs,
linux-pm, netdev, Linus Torvalds
On Tuesday, May 07, 2013 11:12:37 AM Tejun Heo wrote:
> Hello,
>
> On Mon, May 06, 2013 at 04:50:05PM -0700, Colin Cross wrote:
> > On slow cpus the large number of task wakeups and context switches
> > triggered by freezing and thawing tasks can take a significant amount
> > of cpu time. This patch series reduces the amount of work done during
> > freezing tasks by avoiding waking up tasks that are already in a freezable
> > state.
>
> For the whole series,
>
> Acked-by: Tejun Heo <tj@kernel.org>
>
> Thanks a lot!
All 16 patches queued up as v3.11 material.
Many thanks to everyone involved,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 42+ messages in thread