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: <CADGdYn6FJFWgx=8PGNwjmxVpsBU=QrvMKpPQMANuBwOHUPmt8w@mail.gmail.com>
Date:	Tue, 16 Apr 2013 12:21:41 +0530
From:	amit daniel kachhap <amit.daniel@...sung.com>
To:	Nishanth Menon <nm@...com>
Cc:	linux-samsung-soc@...r.kernel.org, linux-pm@...r.kernel.org,
	lkml <linux-kernel@...r.kernel.org>, cpufreq@...r.kernel.org,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Kukjin Kim <kgene.kim@...sung.com>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] cpufreq: exynos5440: Protect opp search calls with rcu lock

Hi Nishanth,

Thanks for reviewing this patch.

On Mon, Apr 15, 2013 at 7:40 PM, Nishanth Menon <nm@...com> wrote:
> Daniel,
> On Mon, Apr 15, 2013 at 1:24 AM, Amit Daniel Kachhap
> <amit.daniel@...sung.com> wrote:
>> As per the OPP library documentation(Documentation/power/opp.txt) all
>> opp find/get calls should be protected by rcu locks.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.daniel@...sung.com>
>> ---
>>
>> This patch is created against linux-next tree and is suggested by
>> Nishanth Menon. (https://lkml.org/lkml/2013/4/12/119)
>>
>>  drivers/cpufreq/exynos5440-cpufreq.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c
>> index ead7ed4..0c74018 100644
>> --- a/drivers/cpufreq/exynos5440-cpufreq.c
>> +++ b/drivers/cpufreq/exynos5440-cpufreq.c
>> @@ -120,11 +120,13 @@ static int init_div_table(void)
>>         int i = 0;
>>         struct opp *opp;
>>
>> +       rcu_read_lock();
>>         for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
>>
>>                 opp = opp_find_freq_exact(dvfs_info->dev,
>>                                         freq_tbl[i].frequency * 1000, true);
>>                 if (IS_ERR(opp)) {
>> +                       rcu_read_unlock();
>>                         dev_err(dvfs_info->dev,
>>                                 "failed to find valid OPP for %u KHZ\n",
>>                                 freq_tbl[i].frequency);
>> @@ -159,6 +161,7 @@ static int init_div_table(void)
>>                 __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i);
>>         }
>>
>> +       rcu_read_unlock();
>
> Is it not possible to reduce the amount of code protected by RCU lock?
> something like this:
Yes it is possible but then this part of code is a loop of max 8
iteration so rcu_read_lock will be called those many times.
Also this code blocks are just register writes and not doing any time
consuming operations.

Thanks,
Amit Daniel
> +               rcu_read_lock();
>                 opp = opp_find_freq_exact(dvfs_info->dev,
>                                         freq_tbl[i].frequency * 1000, true);
>                 if (IS_ERR(opp)) {
> +                       rcu_read_unlock();
>                         dev_err(dvfs_info->dev,
>                                 "failed to find valid OPP for %u KHZ\n",
>                                 freq_tbl[i].frequency);
>                         return PTR_ERR(opp);
>                 }
> +               volt_id = opp_get_voltage(opp);
> +               rcu_unlock();
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ