linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: "linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	Kukjin Kim <kgene@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Subject: Re: [RFC] memory: exynos5422-dmc: Document mutex scope
Date: Tue, 11 Aug 2020 10:27:31 +0100	[thread overview]
Message-ID: <6db3a6a4-fe56-d448-14c7-ed43de809acb@arm.com> (raw)
In-Reply-To: <CAJKOXPe3OeKFhmtbF4OZup_ii_rxRHTaSK5BT-3T6ijqUukqtg@mail.gmail.com>



On 8/9/20 10:12 AM, Krzysztof Kozlowski wrote:
> On Tue, Aug 04, 2020 at 11:40:07AM +0100, Lukasz Luba wrote:
>> Hi Krzysztof,
>>
>> On 7/24/20 7:08 PM, Krzysztof Kozlowski wrote:
>>> Document scope of the mutex used by driver.
>>>
>>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>>>
>>> ---
>>>
>>> It seems mutex was introduced to protect:
>>> 1. setting actual frequency/voltage,
>>> 2. dmc->curr_rate (in exynos5_dmc_get_cur_freq()).
>>>
>>> However dmc->curr_rate in exynos5_dmc_get_status() is not protected. Is
>>> it a bug?
>>
>> The callback get_dev_status() from devfreq->profile, which here is the
>> exynos5_dmc_get_status() should be already called with devfreq->lock
>> mutex hold, like e.g from simple_ondemand governor or directly
>> using update_devfreq exported function:
>> update_devfreq()
>>    ->get_target_freq()
>>      devfreq_update_stats()
>>          df->profile->get_dev_status()
>>
>> The dmc->curr_rate is also used from sysfs interface from devfreq.
>> The local dmc lock serializes also this use case (when the HW freq
>> has changed but not set yet into curr_rate.
> 
> These are different locks. You cannot protect dmc->curr_rate with
> devfreq->lock in one place and dmc-lock in other place. This won't
> protect it.

There are different paths that framework goes and mainly they are
protected by the df->lock.
But I tend to agree, I will send a patch which adds some locking.

Regards,
Lukasz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2020-08-11  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 18:08 [RFC] memory: exynos5422-dmc: Document mutex scope Krzysztof Kozlowski
2020-08-04 10:40 ` Lukasz Luba
2020-08-09  9:12   ` Krzysztof Kozlowski
2020-08-11  9:27     ` Lukasz Luba [this message]

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=6db3a6a4-fe56-d448-14c7-ed43de809acb@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.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).