Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbdITRIC (ORCPT ); Wed, 20 Sep 2017 13:08:02 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:51423 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbdITRH6 (ORCPT ); Wed, 20 Sep 2017 13:07:58 -0400 X-Google-Smtp-Source: AOwi7QDJp5JgRDDiOkXYdZ09N0pLLeHrX/2PSevGXlY0/rSw2MEupP4aQmpdDgK9qS4URh7uyYlqkA== Date: Wed, 20 Sep 2017 10:07:55 -0700 From: Viresh Kumar To: Stephen Boyd Cc: Rafael Wysocki , cw00.choi@samsung.com, Viresh Kumar , Nishanth Menon , linux-pm@vger.kernel.org, Vincent Guittot , myungjoo.ham@samsung.com, inki.dae@samsung.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PM / OPP: Call notifier without holding opp_table->lock Message-ID: <20170920170755.GA3001@ubuntu> References: <59C2414E.6020803@samsung.com> <45c7e892a69c4936993c65c9987981dbe4433148.1505920911.git.viresh.kumar@linaro.org> <20170920170000.GA457@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170920170000.GA457@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1041 Lines: 32 On 20-09-17, 10:00, Stephen Boyd wrote: > On 09/20, Viresh Kumar wrote: > > diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c > > index 4360b4efcd4c..668fd940d362 100644 > > --- a/drivers/base/power/opp/core.c > > +++ b/drivers/base/power/opp/core.c > > @@ -1627,6 +1627,9 @@ static int _opp_set_availability(struct device *dev, unsigned long freq, > > > > opp->available = availability_req; > > > > + dev_pm_opp_get(opp); > > + mutex_unlock(&opp_table->lock); > > Does this prevent the OPP from changing while the lock is > released? No, its just ref counting and will only prevent it from getting freed. There is only one thing that can change for an OPP though after it is created, its availability. > That would be the only difference from before. It's > possible that nobody cares about this situation though. I am not sure if its worth caring for right now :) Also the notifier chain will not start again until the previous call chain is finished. So we are kind of synchronized here. -- viresh