iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] iommu/dmar: silence RCU-list debugging warnings
@ 2020-03-05 20:15 Qian Cai
  2020-03-07 11:53 ` Lu Baolu
  2020-03-10  9:31 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Qian Cai @ 2020-03-05 20:15 UTC (permalink / raw)
  To: jroedel; +Cc: iommu, linux-kernel

Similar to the commit 02d715b4a818 ("iommu/vt-d: Fix RCU list debugging
warnings"), there are several other places that call
list_for_each_entry_rcu() outside of an RCU read side critical section
but with dmar_global_lock held. Silence those false positives as well.

 drivers/iommu/intel-iommu.c:4288 RCU-list traversed in non-reader section!!
 1 lock held by swapper/0/1:
  #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1ad/0xb97

 drivers/iommu/dmar.c:366 RCU-list traversed in non-reader section!!
 1 lock held by swapper/0/1:
  #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x125/0xb97

 drivers/iommu/intel-iommu.c:5057 RCU-list traversed in non-reader section!!
 1 lock held by swapper/0/1:
  #0: ffffffffa71892c8 (dmar_global_lock){++++}, at: intel_iommu_init+0x61a/0xb13

Signed-off-by: Qian Cai <cai@lca.pw>
---
 drivers/iommu/dmar.c | 3 ++-
 include/linux/dmar.h | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 071bb42bbbc5..7b16c4db40b4 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -363,7 +363,8 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,
 {
 	struct dmar_drhd_unit *dmaru;
 
-	list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list)
+	list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list,
+				dmar_rcu_check())
 		if (dmaru->segment == drhd->segment &&
 		    dmaru->reg_base_addr == drhd->address)
 			return dmaru;
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 712be8bc6a7c..d7bf029df737 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -74,11 +74,13 @@ struct dmar_pci_notify_info {
 				dmar_rcu_check())
 
 #define for_each_active_drhd_unit(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 (drhd->ignored) {} else
 
 #define for_each_active_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, drhd->ignored) {} else
 
 #define for_each_iommu(i, drhd)						\
-- 
1.8.3.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH -next] iommu/dmar: silence RCU-list debugging warnings
  2020-03-05 20:15 [PATCH -next] iommu/dmar: silence RCU-list debugging warnings Qian Cai
@ 2020-03-07 11:53 ` Lu Baolu
  2020-03-10  9:31 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Lu Baolu @ 2020-03-07 11:53 UTC (permalink / raw)
  To: Qian Cai, jroedel; +Cc: iommu, linux-kernel

Hi,

On 2020/3/6 4:15, Qian Cai wrote:
> Similar to the commit 02d715b4a818 ("iommu/vt-d: Fix RCU list debugging
> warnings"), there are several other places that call
> list_for_each_entry_rcu() outside of an RCU read side critical section
> but with dmar_global_lock held. Silence those false positives as well.
> 
>   drivers/iommu/intel-iommu.c:4288 RCU-list traversed in non-reader section!!
>   1 lock held by swapper/0/1:
>    #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1ad/0xb97
> 
>   drivers/iommu/dmar.c:366 RCU-list traversed in non-reader section!!
>   1 lock held by swapper/0/1:
>    #0: ffffffff935892c8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x125/0xb97
> 
>   drivers/iommu/intel-iommu.c:5057 RCU-list traversed in non-reader section!!
>   1 lock held by swapper/0/1:
>    #0: ffffffffa71892c8 (dmar_global_lock){++++}, at: intel_iommu_init+0x61a/0xb13
> 
> Signed-off-by: Qian Cai <cai@lca.pw>


Thanks for the fix.

Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

> ---
>   drivers/iommu/dmar.c | 3 ++-
>   include/linux/dmar.h | 6 ++++--
>   2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 071bb42bbbc5..7b16c4db40b4 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -363,7 +363,8 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,
>   {
>   	struct dmar_drhd_unit *dmaru;
>   
> -	list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list)
> +	list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list,
> +				dmar_rcu_check())
>   		if (dmaru->segment == drhd->segment &&
>   		    dmaru->reg_base_addr == drhd->address)
>   			return dmaru;
> diff --git a/include/linux/dmar.h b/include/linux/dmar.h
> index 712be8bc6a7c..d7bf029df737 100644
> --- a/include/linux/dmar.h
> +++ b/include/linux/dmar.h
> @@ -74,11 +74,13 @@ struct dmar_pci_notify_info {
>   				dmar_rcu_check())
>   
>   #define for_each_active_drhd_unit(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 (drhd->ignored) {} else
>   
>   #define for_each_active_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, drhd->ignored) {} else
>   
>   #define for_each_iommu(i, drhd)						\
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH -next] iommu/dmar: silence RCU-list debugging warnings
  2020-03-05 20:15 [PATCH -next] iommu/dmar: silence RCU-list debugging warnings Qian Cai
  2020-03-07 11:53 ` Lu Baolu
@ 2020-03-10  9:31 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2020-03-10  9:31 UTC (permalink / raw)
  To: Qian Cai; +Cc: iommu, linux-kernel

On Thu, Mar 05, 2020 at 03:15:02PM -0500, Qian Cai wrote:
>  drivers/iommu/dmar.c | 3 ++-
>  include/linux/dmar.h | 6 ++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

end of thread, other threads:[~2020-03-10  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 20:15 [PATCH -next] iommu/dmar: silence RCU-list debugging warnings Qian Cai
2020-03-07 11:53 ` Lu Baolu
2020-03-10  9:31 ` 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).