From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753357Ab2AWQtP (ORCPT ); Mon, 23 Jan 2012 11:49:15 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:56807 "EHLO e38.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751332Ab2AWQtN (ORCPT ); Mon, 23 Jan 2012 11:49:13 -0500 Date: Mon, 23 Jan 2012 08:45:11 -0800 From: "Paul E. McKenney" To: "Rafael J. Wysocki" Cc: Simon Glass , Alan Cox , LKML , Greg Kroah-Hartman , linux-serial@vger.kernel.org Subject: Re: [PATCH 3/3] serial: 8250: Add a wakeup_capable module param Message-ID: <20120123164511.GE2434@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1326826563-32215-1-git-send-email-sjg@chromium.org> <201201200103.34296.rjw@sisk.pl> <20120120061214.GA2551@linux.vnet.ibm.com> <201201210049.35254.rjw@sisk.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201210049.35254.rjw@sisk.pl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12012316-5518-0000-0000-000001BC7015 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 21, 2012 at 12:49:35AM +0100, Rafael J. Wysocki wrote: > On Friday, January 20, 2012, Paul E. McKenney wrote: > > On Fri, Jan 20, 2012 at 01:03:34AM +0100, Rafael J. Wysocki wrote: > > > On Thursday, January 19, 2012, Paul E. McKenney wrote: > > > > On Thu, Jan 19, 2012 at 01:02:58AM +0100, Rafael J. Wysocki wrote: > > > > > On Wednesday, January 18, 2012, Paul E. McKenney wrote: > > > > > > On Wed, Jan 18, 2012 at 02:15:59PM -0800, Simon Glass wrote: > > > [...] > > > > > Yes, you can, but then I'd say it's not necessary for user space to > > > > > be able to carry that out in a tight loop. So, it seems, alternatively, > > > > > we could make that loop a bit less tight, e.g. by adding an arbitrary > > > > > sleep to the user space interface for the "disable" case. > > > > > > > > Good point, that would work just as well and be simpler. > > > > > > Thanks for the confirmation! :-) > > > > > > By the way, I wonder, would it help to add synchronize_rcu() to > > > wakeup_source_add() too? Then, even if device_wakeup_enable() and > > > device_wakeup_disable() are executed in a tight loop for the same > > > device, the list_add/list_del operations will always happen in > > > different RCU cycles (or at least it seems so). > > > > I cannot immediately see how adding a synchronize_rcu() to > > wakeup_source_add() would help anything. You only need to wait for a > > grace period on removal, not (normally) on addition. The single grace > > period during removal will catch up all other asynchronous RCU grace > > period requests on that CPU. > > > > Or am I missing your point? > > Well, I was thinking about the failure scenario you mentioned where > executing enable/disable in a tight loop might exhaust system memory > (if I understood it correctly). Ah, got it. If they are executing this in a tight loop, there will be little difference between doing one synchronize_rcu() per pass through the loop or doing two. So we should be just fine with the single instance of synchronize_rcu() per loop. Thanx, Paul