Skip to contentSkip to conversation

drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists

PATCH Superseded Amol Grover 3 participants 4 messages Jan 17, 2020 – Jan 18, 2020 TI Keystone multicore navigator drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists

inst->handles is traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of knav_dev_lock.

Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists.

Add macro for the corresponding lockdep expression.

---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is implicitly checked for.

 drivers/soc/ti/knav_qmss_queue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/ti/knav_qmss_queue.c +5 -2
index 1ccc9064e1eb..37f3db6c041c 100644
@@ -25,6 +25,8 @@
 
 static struct knav_device *kdev;
 static DEFINE_MUTEX(knav_dev_lock);
+#define knav_dev_lock_held() \
+	lockdep_is_held(&knav_dev_lock)
 
 /* Queue manager register indices in DTS */
 #define KNAV_QUEUE_PEEK_REG_INDEX	0
@@ -52,8 +54,9 @@ static DEFINE_MUTEX(knav_dev_lock);
 #define knav_queue_idx_to_inst(kdev, idx)			\
 	(kdev->instances + (idx << kdev->inst_shift))
 
-#define for_each_handle_rcu(qh, inst)			\
-	list_for_each_entry_rcu(qh, &inst->handles, list)
+#define for_each_handle_rcu(qh, inst)				\
+	list_for_each_entry_rcu(qh, &inst->handles, list,	\
+				knav_dev_lock_held())
 
 #define for_each_instance(idx, inst, kdev)		\
 	for (idx = 0, inst = kdev->instances;		\
Signature · 1 line
2.24.1
#1 lore raw
Quoted 7 lines · Amol Grover

inst->handles is traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of knav_dev_lock.

Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists.

Quoted 8 lines

Add macro for the corresponding lockdep expression.

---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is implicitly checked for.

Looks fine to me.

Hi Olof, Arnd,
Can you please pick this one and apply to your driver-soc branch ? I already sent out pull request and hence the request.

regards,
Santosh

#2 lore raw
Quoted 16 lines · On Fri, Jan 17, 2020 at 10:24:04AM -0800, [email protected] wrote:
Quoted 7 lines · Amol Grover

inst->handles is traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of knav_dev_lock.

Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists.

Quoted 8 lines

Add macro for the corresponding lockdep expression.

---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is implicitly checked for.

Quoted 5 lines

Looks fine to me.

Hi Olof, Arnd,
Can you please pick this one and apply to your driver-soc branch ? I already sent out pull request and hence the request.

Hi,

Can you please email the whole patch with sign-off to [email protected]? Otherwise it won't end up in patchwork, which is how we track patches and pull requests these days.

Thanks,

-Olof

#3 lore raw
Quoted 23 lines · Olof Johansson
Quoted 16 lines · On Fri, Jan 17, 2020 at 10:24:04AM -0800, [email protected] wrote:
Quoted 7 lines · Amol Grover

inst->handles is traversed using list_for_each_entry_rcu outside an RCU read-side critical section but under the protection of knav_dev_lock.

Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists.

Quoted 8 lines

Add macro for the corresponding lockdep expression.

---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is implicitly checked for.

Quoted 5 lines

Looks fine to me.

Hi Olof, Arnd,
Can you please pick this one and apply to your driver-soc branch ? I already sent out pull request and hence the request.

Quoted 6 lines

Hi,

Can you please email the whole patch with sign-off to [email protected]? Otherwise it won't end up in patchwork, which is how we track patches and pull requests these days.

Thank you Santosh and Olof. I'm resending the patch to [email protected] as well.

Thanks
Amol

Quoted 4 lines

Thanks,

-Olof