linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings
@ 2020-02-23 16:55 Amol Grover
  2020-02-23 23:34 ` Lu Baolu
  2020-03-02 16:04 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Amol Grover @ 2020-02-23 16:55 UTC (permalink / raw)
  To: Allison Randal, Greg Kroah-Hartman, Andrew Morton, Lu Baolu,
	Thomas Gleixner, Qian Cai, Deepa Dinamani, Joerg Roedel
  Cc: linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . McKenney, Amol Grover

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 <madhuparnabhowmik10@gmail.com>
Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 include/linux/dmar.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f64ca27dc210..712be8bc6a7c 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -69,8 +69,9 @@ struct dmar_pci_notify_info {
 extern struct rw_semaphore dmar_global_lock;
 extern struct list_head dmar_drhd_units;
 
-#define for_each_drhd_unit(drhd) \
-	list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
+#define for_each_drhd_unit(drhd)					\
+	list_for_each_entry_rcu(drhd, &dmar_drhd_units, list,		\
+				dmar_rcu_check())
 
 #define for_each_active_drhd_unit(drhd)					\
 	list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)		\
@@ -81,7 +82,8 @@ extern struct list_head dmar_drhd_units;
 		if (i=drhd->iommu, drhd->ignored) {} else
 
 #define for_each_iommu(i, drhd)						\
-	list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)		\
+	list_for_each_entry_rcu(drhd, &dmar_drhd_units, list,		\
+				dmar_rcu_check())			\
 		if (i=drhd->iommu, 0) {} else 
 
 static inline bool dmar_rcu_check(void)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings
  2020-02-23 16:55 [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings Amol Grover
@ 2020-02-23 23:34 ` Lu Baolu
  2020-03-02 16:04 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Lu Baolu @ 2020-02-23 23:34 UTC (permalink / raw)
  To: Amol Grover, Allison Randal, Greg Kroah-Hartman, Andrew Morton,
	Thomas Gleixner, Qian Cai, Deepa Dinamani, Joerg Roedel
  Cc: baolu.lu, linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . McKenney

On 2020/2/24 0:55, Amol Grover wrote:
> 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 <madhuparnabhowmik10@gmail.com>
> Signed-off-by: Amol Grover <frextrite@gmail.com>

Thanks for the fix.

Cc: stable@vger.kernel.org
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings
  2020-02-23 16:55 [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings Amol Grover
  2020-02-23 23:34 ` Lu Baolu
@ 2020-03-02 16:04 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2020-03-02 16:04 UTC (permalink / raw)
  To: Amol Grover
  Cc: Allison Randal, Greg Kroah-Hartman, Andrew Morton, Lu Baolu,
	Thomas Gleixner, Qian Cai, Deepa Dinamani, linux-kernel,
	linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik,
	Paul E . McKenney

On Sun, Feb 23, 2020 at 10:25:39PM +0530, Amol Grover wrote:
> 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 <madhuparnabhowmik10@gmail.com>
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
>  include/linux/dmar.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-02 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23 16:55 [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings Amol Grover
2020-02-23 23:34 ` Lu Baolu
2020-03-02 16:04 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).