Re: 3.11-rc regression bisected: s2disk does not work (was Re: [PATCHv3 13/16] futex: use freezable blocking call)

From: Colin Cross
Date: Mon Jul 22 2013 - 19:56:10 EST


On Mon, Jul 22, 2013 at 4:02 PM, Michael Leun
<lkml20130126@xxxxxxxxxxxxxxx> wrote:
> On Mon, 6 May 2013 16:50:18 -0700
> Colin Cross <ccross@xxxxxxxxxxx> 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: 0001-power-set-PF_NOFREEZE-flag-on-SNAPSHOT_FREEZE-task.patch
Description: Binary data