All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Kevin Tian <kevin.tian@intel.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, leitao@debian.org
Subject: Re: [PATCH 1/1] iommu/vt-d: Fix suspicious RCU usage
Date: Tue, 18 Feb 2025 12:14:53 +0200	[thread overview]
Message-ID: <Z7RdnR2onJ2AZIJl@shredder> (raw)
In-Reply-To: <20250218022422.2315082-1-baolu.lu@linux.intel.com>

+ Breno who also encountered this issue

On Tue, Feb 18, 2025 at 10:24:21AM +0800, Lu Baolu wrote:
> Commit <d74169ceb0d2> ("iommu/vt-d: Allocate DMAR fault interrupts
> locally") moved the call to enable_drhd_fault_handling() to a code
> path that does not hold any lock while traversing the drhd list. Fix
> it by ensuring the dmar_global_lock lock is held when traversing the
> drhd list.
> 
> Without this fix, the following warning is triggered:
>  =============================
>  WARNING: suspicious RCU usage
>  6.14.0-rc3 #55 Not tainted
>  -----------------------------
>  drivers/iommu/intel/dmar.c:2046 RCU-list traversed in non-reader section!!
>                other info that might help us debug this:
>                rcu_scheduler_active = 1, debug_locks = 1
>  2 locks held by cpuhp/1/23:
>  #0: ffffffff84a67c50 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0
>  #1: ffffffff84a6a380 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x87/0x2c0
>  stack backtrace:
>  CPU: 1 UID: 0 PID: 23 Comm: cpuhp/1 Not tainted 6.14.0-rc3 #55
>  Call Trace:
>   <TASK>
>   dump_stack_lvl+0xb7/0xd0
>   lockdep_rcu_suspicious+0x159/0x1f0
>   ? __pfx_enable_drhd_fault_handling+0x10/0x10
>   enable_drhd_fault_handling+0x151/0x180
>   cpuhp_invoke_callback+0x1df/0x990
>   cpuhp_thread_fun+0x1ea/0x2c0
>   smpboot_thread_fn+0x1f5/0x2e0
>   ? __pfx_smpboot_thread_fn+0x10/0x10
>   kthread+0x12a/0x2d0
>   ? __pfx_kthread+0x10/0x10
>   ret_from_fork+0x4a/0x60
>   ? __pfx_kthread+0x10/0x10
>   ret_from_fork_asm+0x1a/0x30
>   </TASK>
> 
> Simply holding the lock in enable_drhd_fault_handling() will trigger a
> lock order splat. Avoid holding the dmar_global_lock when calling
> iommu_device_register(), which starts the device probe process.
> 
> Fixes: d74169ceb0d2 ("iommu/vt-d: Allocate DMAR fault interrupts locally")
> Reported-by: Ido Schimmel <idosch@idosch.org>
> Closes: https://lore.kernel.org/linux-iommu/Zx9OwdLIc_VoQ0-a@shredder.mtl.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Thanks for the fix. I tested it and the warning is gone.

Tested-by: Ido Schimmel <idosch@nvidia.com>

  reply	other threads:[~2025-02-18 10:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18  2:24 [PATCH 1/1] iommu/vt-d: Fix suspicious RCU usage Lu Baolu
2025-02-18 10:14 ` Ido Schimmel [this message]
2025-02-18 14:09   ` Breno Leitao
2025-02-20  7:21 ` Tian, Kevin
2025-02-20 11:38   ` Baolu Lu
2025-02-21  7:22     ` Tian, Kevin
2025-02-21  8:27       ` Baolu Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7RdnR2onJ2AZIJl@shredder \
    --to=idosch@idosch.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.