Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755403AbYAFEEs (ORCPT ); Sat, 5 Jan 2008 23:04:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753107AbYAFEEg (ORCPT ); Sat, 5 Jan 2008 23:04:36 -0500 Received: from netrider.rowland.org ([192.131.102.5]:2614 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752864AbYAFEEg (ORCPT ); Sat, 5 Jan 2008 23:04:36 -0500 Date: Sat, 5 Jan 2008 23:04:33 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: "Rafael J. Wysocki" cc: Greg KH , Andrew Morton , Len Brown , Ingo Molnar , ACPI Devel Maling List , LKML , pm list Subject: Re: [PATCH] PM: Acquire device locks on suspend In-Reply-To: <200801052258.52272.rjw@sisk.pl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1783 Lines: 45 On Sat, 5 Jan 2008, Rafael J. Wysocki wrote: > On Saturday, 5 of January 2008, Alan Stern wrote: > > On Sat, 5 Jan 2008, Rafael J. Wysocki wrote: > > > Still, even doing that is not enough, since someone can call > > > destroy_suspended_device() from a .suspend() routine and then the device > > > will end up on a wrong list just as well. > > > > That should never happen. The whole idea of destroy_suspended_device() > > is that the device couldn't be resumed and in fact should be > > unregistered because it is no longer working or no longer present. A > > suspend routine won't detect this sort of thing since it doesn't try to > > resume the device. > > > > But it wouldn't hurt to mention in the kerneldoc that > > destroy_suspended_device() is meant to be called only during a system > > resume. > > Hmm. Please have a look at the appended patch. > > I have removed the warning from device_del() and used list_empty() to detect > removed devices in the .suspend() routines. Is that viable? It's not good. The warning in device_del() is vital. It's what will tell people where the problem is when a deadlock occurs during system resume because some driver has mistakenly tried to unregister a device at the wrong time. It would have pointed immediately to the msr driver in the case of the bug Andrew found, for instance. If you can figure out a way to disable the warning in device_del() for just the one device being unregistered by device_pm_destroy_suspended(), I suppose that would be okay. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/