Linux IOMMU Development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Kevin Tian <kevin.tian@intel.com>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] iommu/vt-d: Fix lockdep splat in intel_iommu_init()
Date: Tue, 18 Oct 2022 15:57:56 -0600	[thread overview]
Message-ID: <20221018155756.55095893.alex.williamson@redhat.com> (raw)
In-Reply-To: <20220927053109.4053662-1-baolu.lu@linux.intel.com>

On Tue, 27 Sep 2022 13:31:07 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:

> Hi folks,
> 
> As commit c919739ce472 ("iommu/vt-d: Handle race between registration
> and device probe") highlights, a lockdep splat issue happens after
> moving iommu probing device process into iommu_device_register().
> 
> This is due to a conflict that get_resv_regions wants hold the
> dmar_global_lock, but it's also possible to be called from within a
> section where intel_iommu_init() already holds the lock.
> 
> Historically, before commit 5f64ce5411b46 ("iommu/vt-d: Duplicate
> iommu_resv_region objects per device list"), the rcu_lock is used in
> get_resv_regions. This commit converted it to dmar_global_lock in order
> to allowing sleeping in iommu_alloc_resv_region().
> 
> This aims to fix the lockdep issue by making iommu_alloc_resv_region()
> available in critical section and rolling dmar_global_lock back to rcu
> lock in get_resv_regions of the Intel IOMMU driver.
> 
> Best regards,
> baolu
> 
> Lu Baolu (2):
>   iommu: Add gfp parameter to iommu_alloc_resv_region
>   iommu/vt-d: Use rcu_lock in get_resv_regions
> 
>  include/linux/iommu.h                       |  2 +-
>  drivers/acpi/arm64/iort.c                   |  3 ++-
>  drivers/iommu/amd/iommu.c                   |  7 ++++---
>  drivers/iommu/apple-dart.c                  |  2 +-
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  2 +-
>  drivers/iommu/arm/arm-smmu/arm-smmu.c       |  2 +-
>  drivers/iommu/intel/iommu.c                 | 12 +++++++-----
>  drivers/iommu/iommu.c                       |  7 ++++---
>  drivers/iommu/mtk_iommu.c                   |  3 ++-
>  drivers/iommu/virtio-iommu.c                |  9 ++++++---
>  10 files changed, 29 insertions(+), 20 deletions(-)

Resolves the regression for me.  Hopefully Joerg will queue this for
6.1-rc.  Thanks!

Tested-by: Alex Williamson <alex.williamson@redhat.com>


  parent reply	other threads:[~2022-10-18 21:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  5:31 [PATCH 0/2] iommu/vt-d: Fix lockdep splat in intel_iommu_init() Lu Baolu
2022-09-27  5:31 ` [PATCH 1/2] iommu: Add gfp parameter to iommu_alloc_resv_region Lu Baolu
2022-09-27  5:31 ` [PATCH 2/2] iommu/vt-d: Use rcu_lock in get_resv_regions Lu Baolu
2022-09-30  2:23 ` [PATCH 0/2] iommu/vt-d: Fix lockdep splat in intel_iommu_init() Baolu Lu
2022-10-18 21:57 ` Alex Williamson [this message]
2022-10-19  0:49 ` 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=20221018155756.55095893.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox