Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759350AbYBYCV7 (ORCPT ); Sun, 24 Feb 2008 21:21:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751825AbYBYCVv (ORCPT ); Sun, 24 Feb 2008 21:21:51 -0500 Received: from netrider.rowland.org ([192.131.102.5]:3369 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751651AbYBYCVu (ORCPT ); Sun, 24 Feb 2008 21:21:50 -0500 Date: Sun, 24 Feb 2008 21:21:50 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: "Rafael J. Wysocki" cc: Pavel Machek , 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: <200802242321.22665.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: 1071 Lines: 28 On Sun, 24 Feb 2008, Rafael J. Wysocki wrote: > > Very subtly wrong ;-). > > > > imagine suspending_task == 0xabcdef01. Now task "R" with current == > > 0xabcd0000 reads suspending_task while the other cpu is writing to it, > > and sees 0xabcd0000 (0xef01 was not yet written) -- and mistakenly > > believes that "R" == suspending_task. > > > > I agree it is very unlikely, and it will not happen on i386. But what > > about just using atomic_t suspending_task, and store current->pid into > > it? > > I'd rather use a lock, frankly. For example, we can require the readers to > take pm_sleep_rwsem for reading in order to access that. That certainly won't work. Imagine what would happen when the reader _was_ the suspending task. But if you really twist my arm, I'll go along with Pavel's suggestion. 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/