Skip to content

Commit 02d715b

Browse files
frextritejoergroedel
authored andcommitted
iommu/vt-d: Fix RCU list debugging warnings
dmar_drhd_units is traversed using list_for_each_entry_rcu() outside of an RCU read side critical section but under the protection of dmar_global_lock. Hence add corresponding lockdep expression to silence the following false-positive warnings: [ 1.603975] ============================= [ 1.603976] WARNING: suspicious RCU usage [ 1.603977] 5.5.4-stable #17 Not tainted [ 1.603978] ----------------------------- [ 1.603980] drivers/iommu/intel-iommu.c:4769 RCU-list traversed in non-reader section!! [ 1.603869] ============================= [ 1.603870] WARNING: suspicious RCU usage [ 1.603872] 5.5.4-stable #17 Not tainted [ 1.603874] ----------------------------- [ 1.603875] drivers/iommu/dmar.c:293 RCU-list traversed in non-reader section!! Tested-by: Madhuparna Bhowmik <[email protected]> Signed-off-by: Amol Grover <[email protected]> Cc: [email protected] Acked-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 98d54f8 commit 02d715b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/linux/dmar.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ struct dmar_pci_notify_info {
6969
extern struct rw_semaphore dmar_global_lock;
7070
extern struct list_head dmar_drhd_units;
7171

72-
#define for_each_drhd_unit(drhd) \
73-
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
72+
#define for_each_drhd_unit(drhd) \
73+
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
74+
dmar_rcu_check())
7475

7576
#define for_each_active_drhd_unit(drhd) \
7677
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
@@ -81,7 +82,8 @@ extern struct list_head dmar_drhd_units;
8182
if (i=drhd->iommu, drhd->ignored) {} else
8283

8384
#define for_each_iommu(i, drhd) \
84-
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
85+
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
86+
dmar_rcu_check()) \
8587
if (i=drhd->iommu, 0) {} else
8688

8789
static inline bool dmar_rcu_check(void)

0 commit comments

Comments
 (0)