From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [PATCH 1/3] PM: Introduce new top level suspend and hibernation callbacks (rev. 8) Date: Tue, 15 Apr 2008 06:48:50 +1000 Message-ID: <1208206130.6958.178.camel@pasglop> References: Reply-To: benh@kernel.crashing.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: Alan Stern Cc: Nigel Cunningham , LKML , Jesse Barnes , ACPI Devel Maling List , pm list , Alexey Starikovskiy , Andrew Morton List-Id: linux-acpi@vger.kernel.org On Mon, 2008-04-14 at 11:13 -0400, Alan Stern wrote: > On Mon, 14 Apr 2008, Rafael J. Wysocki wrote: > > > "you can assume that the user space is there while ->prepare() is running, > > but you are supposed to prevent new children of the device from being > > registered from that point on _and_ you have to make sure that freezable > > tasks will be able to freeze after ->prepare() has run" (but why on Earth a > > driver writer is now required to know what's a freezable task etc.?) > > This reminds me... We're going to need a way to make certain > activities mutually exclusive with system sleep. The simplest example > is loading a kernel module; init and probe routines often end up > causing new child devices to be registered. > > The most straightforward approach is to use an rwsem like the one we > used to have. However I'm concerned that under some circumstances > there might be recursive read-locking. (For example, the init routine > in a newly-loaded module decides to load yet another module. Can this > actually happen? libusual does something much like it.) > > So it's quite possible we'll end up needing a mechanism that resembles > an rwsem but allows recursive (properly nested) read-locking. Does > such a thing exist already, or would it have to be invented? Despite what Oliver says, that's a perfect example where the module load syscalls should return an error. Maybe something like -EAGAIN would do tho... that might need a minor update of the module init tools so they retry instead of failing. Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758032AbYDNUze (ORCPT ); Mon, 14 Apr 2008 16:55:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753591AbYDNUzH (ORCPT ); Mon, 14 Apr 2008 16:55:07 -0400 Received: from gate.crashing.org ([63.228.1.57]:42144 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761309AbYDNUzB (ORCPT ); Mon, 14 Apr 2008 16:55:01 -0400 Subject: Re: [PATCH 1/3] PM: Introduce new top level suspend and hibernation callbacks (rev. 8) From: Benjamin Herrenschmidt Reply-To: benh@kernel.crashing.org To: Alan Stern Cc: "Rafael J. Wysocki" , Greg KH , pm list , ACPI Devel Maling List , Len Brown , LKML , Alexey Starikovskiy , David Brownell , Pavel Machek , Oliver Neukum , Nigel Cunningham , Jesse Barnes , Andrew Morton In-Reply-To: References: Content-Type: text/plain Date: Tue, 15 Apr 2008 06:48:50 +1000 Message-Id: <1208206130.6958.178.camel@pasglop> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2008-04-14 at 11:13 -0400, Alan Stern wrote: > On Mon, 14 Apr 2008, Rafael J. Wysocki wrote: > > > "you can assume that the user space is there while ->prepare() is running, > > but you are supposed to prevent new children of the device from being > > registered from that point on _and_ you have to make sure that freezable > > tasks will be able to freeze after ->prepare() has run" (but why on Earth a > > driver writer is now required to know what's a freezable task etc.?) > > This reminds me... We're going to need a way to make certain > activities mutually exclusive with system sleep. The simplest example > is loading a kernel module; init and probe routines often end up > causing new child devices to be registered. > > The most straightforward approach is to use an rwsem like the one we > used to have. However I'm concerned that under some circumstances > there might be recursive read-locking. (For example, the init routine > in a newly-loaded module decides to load yet another module. Can this > actually happen? libusual does something much like it.) > > So it's quite possible we'll end up needing a mechanism that resembles > an rwsem but allows recursive (properly nested) read-locking. Does > such a thing exist already, or would it have to be invented? Despite what Oliver says, that's a perfect example where the module load syscalls should return an error. Maybe something like -EAGAIN would do tho... that might need a minor update of the module init tools so they retry instead of failing. Ben.