linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Cc: "Artur Świgoń" <a.swigon@partner.samsung.com>,
	"Saravana Kannan" <saravanak@google.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Alexandre Bailon" <abailon@baylibre.com>,
	"Georgi Djakov" <georgi.djakov@linaro.org>,
	"Jacky Bai" <ping.bai@nxp.com>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"cpgs (cpgs@samsung.com)" <cpgs@samsung.com>
Subject: Re: [PATCH v3 1/2] PM / devfreq: Add dev_pm_qos support
Date: Wed, 21 Aug 2019 13:00:55 +0000	[thread overview]
Message-ID: <VI1PR04MB7023E05C5683C4392CEA5915EEAA0@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 6134bb9e-9a16-b432-c191-c91f93844319@samsung.com

On 21.08.2019 04:40, Chanwoo Choi wrote:

> On 19. 8. 21. 오전 12:24, Leonard Crestez wrote:
>> Add dev_pm_qos notifies to devfreq core in order to support frequency
>> limits via the dev_pm_qos_add_request.
>>
>> +static unsigned long get_effective_min_freq(struct devfreq *devfreq)
> 
> I'm not sure that 'effective' expression is correct.
>  From this function, the devfreq can get the final target frequency.
> 
> I think that we need to use the more correct expression
> to give the meaning of function as following:
> 
> get_min_freq
> get_max_freq

OK, will rename to get_min_freq and get_max_freq

>> @@ -636,21 +688,40 @@ struct devfreq *devfreq_add_device(struct device *dev,
>>   		err = -ENOMEM;
>>   		goto err_out;
>>   	}
>>   
>>   	mutex_init(&devfreq->lock);
>> -	mutex_lock(&devfreq->lock);
> 
> Basically, I think that it is safe to lock when touch
> the variable of the devfreq.
> 
> it is not proper way for the dev_pm_qos because
> it breaks the existing locking reason of devfreq's variables.

I don't understand what you mean. I'm initializing some stuff outside 
the lock to avoid circular lock warning between:

(&devfreq->lock){+.+.}, at: devfreq_qos_min_notifier_call+0x24/0x48
(&(n)->rwsem){++++}, at: blocking_notifier_call_chain+0x3c/0x78

In general you don't need to lock an object while initializing except 
after it becomes accessible from the outside so devfreq_add_device 
doesn't need to take the lock so early.

The QOS notifiers are registered on the parent device so in theory it's 
possible for somebody to add QOS requests while devfreq_add_device is 
executing. Maybe notifier registration should be moved at the end after 
unlock?

--
Regards,
Leonard

  reply	other threads:[~2019-08-21 13:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20 15:23 [PATCH v3 0/2] PM / devfreq: Add dev_pm_qos support Leonard Crestez
2019-08-20 15:24 ` [PATCH v3 1/2] " Leonard Crestez
2019-08-21  1:44   ` Chanwoo Choi
2019-08-21 13:00     ` Leonard Crestez [this message]
2019-08-22 10:14       ` Chanwoo Choi
2019-08-20 15:24 ` [PATCH v3 2/2] PM / devfreq: Use dev_pm_qos for sysfs min/max_freq Leonard Crestez
2019-08-21  2:04   ` Chanwoo Choi
2019-08-21 13:03     ` Leonard Crestez
2019-08-22 10:07       ` Chanwoo Choi
2019-08-22 10:58         ` Leonard Crestez
2019-08-22 11:10           ` Chanwoo Choi
2019-08-22 12:24             ` Leonard Crestez
2019-08-23  8:40               ` Chanwoo Choi
2019-08-23 11:47                 ` Leonard Crestez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR04MB7023E05C5683C4392CEA5915EEAA0@VI1PR04MB7023.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=a.swigon@partner.samsung.com \
    --cc=abailon@baylibre.com \
    --cc=cpgs@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=georgi.djakov@linaro.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=ping.bai@nxp.com \
    --cc=saravanak@google.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).