Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 481344 - vanilla kernel >=3.7 fails to resume image after s2disk
Summary: vanilla kernel >=3.7 fails to resume image after s2disk
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://git.kernel.org/cgit/linux/kern...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-08-16 17:26 UTC by Andrew Savchenko
Modified: 2013-10-14 18:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
linuxrc-workaround.patch (linuxrc-workaround.patch,2.96 KB, patch)
2013-08-16 17:27 UTC, Andrew Savchenko
Details | Diff
config.xz (config.xz,9.59 KB, application/x-xz)
2013-08-16 17:27 UTC, Andrew Savchenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2013-08-16 17:26:32 UTC
Hello,

after a kernel update from 3.5.7 to the latest stable I found that
user-space resume (from suspend-1.0 aka uswsusp) no longer works.
Kernel-space suspend and resume work fine (e.g. echo disk
> /sys/power/state), problem is with user-space support. (I need
user-space version because it supports image encryption.)

After resume (essentially linuxrc) application loads image it fails
to apply it:

========================================================
Processes could not be frozen, cannot continue resuming.
Error 11: Resource temporarily unavailable

You can now boot the system and lose the saved state
or reboot and try again.

[Notice that if you decide to reboot, you MUST NOT mount
any filesystems before a successful resume.
Resuming after some filesystems have been mounted
will badly damage these filesystems.]

Do you want to continue booting (Y/n)?
========================================================

Error code wasn't originally showed, I added it to suspend tool to
aid debugging. Essentially freeze ioctl on /dev/snapshot fails with
this error.

I bisected a commit which introduces this bug:

========================================================
commit ba4df2808a86f8b103c4db0b8807649383e9bd13 
Author: Al Viro <viro@zeniv.linux.org.uk> 
Date:   Tue Oct 2 15:29:10 2012 -0400 

    don't bother with kernel_thread/kernel_execve for launching
linuxrc 
    exec_usermodehelper_fns() will do just fine... 
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> 
========================================================

In fact this commit induced/triggered at least two bugs: the first one
I'm facing now and the second one was fixed in commit
f0de17c0babe7f29381892def6b37e9181a53410:
make sure that /linuxrc has std{in,out,err}.

As a temporarily workaround for this issue I reverted all changes for
init/do_mounts_initrd.c up to the latest working commit
cb450766bcafc7bd7d40e9a5a0050745e8c68b3e considering the kernel API
changes (kernel_execve -> sys_execve). See linuxrc-workaround.patch.
I understand this isn't a proper solution, I just want to show what
code works for me.

I also found an interesting LKML discussion about s2disk and freezer
issue: http://www.spinics.net/lists/linux-nfs/msg38160.html
Maybe it is related to this bug, but patch proposed there doesn't in
my case.

Kernel config which fails with
ba4df2808a86f8b103c4db0b8807649383e9bd13 and works with
f0de17c0babe7f29381892def6b37e9181a53410 is also attached.

As this issue maybe hardware related, the system is 32-bit EEE PC
1000H with Atom N270, 2GB RAM, 750 GB SATA drive.

Original discussion on this bug may be found here: https://forums.gentoo.org/viewtopic-p-7371120.html

I notified LKML of this trouble:
http://marc.info/?l=linux-kernel&m=137633669228353
Comment 1 Andrew Savchenko gentoo-dev 2013-08-16 17:27:16 UTC
Created attachment 356238 [details, diff]
linuxrc-workaround.patch
Comment 2 Andrew Savchenko gentoo-dev 2013-08-16 17:27:29 UTC
Created attachment 356240 [details]
config.xz
Comment 3 Andrew Savchenko gentoo-dev 2013-08-16 17:30:12 UTC
From analysis of commit ba4df2808a86f8b103c4db0b8807649383e9bd13 I can assume that real issue is somewhere in call_usermodehelper_fns() which handles threads improperly. All other changes are just wrappers and stdio setup.
Comment 4 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-10-14 16:12:41 UTC
Thank you for filing this upstream.

I see you mention "With this patch and 3.11.1 kernel resume works fine." in http://thread.gmane.org/gmane.linux.power-management.general/37043/focus=38863 so I am applying that patch to the 3.11 branch of genpatches as it appears to have not been applied yet (looking at 3.12-rc5).

This patch will be present in 3.11.6.
Comment 5 Andrew Savchenko gentoo-dev 2013-10-14 18:17:15 UTC
In fact patch proposed in LKML works fine on 3.10.x too with some trivial changes needed to apply it.