From: Alan Jenkins <sourcejedi.lkml-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
To: Mel Gorman <mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
Cc: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
pm list
<linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Kernel Testers List
<kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] uswsusp: automatically free the in-memory image once s2disk has finished with it
Date: Tue, 8 Dec 2009 00:37:36 +0000 [thread overview]
Message-ID: <9b2b86520912071637v6957ed24ie0f67acf6785ab08@mail.gmail.com> (raw)
In-Reply-To: <20091203145018.GG26702-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
On 12/3/09, Mel Gorman <mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org> wrote:
> On Thu, Dec 03, 2009 at 12:57:28PM +0000, Alan Jenkins wrote:
>> Pavel Machek wrote:
>>> On Wed 2009-12-02 22:25:16, Mel Gorman wrote:
>>>
>>>> On Wed, Dec 02, 2009 at 11:15:24PM +0100, Pavel Machek wrote:
>>>>
>>>>> On Wed 2009-12-02 22:07:18, Mel Gorman wrote:
>>>>>
>>>>>> On Wed, Dec 02, 2009 at 10:11:07PM +0100, Pavel Machek wrote:
>>>>>>
>>>>>>> On Wed 2009-12-02 14:28:12, Alan Jenkins wrote:
>>>>>>>
>>>>>>>> The original in-kernel suspend (swsusp) frees the in-memory
>>>>>>>> hibernation
>>>>>>>> image before powering off the machine. s2disk doesn't, so there is
>>>>>>>> _much_ less free memory when it tries to power off.
>>>>>>>>
>>>>>>>> This is a gratuitous difference. The userspace suspend interface
>>>>>>>> /dev/snapshot only allows the hibernation image to be read once.
>>>>>>>> Once the s2disk program has read the last page, we can free the
>>>>>>>> entire
>>>>>>>> image.
>>>>>>>>
>>>>>>>> This avoids a hang after writing the hibernation image which was
>>>>>>>> triggered by commit 5f8dcc21211a3d4e3a7a5ca366b469fb88117f61
>>>>>>>> "page-allocator: split per-cpu list into one-list-per-migrate-type":
>>>>>>>>
>>>>>>> Yes, you work around page-allocator hang. But is it right thing to
>>>>>>> do?
>> Here's a new datum:
>>
>> Applying this patch has left a less frequent hang. So far it has
>> happened twice. (Once playing last night, and once today testing
>> hibernation with KMS enabled).
>>
>> This hang happens at a different point. It happens _before_ writing out
>> the hibernation image. That is, I don't see the textual progress bar,
>> and if I force a power-cycle then it doesn't resume (and complains about
>> uncleanly unmounted filesystems).
>>
>> Here is the backtrace:
>>
>> [top of screen]
>> s2disk D c1c05580 0 5988 5809 0x00000000
>> ...
>> Call Trace:
>> ...
>> ? wait_for_common
>> ? default_wake_function
>> ? kthread_create
>> ? worker_thread
>> ? create_workqueue_thread
>> ? worker_thread
>> ? __create_workqueue_thread
>> ? stop_machine_create
>> ? disable_nonboot_cpus
>> ? hibernation_snapshot
>> ? snapshot_ioctl
>> ...
>> ? sys_ioctl
>>
> Can you reconfirm that backing out both of those patches makes this 100%
> reliable or is it just a lot harder to trigger. It does not even appear
> that it's locked up within the page allocator at this trace message.
> Assuming c1c05580 is where it's stuck at, where does addr2line say that
> is (requires CONFIG_DEBUG_INFO) ?
The new hang happened with only one patch applied (my "uswsusp:
automatically free the in-memory image once s2disk has finished with
it").
I was able to capture a longer version of the above backtrace by using
KMS [1]. This pre-writeout hang is similar to the post-writeout hang
which occurred on vanilla 2-6.32-rc8 [2]. In both cases the s2disk
process is hanging in disable_nonboot_cpus(). [Which is in turn
blocked on stop_machine_create(), which is apparently failing to
allocate pages for a new task]. The only difference is where
disable_nonboot_cpus() is called from.
And then, the problem went away :-(. I was unable to reproduce either
hang, even using the same unpatched kernel binaries as before. Sorry.
[1] Infrequent pre-writeout hang (new, longer backtrace):
<http://picasaweb.google.com/Alan.Christopher.Jenkins/Screenshots#5412613393538769410>
[2] Frequent post-writeout hang:
<http://picasaweb.google.com/Alan.Christopher.Jenkins/Screenshots#5410594126006567282>
> On Thu, Dec 03, 2009 at 12:57:28PM +0000, Alan Jenkins wrote:
>> It looks like hibernation_snapshot() calls disable_nonboot_cpus()
>> _before_ we allocate the hibernation image. (I.e. before
>> swsusp_arch_suspend(), which calls swsusp_save()).
>>
Sorry, I was wrong here. The hang occurs after "PM: Preallocating
image memory...". So it's a bit less mysterious; we can expect to be
low on memory at this point (although it's still a mystery why we
should run out completely).
> I'm not that familiar with the area but considering where we are getting
> stuck and what the path affected, I thought it might be CPU related.
> There is a patch below that prints debugging messages to show how the
> CPU is being taken down with respect to PCP draining in case something
> has changed there. It also puts in some debugging code in the most
> likely place to be infinite looping due to the patch.
>
>> So I think Pavel's right, we still need to work out what's happening here.
>>
>
> Can you apply the following patch please and retry?
>
> Two things to watch out for. First, do either of the BUG_ON triggers?
> Second, for the TRACE messages, do they always appear in the order of
> "draining pages" and then "deleting pagesets"?
I went ahead and tried this, even though I couldn't reproduce the hang anymore.
It didn't BUG. It didn't show any TRACEs either. I guess the cpu
notifiers weren't called at all, since no cpu hotplug is necessary on
my uni-core system.
So...
It looks like I can't provide any more data.
I can confidently say that post-writeout hangs would be avoided by my
patch. But I don't think we want to apply it, because it didn't
solve the pre-writeout hang - which appears to have a similar root
cause. The post-writeout hang happened to be easier to reproduce, and
it was better in that it didn't cause data loss / fsck (the system
could still resume).
As a curious tester, I would favour not increasing PAGES_FOR_IO on
similar grounds. Call me naive but 4Mb should be plenty, at least for
this system. That said, I wouldn't mind if we reserve an extra 4Mb to
avoid the hang, _and then abort the hibernation if we actually have to
use it_. (We can't simply print a warning message; no-one would see
it because it wouldn't survive the power-down).
Thanks
Alan
next prev parent reply other threads:[~2009-12-08 0:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-01 19:59 Bisected: s2disk (uswsusp only) hangs just before poweroff Alan Jenkins
[not found] ` <4B1575AC.6080904-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
2009-12-01 20:24 ` Justin P. Mattock
[not found] ` <4B157B81.9050703-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-01 20:27 ` Alan Jenkins
2009-12-01 21:14 ` Justin P. Mattock
2009-12-01 21:45 ` Mel Gorman
2009-12-01 21:53 ` Rafael J. Wysocki
[not found] ` <200912012253.08522.rjw-KKrjLPT3xs0@public.gmane.org>
2009-12-02 11:49 ` Alan Jenkins
[not found] ` <4B16545B.3090703-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
2009-12-02 12:20 ` Mel Gorman
2009-12-02 14:25 ` Alan Jenkins
[not found] ` <20091202122019.GD1457-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-02 14:28 ` [PATCH] uswsusp: automatically free the in-memory image once s2disk has finished with it Alan Jenkins
[not found] ` <4B16797C.3010304-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
2009-12-02 21:11 ` Pavel Machek
[not found] ` <20091202211107.GA20830-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2009-12-02 22:07 ` Mel Gorman
2009-12-02 22:15 ` Pavel Machek
[not found] ` <20091202221524.GB20830-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2009-12-02 22:25 ` Mel Gorman
[not found] ` <20091202222516.GD26702-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-02 23:22 ` Rafael J. Wysocki
2009-12-03 7:53 ` Pavel Machek
2009-12-03 12:57 ` Alan Jenkins
[not found] ` <4B17B5B8.1060105-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
2009-12-03 14:50 ` Mel Gorman
[not found] ` <20091203145018.GG26702-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-08 0:37 ` Alan Jenkins [this message]
[not found] ` <9b2b86520912071637v6957ed24ie0f67acf6785ab08-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-11 10:53 ` Mel Gorman
[not found] ` <20091211105352.GB30670-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-14 11:08 ` Pavel Machek
2009-12-03 20:16 ` Pavel Machek
2009-12-03 19:50 ` Rafael J. Wysocki
2009-12-02 21:47 ` Rafael J. Wysocki
[not found] ` <20091201214529.GA1457-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-02 8:57 ` Bisected: s2disk (uswsusp only) hangs just before poweroff Alan Jenkins
[not found] ` <4B162BE1.7070709-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
2009-12-02 10:35 ` Mel Gorman
[not found] ` <20091202103538.GB1457-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
2009-12-02 11:35 ` Alan Jenkins
2009-12-02 11:11 ` Alan Jenkins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b2b86520912071637v6957ed24ie0f67acf6785ab08@mail.gmail.com \
--to=sourcejedi.lkml-gm/ye1e23mwn+bqq9rbeug@public.gmane.org \
--cc=kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org \
--cc=pavel-+ZI9xUNit7I@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).