Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"
Subsystems (2)
PATCH 1/1 Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"
This reverts commit 24ba16bb3d499c49974669cd8429c3e4138ab102 as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.
There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
--- fs/xfs/xfs_trans_ail.c | 1 - 1 file changed, 1 deletion(-)
fs/xfs/xfs_trans_ail.c +0 -1
@@ -497,7 +497,6 @@ xfsaild(long tout =0 ;/* milliseconds */ current->flags |=PF_MEMALLOC ; -set_freezable ();while (!kthread_should_stop ()) {if (tout && tout <=20 )
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 11 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
Signed-off-by Dave Chinner <[email protected]>
I hope I'll find time in the future and make some progress on making the fs freezing happen during suspend properly. Unfortunately, before that happens
Thanks,
Signature · 7 lines
Jiri Kosina SUSE Labs _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.
Quoted 5 lines
There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
Signed-off-by Dave Chinner <[email protected]>---
Quoted 22 lines
fs/xfs/xfs_trans_ail.c | 1 - 1 file changed, 1 deletion(-)fs/xfs/xfs_trans_ail.c +0
-1@@ -497,7 +497,6 @@ xfsaild(long tout =0 ;/* milliseconds */ current->flags |=PF_MEMALLOC ; -set_freezable ();while (!kthread_should_stop ()) {if (tout && tout <=20 )Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 9 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
We had a similar report opensuse bugzilla just recently. I believe the proper fix should be the following:
---
Quoted 1 line
From
ae910a86ada86804c34cc8136afebc9fefa15813Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 19 Jan 2016 20:28:49 +0100
Subject: [PATCH] xfs, xfsaild: Do not block suspend
Hendik has reported suspend failures due to xfsaild blocking the freezer to settle down.
Jan 17 19:59:56 linux-6380 kernel: PM: Syncing filesystems ... done. Jan 17 19:59:56 linux-6380 kernel: PM: Preparing system for sleep (mem) Jan 17 19:59:56 linux-6380 kernel: Freezing user space processes ... (elapsed 0.001 seconds) done. Jan 17 19:59:56 linux-6380 kernel: Freezing remaining freezable tasks ... Jan 17 19:59:56 linux-6380 kernel: Freezing of tasks failed after 20.002 seconds (1 tasks refusing to freeze, wq_busy=0): Jan 17 19:59:56 linux-6380 kernel: xfsaild/dm-5 S 00000000 0 1293 2 0x00000080 Jan 17 19:59:56 linux-6380 kernel: f0ef5f00 00000046 00000200 00000000 ffff9022 c02d3800 00000000 00000032 Jan 17 19:59:56 linux-6380 kernel: ee0b2400 00000032 f71e0d00 f36fabc0 f0ef2d00 f0ef6000 f0ef2d00 f12f90c0 Jan 17 19:59:56 linux-6380 kernel: f0ef5f0c c0844e44 00000000 f0ef5f6c f811e0be 00000000 00000000 f0ef2d00 Jan 17 19:59:56 linux-6380 kernel: Call Trace: Jan 17 19:59:56 linux-6380 kernel: [<c0844e44>] schedule+0x34/0x90 Jan 17 19:59:56 linux-6380 kernel: [<f811e0be>] xfsaild+0x5de/0x600 [xfs] Jan 17 19:59:56 linux-6380 kernel: [<c0286cbb>] kthread+0x9b/0xb0 Jan 17 19:59:56 linux-6380 kernel: [<c0848a79>] ret_from_kernel_thread+0x21/0x38
The issue has been there for quite some time but it has been made visible by only by 24ba16bb3d49 ("xfs: clear PF_NOFREEZE for xfsaild kthread") because the suspend started seeing xfsaild.
The above commit has missed that the !xfs_ail_min branch might call schedule with TASK_INTERRUPTIBLE without calling try_to_freeze so the pm suspend would wake up the kernel thread over and over again without any progress. What we want here is to use freezable_schedule instead to hide the thread from the suspend.
While we are here also change schedule_timeout to freezable variant to prevent from spurious wakeups by suspend.
--- fs/xfs/xfs_trans_ail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_trans_ail.c +2 -2
@@ -520,14 +520,14 @@ xfsaild(if (!xfs_ail_min (ailp) && ailp->xa_target == ailp->xa_target_prev) {spin_unlock (&ailp->xa_lock); -schedule (); +freezable_schedule (); tout =0 ;continue ; }spin_unlock (&ailp->xa_lock);if (tout) -schedule_timeout (msecs_to_jiffies (tout)); +freezable_schedule_timeout (msecs_to_jiffies (tout));__set_current_state (TASK_RUNNING );
Signature · 10 lines
2.7.0.rc3 -- Michal Hocko SUSE Labs _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 13 lines · Michal Hocko
Quoted 9 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
We had a similar report opensuse bugzilla just recently. I believe the proper fix should be the following:
....
fs/xfs/xfs_trans_ail.c xfsaild( · line 523
Quoted 10 lines
fs/xfs/xfs_trans_ail.c +1
-1@@ -520,14 +520,14 @@ xfsaild(if (!xfs_ail_min (ailp) && ailp->xa_target == ailp->xa_target_prev) {spin_unlock (&ailp->xa_lock); -schedule (); +freezable_schedule ();
Oh, wonderful. A completely separate set of undocumented schedule functions defined inside the freezer header files that are needed just for freezable kthreads. Perhaps there should be some documentation somewhere on how to write suspend safe kthreads?
This is too late for the current merge window, but I'll queue it up for the next one so we can get some testing on it first.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
[CCing Rafael - the thread starts here
http://lkml.kernel.org/r/1452661968-11482-1-git-send-email-david%40fromorbit.com]
Quoted 15 lines · Dave Chinner
Quoted 13 lines · Michal Hocko
Quoted 9 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
We had a similar report opensuse bugzilla just recently. I believe the proper fix should be the following:
....
Quoted 14 lines
fs/xfs/xfs_trans_ail.c xfsaild( · line 523
Quoted 10 lines
fs/xfs/xfs_trans_ail.c +1
-1@@ -520,14 +520,14 @@ xfsaild(if (!xfs_ail_min (ailp) && ailp->xa_target == ailp->xa_target_prev) {spin_unlock (&ailp->xa_lock); -schedule (); +freezable_schedule ();Oh, wonderful. A completely separate set of undocumented schedule functions defined inside the freezer header files that are needed just for freezable kthreads.
Yeah, I am not really happy about them either.
Quoted 2 lines
Perhaps there should be some documentation somewhere on how to write suspend safe kthreads?
There is something in Documentation/power/freezing-of-tasks.txt but freezable_schedule* is not mentioned there. Prhaps something like the following would make it more clear?
Documentation/power/freezing-of-tasks.txt +5 -2
@@ -56,8 +56,11 @@ calling try_to_freeze(). The main loop of a freezable kernel thread may look If a freezable kernel thread fails to call try_to_freeze() after the freezer has initiated a freezing operation, the freezing of tasks will fail and the entire hibernation operation will be cancelled. For this reason, freezable kernel -threads must call try_to_freeze() somewhere or use one of the -wait_event_freezable() and wait_event_freezable_timeout() macros. +threads must call try_to_freeze() somewhere, use wait_event_freezable*() +and wait_event_freezable_timeout() macros or use freezable_schedule* to hide +the kernel thread from the suspend if it is guaranteed that a later wake up +cannot interact with the suspend process (e.g. there is a try_to_freeze call +or no IO is submitted or any of the suspended devices is not accessed etc..) After the system memory state has been restored from a hibernation image and devices have been reinitialized, the function thaw_processes() is called in
Quoted 2 lines
This is too late for the current merge window, but I'll queue it up for the next one so we can get some testing on it first.
Sure, no problem and thanks!
Signature · 7 lines
Michal Hocko SUSE Labs _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 34 lines · Michal Hocko
[CCing Rafael - the thread starts here
http://lkml.kernel.org/r/1452661968-11482-1-git-send-email-david%40fromorbit.com]Quoted 15 lines · Dave Chinner
Quoted 13 lines · Michal Hocko
Quoted 9 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
We had a similar report opensuse bugzilla just recently. I believe the proper fix should be the following:
....
Quoted 14 lines
fs/xfs/xfs_trans_ail.c xfsaild( · line 523
Quoted 10 lines
fs/xfs/xfs_trans_ail.c +1
-1@@ -520,14 +520,14 @@ xfsaild(if (!xfs_ail_min (ailp) && ailp->xa_target == ailp->xa_target_prev) {spin_unlock (&ailp->xa_lock); -schedule (); +freezable_schedule ();Oh, wonderful. A completely separate set of undocumented schedule functions defined inside the freezer header files that are needed just for freezable kthreads.
Quoted 8 lines
Yeah, I am not really happy about them either.
Quoted 2 lines
Perhaps there should be some documentation somewhere on how to write suspend safe kthreads?
There is something in
Documentation/power/freezing-of-tasks.txtbut freezable_schedule* is not mentioned there. Prhaps something like the following would make it more clear?
When I did "git grep freezable_schedule" nothing showed up in the Documentation directory. I'd suggest that the entire API needs reference in Documentation/scheduler (i.e. all the freezable_schedule_timeout variants, the wait_event stuff, etc) as well as in the freezer documentation so that git grep finds them in the appropriate places....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 46 lines · Michal Hocko
Quoted 9 lines · Dave Chinner
This reverts commit
24ba16bb3d499c49974669cd8429c3e4138ab102as it prevents machines from suspending. This regression occurs when the xfsaild is idle on entry to suspend, and so there s no activity to wake it from it's idle sleep and hence see that it is supposed to freeze. Hence the freezer times out waiting for it and suspend is cancelled.There is no obvious fix for this short of freezing the filesystem properly, so revert this change for now.
We had a similar report opensuse bugzilla just recently. I believe the proper fix should be the following:
---
Fromae910a86ada86804c34cc8136afebc9fefa15813Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Tue, 19 Jan 2016 20:28:49 +0100
Subject: [PATCH] xfs, xfsaild: Do not block suspendHendik has reported suspend failures due to xfsaild blocking the freezer to settle down.
Jan 17 19:59:56 linux-6380 kernel: PM: Syncing filesystems ... done. Jan 17 19:59:56 linux-6380 kernel: PM: Preparing system for sleep (mem) Jan 17 19:59:56 linux-6380 kernel: Freezing user space processes ... (elapsed 0.001 seconds) done. Jan 17 19:59:56 linux-6380 kernel: Freezing remaining freezable tasks ... Jan 17 19:59:56 linux-6380 kernel: Freezing of tasks failed after 20.002 seconds (1 tasks refusing to freeze, wq_busy=0): Jan 17 19:59:56 linux-6380 kernel: xfsaild/dm-5 S 00000000 0 1293 2 0x00000080 Jan 17 19:59:56 linux-6380 kernel: f0ef5f00 00000046 00000200 00000000 ffff9022 c02d3800 00000000 00000032 Jan 17 19:59:56 linux-6380 kernel: ee0b2400 00000032 f71e0d00 f36fabc0 f0ef2d00 f0ef6000 f0ef2d00 f12f90c0 Jan 17 19:59:56 linux-6380 kernel: f0ef5f0c c0844e44 00000000 f0ef5f6c f811e0be 00000000 00000000 f0ef2d00 Jan 17 19:59:56 linux-6380 kernel: Call Trace: Jan 17 19:59:56 linux-6380 kernel: [<c0844e44>] schedule+0x34/0x90 Jan 17 19:59:56 linux-6380 kernel: [<f811e0be>] xfsaild+0x5de/0x600 [xfs] Jan 17 19:59:56 linux-6380 kernel: [<c0286cbb>] kthread+0x9b/0xb0 Jan 17 19:59:56 linux-6380 kernel: [<c0848a79>] ret_from_kernel_thread+0x21/0x38The issue has been there for quite some time but it has been made visible by only by
24ba16bb3d49("xfs: clearPF_NOFREEZEfor xfsaild kthread") because the suspend started seeing xfsaild.The above commit has missed that the !xfs_ail_min branch might call schedule with
TASK_INTERRUPTIBLEwithout callingtry_to_freezeso the pm suspend would wake up the kernel thread over and over again without any progress. What we want here is to usefreezable_scheduleinstead to hide the thread from the suspend.
Quoted 5 lines
While we are here also change
schedule_timeoutto freezable variant to prevent from spurious wakeups by suspend.Reported-by Hendrik Woltersdorf <[email protected]>Signed-off-by Michal Hocko <[email protected]>
Hendrik was able to test the patch so feel free to add his Tested-by
Signature · 7 lines
Michal Hocko SUSE Labs _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs