login
Header Space

 
 

Re: [linux-pm] Fundamental flaw in system suspend, exposed by freezer removal

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Rafael J. Wysocki <rjw@...>
Cc: Linux-pm mailing list <linux-pm@...>, Kernel development list <linux-kernel@...>
Date: Friday, February 29, 2008 - 2:42 pm

On Fri, 29 Feb 2008, Rafael J. Wysocki wrote:


It's the "suspending" case that causes trouble.  Go back and look at 
the race I diagrammed in

https://lists.linux-foundation.org/pipermail/linux-pm/2008-February/016763.html


It _did_ happen.  Precisely this race occurred in Bug #10030 (the SD
card insertion/removal), although there the window was bigger because
we blocked registrations starting from the start of the system sleep
instead of from when the parent's suspend method was called.


It's not that the suspend method itself will want to register children.  
The problem is that the method has to wait for other threads that may 
already have started to register a child.  If those other threads are 
blocked then suspend will deadlock.


This looks pretty awkward.  Won't it cause lockdep to complain about
recursive locking of dev->power.lock?


It buys us one thing: The system will continue to limp along instead of 
locking up.

If drivers don't check whether registration succeeded...  What can I 
say?  It's another bug.


During suspend_late and resume_early _every_ device is suspended, 
including the fictitious "device-tree-root" device.  Hence _every_ 
registration is for a child of a suspended device.

Besides, you don't want to allow new devices to be registered during 
suspend_late, do you?  They wouldn't get suspended before the system 
went to sleep.


Right now that may be the easiest solution.  In fact, it may still be 
the easiest solution even after we stop freezing user threads.


I'm not sure I understand.  Sure, autoresume may not involve calling 
the driver's resume method.  But it does involve actually setting the 
device back to full power, so what's the difference?


Are you still considering adding separate methods for suspend and 
hibernate (maybe also for freeze and prethaw)?  Perhaps the 
"prevent_new_children" and "allow_new_children" methods could be added 
then.  This would allow some of this complication to go away.

Alan Stern

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Fundamental flaw in system suspend, exposed by freezer r..., Benjamin Herrenschmidt, (Wed Feb 27, 4:36 pm)
Re: Fundamental flaw in system suspend, exposed by freezer r..., Rafael J. Wysocki, (Mon Feb 25, 6:24 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Mon Feb 25, 6:25 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Mon Feb 25, 8:07 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Tue Feb 26, 7:17 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Wed Feb 27, 3:50 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Fri Feb 29, 10:26 am)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Fri Feb 29, 1:02 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Alan Stern, (Fri Feb 29, 2:42 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Fri Feb 29, 5:57 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Fri Feb 29, 8:13 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Mon Mar 3, 12:32 pm)
Re: [linux-pm] Fundamental flaw in system suspend, exposed b..., Rafael J. Wysocki, (Thu Feb 28, 8:01 pm)
speck-geostationary