iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: silence a RCU-list debugging warning
@ 2020-03-17 15:03 Qian Cai
  2020-03-18  5:27 ` Lu Baolu
  0 siblings, 1 reply; 4+ messages in thread
From: Qian Cai @ 2020-03-17 15:03 UTC (permalink / raw)
  To: jroedel; +Cc: iommu, linux-kernel

dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read
side critical section but with dmar_global_lock held. Silence this
false positive.

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

 Call Trace:
  dump_stack+0xa4/0xfe
  lockdep_rcu_suspicious+0xeb/0xf5
  dmar_find_atsr+0x1ab/0x1c0
  dmar_parse_one_atsr+0x64/0x220
  dmar_walk_remapping_entries+0x130/0x380
  dmar_table_init+0x166/0x243
  intel_iommu_init+0x1ab/0xe19
  pci_iommu_init+0x1a/0x44
  do_one_initcall+0xae/0x4d0
  kernel_init_freeable+0x412/0x4c5
  kernel_init+0x19/0x193

Signed-off-by: Qian Cai <cai@lca.pw>
---
 drivers/iommu/intel-iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 4be549478691..ef0a5246700e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4501,7 +4501,8 @@ static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr)
 	struct dmar_atsr_unit *atsru;
 	struct acpi_dmar_atsr *tmp;
 
-	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) {
+	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list,
+				dmar_rcu_check()) {
 		tmp = (struct acpi_dmar_atsr *)atsru->hdr;
 		if (atsr->segment != tmp->segment)
 			continue;
-- 
2.21.0 (Apple Git-122.2)

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

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

* Re: [PATCH] iommu/vt-d: silence a RCU-list debugging warning
  2020-03-17 15:03 [PATCH] iommu/vt-d: silence a RCU-list debugging warning Qian Cai
@ 2020-03-18  5:27 ` Lu Baolu
  2020-03-18 11:14   ` Qian Cai
  2020-03-19 14:16   ` Joerg Roedel
  0 siblings, 2 replies; 4+ messages in thread
From: Lu Baolu @ 2020-03-18  5:27 UTC (permalink / raw)
  To: Qian Cai, jroedel; +Cc: iommu, linux-kernel

On 2020/3/17 23:03, Qian Cai wrote:
> dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read
> side critical section but with dmar_global_lock held. Silence this
> false positive.
> 
>   drivers/iommu/intel-iommu.c:4504 RCU-list traversed in non-reader section!!
>   1 lock held by swapper/0/1:
>   #0: ffffffff9755bee8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1a6/0xe19
> 
>   Call Trace:
>    dump_stack+0xa4/0xfe
>    lockdep_rcu_suspicious+0xeb/0xf5
>    dmar_find_atsr+0x1ab/0x1c0
>    dmar_parse_one_atsr+0x64/0x220
>    dmar_walk_remapping_entries+0x130/0x380
>    dmar_table_init+0x166/0x243
>    intel_iommu_init+0x1ab/0xe19
>    pci_iommu_init+0x1a/0x44
>    do_one_initcall+0xae/0x4d0
>    kernel_init_freeable+0x412/0x4c5
>    kernel_init+0x19/0x193
> 
> Signed-off-by: Qian Cai <cai@lca.pw>

How about changing the commit subject to
"iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()"?

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

Best regards,
baolu

> ---
>   drivers/iommu/intel-iommu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index 4be549478691..ef0a5246700e 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -4501,7 +4501,8 @@ static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr)
>   	struct dmar_atsr_unit *atsru;
>   	struct acpi_dmar_atsr *tmp;
>   
> -	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) {
> +	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list,
> +				dmar_rcu_check()) {
>   		tmp = (struct acpi_dmar_atsr *)atsru->hdr;
>   		if (atsr->segment != tmp->segment)
>   			continue;
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH] iommu/vt-d: silence a RCU-list debugging warning
  2020-03-18  5:27 ` Lu Baolu
@ 2020-03-18 11:14   ` Qian Cai
  2020-03-19 14:16   ` Joerg Roedel
  1 sibling, 0 replies; 4+ messages in thread
From: Qian Cai @ 2020-03-18 11:14 UTC (permalink / raw)
  To: Lu Baolu; +Cc: iommu, jroedel, linux-kernel



> On Mar 18, 2020, at 1:27 AM, Lu Baolu <baolu.lu@linux.intel.com> wrote:
> 
> How about changing the commit subject to
> "iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()"?

Just a bit long which should be non-issue.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH] iommu/vt-d: silence a RCU-list debugging warning
  2020-03-18  5:27 ` Lu Baolu
  2020-03-18 11:14   ` Qian Cai
@ 2020-03-19 14:16   ` Joerg Roedel
  1 sibling, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2020-03-19 14:16 UTC (permalink / raw)
  To: Lu Baolu; +Cc: iommu, linux-kernel

On Wed, Mar 18, 2020 at 01:27:53PM +0800, Lu Baolu wrote:
> On 2020/3/17 23:03, Qian Cai wrote:
> > dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read
> > side critical section but with dmar_global_lock held. Silence this
> > false positive.
> > 
> >   drivers/iommu/intel-iommu.c:4504 RCU-list traversed in non-reader section!!
> >   1 lock held by swapper/0/1:
> >   #0: ffffffff9755bee8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1a6/0xe19
> > 
> >   Call Trace:
> >    dump_stack+0xa4/0xfe
> >    lockdep_rcu_suspicious+0xeb/0xf5
> >    dmar_find_atsr+0x1ab/0x1c0
> >    dmar_parse_one_atsr+0x64/0x220
> >    dmar_walk_remapping_entries+0x130/0x380
> >    dmar_table_init+0x166/0x243
> >    intel_iommu_init+0x1ab/0xe19
> >    pci_iommu_init+0x1a/0x44
> >    do_one_initcall+0xae/0x4d0
> >    kernel_init_freeable+0x412/0x4c5
> >    kernel_init+0x19/0x193
> > 
> > Signed-off-by: Qian Cai <cai@lca.pw>
> 
> How about changing the commit subject to
> "iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()"?
> 
> Acked-by: Lu Baolu <baolu.lu@linux.intel.com>

Fixed up the subject and applied it, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 15:03 [PATCH] iommu/vt-d: silence a RCU-list debugging warning Qian Cai
2020-03-18  5:27 ` Lu Baolu
2020-03-18 11:14   ` Qian Cai
2020-03-19 14:16   ` 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).