Skip to contentSkip to conversation

OMAP2 PM: do RCU locking for opp_get_voltage()

PATCH In review Arnout Vandecappelle (Essensium/Mind) 2 participants 2 messages Feb 13, 2012 – Feb 14, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP2 PM: do RCU locking for opp_get_voltage()

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

According to the documentation of opp_get_voltage(), it must be called with rcu_read_lock() held. The OMAP2 power manager doesn't do this. The locking error is caught by PROVE_RCU.

---
Please CC me, I'm not on the list.

I was very surprised by this error, because this is the only user of opp_get_voltage().

Regards,
Arnout

---
 arch/arm/mach-omap2/pm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.c +3 -0
index 00bff46..bce2bdc 100644
@@ -174,14 +174,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
 	freq = clk->rate;
 	clk_put(clk);
 
+	rcu_read_lock();
 	opp = opp_find_freq_ceil(dev, &freq);
 	if (IS_ERR(opp)) {
 		pr_err("%s: unable to find boot up OPP for vdd_%s\n",
 			__func__, vdd_name);
+		rcu_read_unlock();
 		goto exit;
 	}
 
 	bootup_volt = opp_get_voltage(opp);
+	rcu_read_unlock();
 	if (!bootup_volt) {
 		pr_err("%s: unable to find voltage corresponding "
 			"to the bootup OPP for vdd_%s\n", __func__, vdd_name);
Signature · 1 line
1.7.8.3
#1 lore raw
Quoted 7 lines · Arnout Vandecappelle (Essensium/Mind)

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>

According to the documentation of opp_get_voltage(), it must be called with rcu_read_lock() held. The OMAP2 power manager doesn't do this. The locking error is caught by PROVE_RCU.

Thanks for the patch, I've got a patch from Neil Brown queued for this already:

       http://marc.info/?l=linux-omap&m=132608991812586&w=2

Kevin

Quoted 34 lines

---
Please CC me, I'm not on the list.

I was very surprised by this error, because this is the only user of opp_get_voltage().

Regards,
Arnout

---
 arch/arm/mach-omap2/pm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.c +3 -0
index 00bff46..bce2bdc 100644
@@ -174,14 +174,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
 	freq = clk->rate;
 	clk_put(clk);
 
+	rcu_read_lock();
 	opp = opp_find_freq_ceil(dev, &freq);
 	if (IS_ERR(opp)) {
 		pr_err("%s: unable to find boot up OPP for vdd_%s\n",
 			__func__, vdd_name);
+		rcu_read_unlock();
 		goto exit;
 	}
 
 	bootup_volt = opp_get_voltage(opp);
+	rcu_read_unlock();
 	if (!bootup_volt) {
 		pr_err("%s: unable to find voltage corresponding "
 			"to the bootup OPP for vdd_%s\n", __func__, vdd_name);