Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Link: https://lore.kernel.org/r/20200118042433.4968-1-frextrite@gmail.com
Signed-off-by: Amol Grover <frextrite@gmail.com>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Olof Johansson <olof@lixom.net>

authored by

Amol Grover and committed by
Olof Johansson
feec214a 2ced5a34

+5 -2
+5 -2
drivers/soc/ti/knav_qmss_queue.c
··· 25 25 26 26 static struct knav_device *kdev; 27 27 static DEFINE_MUTEX(knav_dev_lock); 28 + #define knav_dev_lock_held() \ 29 + lockdep_is_held(&knav_dev_lock) 28 30 29 31 /* Queue manager register indices in DTS */ 30 32 #define KNAV_QUEUE_PEEK_REG_INDEX 0 ··· 54 52 #define knav_queue_idx_to_inst(kdev, idx) \ 55 53 (kdev->instances + (idx << kdev->inst_shift)) 56 54 57 - #define for_each_handle_rcu(qh, inst) \ 58 - list_for_each_entry_rcu(qh, &inst->handles, list) 55 + #define for_each_handle_rcu(qh, inst) \ 56 + list_for_each_entry_rcu(qh, &inst->handles, list, \ 57 + knav_dev_lock_held()) 59 58 60 59 #define for_each_instance(idx, inst, kdev) \ 61 60 for (idx = 0, inst = kdev->instances; \