linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'
@ 2020-08-11 10:17 Lukasz Luba
  2020-08-17 11:54 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Luba @ 2020-08-11 10:17 UTC (permalink / raw)
  To: oss-self-reviewed-patches, linux-kernel, linux-arm-kernel,
	linux-pm, linux-samsung-soc, krzk
  Cc: kgene, b.zolnierkie, lukasz.luba

The 'curr_rate' is protected by local 'dmc->lock' in various places, but
not in a function exynos5_dmc_get_status(). The lock protects frequency
(and voltage) change process and the corresponding value stored in
'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading
also in the exynos5_dmc_get_status().

Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/memory/samsung/exynos5422-dmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index b9c7956e5031..952bc61e68f4 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -908,7 +908,10 @@ static int exynos5_dmc_get_status(struct device *dev,
 	int ret;
 
 	if (dmc->in_irq_mode) {
+		mutex_lock(&dmc->lock);
 		stat->current_frequency = dmc->curr_rate;
+		mutex_unlock(&dmc->lock);
+
 		stat->busy_time = dmc->load;
 		stat->total_time = dmc->total;
 	} else {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'
  2020-08-11 10:17 [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate' Lukasz Luba
@ 2020-08-17 11:54 ` Krzysztof Kozlowski
  2020-08-17 12:28   ` Lukasz Luba
  0 siblings, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-17 11:54 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: oss-self-reviewed-patches, linux-kernel, linux-arm-kernel,
	linux-pm, linux-samsung-soc, kgene, b.zolnierkie

On Tue, Aug 11, 2020 at 11:17:27AM +0100, Lukasz Luba wrote:
> The 'curr_rate' is protected by local 'dmc->lock' in various places, but
> not in a function exynos5_dmc_get_status(). The lock protects frequency
> (and voltage) change process and the corresponding value stored in
> 'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading
> also in the exynos5_dmc_get_status().
> 
> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
> ---
>  drivers/memory/samsung/exynos5422-dmc.c | 3 +++

Thanks, applied.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'
  2020-08-17 11:54 ` Krzysztof Kozlowski
@ 2020-08-17 12:28   ` Lukasz Luba
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2020-08-17 12:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: oss-self-reviewed-patches, linux-kernel, linux-arm-kernel,
	linux-pm, linux-samsung-soc, kgene, b.zolnierkie

Hi Krzysztof,

On 8/17/20 12:54 PM, Krzysztof Kozlowski wrote:
> On Tue, Aug 11, 2020 at 11:17:27AM +0100, Lukasz Luba wrote:
>> The 'curr_rate' is protected by local 'dmc->lock' in various places, but
>> not in a function exynos5_dmc_get_status(). The lock protects frequency
>> (and voltage) change process and the corresponding value stored in
>> 'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading
>> also in the exynos5_dmc_get_status().
>>
>> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
>> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
>> ---
>>   drivers/memory/samsung/exynos5422-dmc.c | 3 +++
> 
> Thanks, applied.
> 

Thank you for applying it.

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'
@ 2020-08-11 10:16 Lukasz Luba
  0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2020-08-11 10:16 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-pm, linux-samsung-soc, krzk
  Cc: kgene, b.zolnierkie, lukasz.luba

The 'curr_rate' is protected by local 'dmc->lock' in various places, but
not in a function exynos5_dmc_get_status(). The lock protects frequency
(and voltage) change process and the corresponding value stored in
'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading
also in the exynos5_dmc_get_status().

Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/memory/samsung/exynos5422-dmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index b9c7956e5031..952bc61e68f4 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -908,7 +908,10 @@ static int exynos5_dmc_get_status(struct device *dev,
 	int ret;
 
 	if (dmc->in_irq_mode) {
+		mutex_lock(&dmc->lock);
 		stat->current_frequency = dmc->curr_rate;
+		mutex_unlock(&dmc->lock);
+
 		stat->busy_time = dmc->load;
 		stat->total_time = dmc->total;
 	} else {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-17 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 10:17 [PATCH] memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate' Lukasz Luba
2020-08-17 11:54 ` Krzysztof Kozlowski
2020-08-17 12:28   ` Lukasz Luba
  -- strict thread matches above, loose matches on Subject: below --
2020-08-11 10:16 Lukasz Luba

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).