From: Baolu Lu <baolu.lu@linux.intel.com>
To: Bart Van Assche <bvanassche@acm.org>,
Lennert Buytenhek <buytenh@wantstofly.org>,
Sasha Levin <sashal@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux.dev
Cc: baolu.lu@linux.intel.com, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>,
Ashok Raj <ashok.raj@intel.com>,
Christoph Hellwig <hch@infradead.org>,
Jason Gunthorpe <jgg@nvidia.com>, Liu Yi L <yi.l.liu@intel.com>,
Jacob jun Pan <jacob.jun.pan@intel.com>,
linux-kernel@vger.kernel.org,
Scarlett Gourley <scarlett@arista.com>,
James Sewart <jamessewart@arista.com>,
Jack O'Sullivan <jack@arista.com>
Subject: Re: lockdep splat due to klist iteration from atomic context in Intel IOMMU driver
Date: Wed, 17 Aug 2022 12:45:26 +0800 [thread overview]
Message-ID: <5f734387-9757-0670-3eef-b565116af541@linux.intel.com> (raw)
In-Reply-To: <ab15191c-d79f-b5de-7568-d15b8f8a8aa8@acm.org>
On 2022/8/15 21:32, Bart Van Assche wrote:
> On 8/15/22 05:05, Lennert Buytenhek wrote:
>> On a build of 7ebfc85e2cd7 ("Merge tag 'net-6.0-rc1' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net"), with
>> CONFIG_INTEL_IOMMU_DEBUGFS enabled, I am seeing the lockdep splat
>> below when an I/O page fault occurs on a machine with an Intel
>> IOMMU in it.
>>
>> The issue seems to be the klist iterator functions using
>> spin_*lock_irq*() but the klist insertion functions using
>> spin_*lock(), combined with the Intel DMAR IOMMU driver iterating
>> over klists from atomic (hardirq) context as of commit 8ac0b64b9735
>> ("iommu/vt-d: Use pci_get_domain_bus_and_slot() in pgtable_walk()")
>> when CONFIG_INTEL_IOMMU_DEBUGFS is enabled, where
>> pci_get_domain_bus_and_slot() calls into bus_find_device() which
>> iterates over klists.
>>
>> I found this commit from 2018:
>>
>> commit 624fa7790f80575a4ec28fbdb2034097dc18d051
>> Author: Bart Van Assche <bvanassche@acm.org>
>> Date: Fri Jun 22 14:54:49 2018 -0700
>>
>> scsi: klist: Make it safe to use klists in atomic context
>>
>> This commit switched lib/klist.c:klist_{prev,next} from
>> spin_{,un}lock() to spin_{lock_irqsave,unlock_irqrestore}(), but left
>> the spin_{,un}lock() calls in add_{head,tail}() untouched.
>>
>> The simplest fix for this would be to switch
>> lib/klist.c:add_{head,tail}()
>> over to use the IRQ-safe spinlock variants as well?
>
> Another possibility would be to evaluate whether it is safe to revert
> commit 624fa7790f80 ("scsi: klist: Make it safe to use klists in atomic
> context"). That commit is no longer needed by the SRP transport driver
> since the legacy block layer has been removed from the kernel.
If so, pci_get_domain_bus_and_slot() can not be used in this interrupt
context, right?
Best regards,
baolu
next prev parent reply other threads:[~2022-08-17 4:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 12:05 lockdep splat due to klist iteration from atomic context in Intel IOMMU driver Lennert Buytenhek
2022-08-15 13:32 ` Bart Van Assche
2022-08-15 13:57 ` Lennert Buytenhek
2022-08-17 4:04 ` Baolu Lu
2022-08-17 6:09 ` Lennert Buytenhek
2022-08-17 7:20 ` Baolu Lu
2022-08-17 4:45 ` Baolu Lu [this message]
2022-08-17 5:49 ` Lennert Buytenhek
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=5f734387-9757-0670-3eef-b565116af541@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=buytenh@wantstofly.org \
--cc=bvanassche@acm.org \
--cc=dwmw2@infradead.org \
--cc=hch@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jack@arista.com \
--cc=jacob.jun.pan@intel.com \
--cc=jamessewart@arista.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=sashal@kernel.org \
--cc=scarlett@arista.com \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
/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