public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	Nicolin Chen <nicolinc@nvidia.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Longfang Liu <liulongfang@huawei.com>,
	"Zhao, Yan Y" <yan.y.zhao@intel.com>,
	Joel Granados <j.granados@samsung.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v11 13/16] iommu: Improve iopf_queue_remove_device()
Date: Mon, 5 Feb 2024 10:32:31 -0400	[thread overview]
Message-ID: <20240205143231.GB10476@nvidia.com> (raw)
In-Reply-To: <416b19fa-bc7a-4ffd-a4c4-9440483fc039@linux.intel.com>

On Mon, Feb 05, 2024 at 07:55:23PM +0800, Baolu Lu wrote:
> On 2024/2/5 17:00, Tian, Kevin wrote:
> > > From: Lu Baolu <baolu.lu@linux.intel.com>
> > > Sent: Tuesday, January 30, 2024 4:09 PM
> > >    *
> > > - * Caller makes sure that no more faults are reported for this device.
> > > + * Removing a device from an iopf_queue. It's recommended to follow
> > > these
> > > + * steps when removing a device:
> > >    *
> > > - * Return: 0 on success and <0 on error.
> > > + * - Disable new PRI reception: Turn off PRI generation in the IOMMU
> > > hardware
> > > + *   and flush any hardware page request queues. This should be done
> > > before
> > > + *   calling into this helper.
> > 
> > this 1st step is already not followed by intel-iommu driver. The Page
> > Request Enable (PRE) bit is set in the context entry when a device
> > is attached to the default domain and cleared only in
> > intel_iommu_release_device().
> > 
> > but iopf_queue_remove_device() is called when IOMMU_DEV_FEAT_IOPF
> > is disabled e.g. when idxd driver is unbound from the device.
> > 
> > so the order is already violated.
> > 
> > > + * - Acknowledge all outstanding PRQs to the device: Respond to all
> > > outstanding
> > > + *   page requests with IOMMU_PAGE_RESP_INVALID, indicating the device
> > > should
> > > + *   not retry. This helper function handles this.
> > > + * - Disable PRI on the device: After calling this helper, the caller could
> > > + *   then disable PRI on the device.
> > 
> > intel_iommu_disable_iopf() disables PRI cap before calling this helper.
> 
> You are right. The individual drivers should be adjusted accordingly in
> separated patches. Here we just define the expected behaviors of the
> individual iommu driver from the core's perspective.

Yeah, I don't think the driver really works properly before this
documentation was added either :\

We also need to check that the proposed AMD patches (SVA support part
4) are working right before they are merged.

Jason

  reply	other threads:[~2024-02-05 14:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  8:08 [PATCH v11 00/16] iommu: Prepare to deliver page faults to user space Lu Baolu
2024-01-30  8:08 ` [PATCH v11 01/16] iommu: Move iommu fault data to linux/iommu.h Lu Baolu
2024-01-30  8:08 ` [PATCH v11 02/16] iommu/arm-smmu-v3: Remove unrecoverable faults reporting Lu Baolu
2024-01-30  8:08 ` [PATCH v11 03/16] iommu: Remove unrecoverable fault data Lu Baolu
2024-01-30  8:08 ` [PATCH v11 04/16] iommu: Cleanup iopf data structure definitions Lu Baolu
2024-01-30  8:08 ` [PATCH v11 05/16] iommu: Merge iopf_device_param into iommu_fault_param Lu Baolu
2024-01-30  8:08 ` [PATCH v11 06/16] iommu: Remove iommu_[un]register_device_fault_handler() Lu Baolu
2024-01-30  8:08 ` [PATCH v11 07/16] iommu: Merge iommu_fault_event and iopf_fault Lu Baolu
2024-01-30  8:08 ` [PATCH v11 08/16] iommu: Prepare for separating SVA and IOPF Lu Baolu
2024-01-30  8:08 ` [PATCH v11 09/16] iommu: Make iommu_queue_iopf() more generic Lu Baolu
2024-01-30  8:08 ` [PATCH v11 10/16] iommu: Separate SVA and IOPF Lu Baolu
2024-01-30  8:08 ` [PATCH v11 11/16] iommu: Refine locking for per-device fault data management Lu Baolu
2024-01-30  8:08 ` [PATCH v11 12/16] iommu: Use refcount for fault data access Lu Baolu
2024-02-05  8:37   ` Tian, Kevin
2024-02-05 11:46     ` Baolu Lu
2024-01-30  8:08 ` [PATCH v11 13/16] iommu: Improve iopf_queue_remove_device() Lu Baolu
2024-02-05  9:00   ` Tian, Kevin
2024-02-05 11:55     ` Baolu Lu
2024-02-05 14:32       ` Jason Gunthorpe [this message]
2024-02-06  8:09       ` Tian, Kevin
2024-02-06  8:33         ` Baolu Lu
2024-01-30  8:08 ` [PATCH v11 14/16] iommu: Track iopf group instead of last fault Lu Baolu
2024-02-06  8:31   ` Tian, Kevin
2024-01-30  8:08 ` [PATCH v11 15/16] iommu: Make iopf_group_response() return void Lu Baolu
2024-02-06  8:37   ` Tian, Kevin
2024-01-30  8:08 ` [PATCH v11 16/16] iommu: Make iommu_report_device_fault() " Lu Baolu
2024-02-06  8:39   ` Tian, Kevin

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=20240205143231.GB10476@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=j.granados@samsung.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=nicolinc@nvidia.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yan.y.zhao@intel.com \
    --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