Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812Ab0KDT55 (ORCPT ); Thu, 4 Nov 2010 15:57:57 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:52355 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752038Ab0KDT5y (ORCPT ); Thu, 4 Nov 2010 15:57:54 -0400 From: "Rafael J. Wysocki" To: Linus Torvalds Subject: Re: [linux-pm] [GIT PULL] One more power management fix for 2.6.37 Date: Thu, 4 Nov 2010 20:55:31 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.35-rjw+; KDE/4.4.4; x86_64; ; ) Cc: Dominik Brodowski , Alan Stern , "Linux-pm mailing list" , LKML References: <201010292358.27975.rjw@sisk.pl> <201011041424.44215.rjw@sisk.pl> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011042055.31779.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1468 Lines: 35 On Thursday, November 04, 2010, Linus Torvalds wrote: > On Thu, Nov 4, 2010 at 9:24 AM, Rafael J. Wysocki wrote: > > > > OK, so I think we can relax the locking in dpm_[suspend/resume]_noirq() to > > avoid executing callbacks under dpm_list_mtx, like in the (untested) patch > > below. > > ABSOLUTELY NOT. > > If you drop the lock in the middle of the loop, you should remove the > lock around the loop entirely. There is absolutely no difference > between "drop lock in the middle" and "don't take lock at all". > > Either that list traversal needs the lock or it does not. There is no > "it needs the lock, but not while doing random crap X in the middle of > traversal". Your're right, it only makes sense to either leave it or remove it entirely. > If nothing can possibly change the list while calling the device, then > you don't need the lock. And if something _can_ change the list, > dropping the lock means that the list is no longer trustworthy and you > can't just continue in the middle. At this point, if everyone does everything right, there should be nothing running in parallel with us that will attempt to modify the list. So, I'd say let's drop the lock completely. Thanks, Rafael -- 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/