From: Jason Gunthorpe <jgg@ziepe.ca>
To: Baolu Lu <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>,
Huang Jiaqing <jiaqing.huang@intel.com>,
Ethan Zhao <haifeng.zhao@linux.intel.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iommu/vt-d: Use device rbtree in iopf reporting path
Date: Wed, 21 Feb 2024 11:31:08 -0400 [thread overview]
Message-ID: <20240221153108.GA13491@ziepe.ca> (raw)
In-Reply-To: <67391b2d-b441-4d43-aa46-2a30c95420a3@linux.intel.com>
On Sun, Feb 18, 2024 at 03:02:00PM +0800, Baolu Lu wrote:
> A device hot removing goes through at least the following steps:
>
> - Disable PRI.
> - Drain all outstanding I/O page faults.
> - Stop DMA.
> - Unload the device driver.
> - Call iommu_release_device() upon the BUS_NOTIFY_REMOVED_DEVICE event.
>
> This sequence ensures that a device cannot generate an I/O page fault
> after PRI has been disabled. So in reality it's impossible for a device
> to generate an I/O page fault before disabling PRI and then go through
> the long journey to reach iommu_release_device() before
> iopf_get_dev_fault_param() is called in page fault interrupt handling
> thread.
Why is this impossible? Seems like a classic race..
Flush the HW page fault queue as part of the above to ensure there is
no concurrent iopf_get_dev_fault_param() on the now PRI disabled BDF.
> Considering this behavior, adding a comment to the code explaining the
> sequence and removing put_device() may be a simpler solution?
A comment is definitely needed
Jason
next prev parent reply other threads:[~2024-02-21 15:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 7:22 [PATCH 0/2] iommu/vt-d: Introduce rbtree for probed devices Lu Baolu
2024-02-15 7:22 ` [PATCH 1/2] iommu/vt-d: Use rbtree to track iommu " Lu Baolu
2024-02-15 17:47 ` Jason Gunthorpe
2024-02-18 4:22 ` Baolu Lu
2024-02-19 2:45 ` Ethan Zhao
2024-02-19 4:04 ` Baolu Lu
2024-02-19 5:33 ` Ethan Zhao
2024-02-19 6:47 ` Baolu Lu
2024-02-19 7:24 ` Ethan Zhao
2024-02-15 7:22 ` [PATCH 2/2] iommu/vt-d: Use device rbtree in iopf reporting path Lu Baolu
2024-02-15 17:55 ` Jason Gunthorpe
2024-02-18 7:02 ` Baolu Lu
2024-02-21 15:31 ` Jason Gunthorpe [this message]
2024-02-21 7:04 ` Ethan Zhao
2024-02-21 7:37 ` Baolu Lu
2024-02-19 6:54 ` Ethan Zhao
2024-02-19 6:58 ` Baolu Lu
2024-02-19 7:06 ` Ethan Zhao
2024-02-19 7:22 ` 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=20240221153108.GA13491@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--cc=haifeng.zhao@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jiaqing.huang@intel.com \
--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 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.