Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756054AbYBXUdS (ORCPT ); Sun, 24 Feb 2008 15:33:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752480AbYBXUdF (ORCPT ); Sun, 24 Feb 2008 15:33:05 -0500 Received: from netrider.rowland.org ([192.131.102.5]:2775 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752594AbYBXUdE (ORCPT ); Sun, 24 Feb 2008 15:33:04 -0500 Date: Sun, 24 Feb 2008 15:33:01 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Pavel Machek cc: "Rafael J. Wysocki" , Pierre Ossman , Zdenek Kabelac , Kernel development list , pm list Subject: Re: [Bug 10030] Suspend doesn't work when SD card is inserted In-Reply-To: <20080224201105.GC18908@elf.ucw.cz> 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: 1309 Lines: 32 On Sun, 24 Feb 2008, Pavel Machek wrote: > > > What locking protects this variable? What happens when suspending_task > > > exits? (Hmm, that would probably be bug, anyway?) > > > > It's protected by whatever existing locking scheme allows only one > > task to start a system sleep at a time. For example, the suspending > > task has to get a write lock on pm_sleep_rwsem. > > And readers of suspending_task are protected by? I added a comment about that too. > At the very least, you'd need rmb() before reading it and wmb() after > writing to it, but I'm not sure if that's enough on every obscure > architecture out there. No, neither one is needed because of the way suspending_task is used. It's not necessary for a reader R to see the variable's actual value; all R needs to know is whether or not suspending_task is equal to R. Since the only process which can set suspending_task to R is R itself, and since R will set suspending_task back to NULL before releasing the write lock on pm_sleep_rwsem, there's never any ambiguity. 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/