Bug 6787 - suspend to ram fails when process is being debugged
Summary: suspend to ram fails when process is being debugged
Status: CLOSED CODE_FIX
Alias: None
Product: Power Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Rafael J. Wysocki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-03 14:49 UTC by Jeremy Fitzhardinge
Modified: 2006-09-08 04:39 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.17-mm6
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
Debug patch (688 bytes, patch)
2006-07-14 14:45 UTC, Rafael J. Wysocki
Details | Diff
Fix candidate (1.32 KB, patch)
2006-07-16 04:20 UTC, Rafael J. Wysocki
Details | Diff
Better fix (2.46 KB, patch)
2006-07-27 00:02 UTC, Rafael J. Wysocki
Details | Diff

Description Jeremy Fitzhardinge 2006-07-03 14:49:44 UTC
Most recent kernel where this bug did not occur: not sure
Distribution:FC6 (devel)
Hardware Environment:Lenovo Thinkpad X60
Software Environment:
Problem Description:
When a process is being debugged (stopped in a breakpoint, for example), suspend
fails.

Steps to reproduce:
Start program under gdb.  Set breakpoint.  Run program until it hits breakpoint.
  Attempt to suspend.
Comment 1 Pavel Machek 2006-07-03 15:44:36 UTC
It would be nice to get rjw@sisk.pl to Cc, but he apparently does not have
bugzilla account (or has it under different name?)
Comment 2 Pavel Machek 2006-07-03 15:49:35 UTC
Okay, I can reproduce it on fairly recent 2.6.17-git.
Comment 3 Rafael J. Wysocki 2006-07-04 02:55:37 UTC
I think the "freeze" signal is catched due to ptrace() before the process
has a chance to go to the refrigerator.  Then the parent is supposed to do
something, but if it's already frozen, it can't.

If that's what really happens, the signal-handling code will need a fix.
Comment 4 Rafael J. Wysocki 2006-07-14 14:45:12 UTC
Created attachment 8555 [details]
Debug patch

More precisely, if the ptraced task has already hit a breakpoint, it is in the
TASK_TRACED state and we can't deliver any signals directly to it until the
parent decides what to do with it.  However, if the parent is frozen, it can't
do anything and the ptraced task becomes unfreezeable.	Thus it seems we should
treat it as such in kernel/power/process.c#freezeable().  If that really is the
case, this patch should help, so please try it.
Comment 5 Rafael J. Wysocki 2006-07-16 04:20:05 UTC
Created attachment 8561 [details]
Fix candidate

This patch should fix the problem (works on my box).

I believe it won't break any other corner cases related to the tracing of
tasks. :-)
Comment 6 Rafael J. Wysocki 2006-07-27 00:02:04 UTC
Created attachment 8625 [details]
Better fix

This patch fixes the problem on my box.

Note You need to log in before you can comment on or make changes to this bug.