lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3522860a-8158-6e71-9d65-01d0e0c15f0d@arm.com>
Date:   Tue, 4 Aug 2020 11:40:07 +0100
From:   Lukasz Luba <lukasz.luba@....com>
To:     Krzysztof Kozlowski <krzk@...nel.org>,
        Kukjin Kim <kgene@...nel.org>, linux-pm@...r.kernel.org,
        linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC] memory: exynos5422-dmc: Document mutex scope

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@...nel.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.


> ---
>   drivers/memory/samsung/exynos5422-dmc.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
> index 93e9c2429c0d..0388066a7d96 100644
> --- a/drivers/memory/samsung/exynos5422-dmc.c
> +++ b/drivers/memory/samsung/exynos5422-dmc.c
> @@ -114,6 +114,7 @@ struct exynos5_dmc {
>   	void __iomem *base_drexi0;
>   	void __iomem *base_drexi1;
>   	struct regmap *clk_regmap;
> +	/* Protects curr_rate and frequency/voltage setting section */
>   	struct mutex lock;
>   	unsigned long curr_rate;
>   	unsigned long curr_volt;
> 

I assume this missing comment for the lock was required by some scripts.
In this case LGTM:

Reviewed-by: Lukasz Luba <lukasz.luba@....com>

Regards,
Lukasz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ