All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>,
	Christoph Hellwig <hch@infradead.org>,
	Kevin Tian <kevin.tian@intel.com>,
	Ashok Raj <ashok.raj@intel.com>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Eric Auger <eric.auger@redhat.com>, Liu Yi L <yi.l.liu@intel.com>,
	Jacob jun Pan <jacob.jun.pan@intel.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 11/12] iommu: Per-domain I/O page fault handling
Date: Thu, 28 Apr 2022 15:57:16 +0100	[thread overview]
Message-ID: <YmqrTGcHotvhhaT2@myrica> (raw)
In-Reply-To: <20220421052121.3464100-12-baolu.lu@linux.intel.com>

On Thu, Apr 21, 2022 at 01:21:20PM +0800, Lu Baolu wrote:
>  static void iopf_handle_group(struct work_struct *work)
>  {
>  	struct iopf_group *group;
> @@ -134,12 +78,23 @@ static void iopf_handle_group(struct work_struct *work)
>  	group = container_of(work, struct iopf_group, work);
>  
>  	list_for_each_entry_safe(iopf, next, &group->faults, list) {
> +		struct iommu_domain *domain;
> +
> +		domain = iommu_get_domain_for_dev_pasid_async(group->dev,
> +				iopf->fault.prm.pasid);

Reading the PCIe spec again (v6.0 10.4.1.1 PASID Usage), all faults within
the group have the same PASID so we could move the domain fetch out of the
loop. It does deviate from the old behavior, though, so we could change
it later.

Thanks,
Jean

> +		if (!domain || !domain->iopf_handler)
> +			status = IOMMU_PAGE_RESP_INVALID;
> +
>  		/*
>  		 * For the moment, errors are sticky: don't handle subsequent
>  		 * faults in the group if there is an error.
>  		 */
>  		if (status == IOMMU_PAGE_RESP_SUCCESS)
> -			status = iopf_handle_single(iopf);
> +			status = domain->iopf_handler(&iopf->fault,
> +						      domain->fault_data);
> +
> +		if (domain)
> +			iommu_domain_put_async(domain);
>  
>  		if (!(iopf->fault.prm.flags &
>  		      IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE))

WARNING: multiple messages have this Message-ID (diff)
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	Robin Murphy <robin.murphy@arm.com>,
	linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	iommu@lists.linux-foundation.org,
	Jacob jun Pan <jacob.jun.pan@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH v4 11/12] iommu: Per-domain I/O page fault handling
Date: Thu, 28 Apr 2022 15:57:16 +0100	[thread overview]
Message-ID: <YmqrTGcHotvhhaT2@myrica> (raw)
In-Reply-To: <20220421052121.3464100-12-baolu.lu@linux.intel.com>

On Thu, Apr 21, 2022 at 01:21:20PM +0800, Lu Baolu wrote:
>  static void iopf_handle_group(struct work_struct *work)
>  {
>  	struct iopf_group *group;
> @@ -134,12 +78,23 @@ static void iopf_handle_group(struct work_struct *work)
>  	group = container_of(work, struct iopf_group, work);
>  
>  	list_for_each_entry_safe(iopf, next, &group->faults, list) {
> +		struct iommu_domain *domain;
> +
> +		domain = iommu_get_domain_for_dev_pasid_async(group->dev,
> +				iopf->fault.prm.pasid);

Reading the PCIe spec again (v6.0 10.4.1.1 PASID Usage), all faults within
the group have the same PASID so we could move the domain fetch out of the
loop. It does deviate from the old behavior, though, so we could change
it later.

Thanks,
Jean

> +		if (!domain || !domain->iopf_handler)
> +			status = IOMMU_PAGE_RESP_INVALID;
> +
>  		/*
>  		 * For the moment, errors are sticky: don't handle subsequent
>  		 * faults in the group if there is an error.
>  		 */
>  		if (status == IOMMU_PAGE_RESP_SUCCESS)
> -			status = iopf_handle_single(iopf);
> +			status = domain->iopf_handler(&iopf->fault,
> +						      domain->fault_data);
> +
> +		if (domain)
> +			iommu_domain_put_async(domain);
>  
>  		if (!(iopf->fault.prm.flags &
>  		      IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE))
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2022-04-28 14:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  5:21 [PATCH v4 00/12] iommu: SVA and IOPF refactoring Lu Baolu
2022-04-21  5:21 ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 01/12] dmaengine: idxd: Separate user and kernel pasid enabling Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 02/12] iommu: Add pasid_bits field in struct dev_iommu Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 03/12] iommu: Add attach/detach_dev_pasid domain ops Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-28 14:53   ` Jean-Philippe Brucker
2022-04-28 14:53     ` Jean-Philippe Brucker
2022-04-29  6:27     ` Baolu Lu
2022-04-29  6:27       ` Baolu Lu
2022-04-21  5:21 ` [PATCH v4 04/12] iommu/sva: Basic data structures for SVA Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 05/12] iommu/vt-d: Remove SVM_FLAG_SUPERVISOR_MODE support Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 06/12] iommu/vt-d: Add SVA domain support Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 07/12] arm-smmu-v3/sva: " Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 08/12] iommu/sva: Use attach/detach_pasid_dev in SVA interfaces Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 09/12] iommu: Remove SVA related callbacks from iommu ops Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-21  5:21 ` [PATCH v4 10/12] iommu: Prepare IOMMU domain for IOPF Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-28 14:47   ` Jean-Philippe Brucker
2022-04-28 14:47     ` Jean-Philippe Brucker
2022-04-29  6:17     ` Baolu Lu
2022-04-29  6:17       ` Baolu Lu
2022-04-21  5:21 ` [PATCH v4 11/12] iommu: Per-domain I/O page fault handling Lu Baolu
2022-04-21  5:21   ` Lu Baolu
2022-04-28 14:57   ` Jean-Philippe Brucker [this message]
2022-04-28 14:57     ` Jean-Philippe Brucker
2022-04-29  6:35     ` Baolu Lu
2022-04-29  6:35       ` Baolu Lu
2022-04-21  5:21 ` [PATCH v4 12/12] iommu: Rename iommu-sva-lib.{c,h} Lu Baolu
2022-04-21  5:21   ` Lu Baolu

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=YmqrTGcHotvhhaT2@myrica \
    --to=jean-philippe@linaro.org \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.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=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 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.