mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Nicolin Chen <nicolinc@nvidia.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>
Cc: baolu.lu@linux.intel.com,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] iommu: Convert response code from failure to invalid
Date: Thu, 11 Jul 2024 12:42:11 +0800	[thread overview]
Message-ID: <9b3b05c0-b43a-4a56-b885-f79ef9efb38b@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB5276EC68D1BBB52C9E6DDE558CA42@BN9PR11MB5276.namprd11.prod.outlook.com>

On 7/10/24 5:56 PM, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@linux.intel.com>
>> Sent: Wednesday, July 10, 2024 4:34 PM
>>
>> In the iopf deliver path, iommu_report_device_fault() currently responds
>> a code of "Response Failure" to the hardware if it can't find a suitable
>> iopf-capable domain where the page faults should be handled. The Response
>> Failure is defined in PCI spec (section 10.4.2.1) as a catastrophic error,
>> and the device will disable PRI for the function.
>>
>> Failing to dispatch a set of fault messages is not a catastrophic error
>> and the iommu core has no code to recover the PRI once it is disabled.
>>
>> Replace it with a response code of "Invalid Response".
>>
>> Fixes: b554e396e51c ("iommu: Make iopf_group_response() return void")
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>>   drivers/iommu/io-pgfault.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/io-pgfault.c b/drivers/iommu/io-pgfault.c
>> index cd679c13752e..b8270ee5dcdb 100644
>> --- a/drivers/iommu/io-pgfault.c
>> +++ b/drivers/iommu/io-pgfault.c
>> @@ -229,7 +229,7 @@ void iommu_report_device_fault(struct device *dev,
>> struct iopf_fault *evt)
>>   err_abort:
>>   	dev_warn_ratelimited(dev, "iopf with pasid %d aborted\n",
>>   			     fault->prm.pasid);
>> -	iopf_group_response(group, IOMMU_PAGE_RESP_FAILURE);
>> +	iopf_group_response(group, IOMMU_PAGE_RESP_INVALID);
>>   	if (group == &abort_group)
>>   		__iopf_free_group(group);
>>   	else
> 
> this doesn't match the spec words on the use of INVALID:
> 
>    One or more pages within the associated PRG do not exist or
>    requests access privilege(s) that cannot be granted. Unless the
>    page mapping associated with the Function is altered, re-issuance
>    of the associated request will never result in success.
> 
> this situation is not related to the permission of page mapping. Instead
> it's a global problem applying to all functions submitting page requests
> at this moment.
> 
> Though using FAILURE affects more functions sharing the PRI interface,
> it also proactively avoids adding more in-fly requests to worsen the
> low memory situation.
> 
> So none of the options looks perfect to me, but the existing code
> responding FAILURE is more aligned to the spec?

Fair enough. Perhaps we can keep the existing code as-is unless any real
issues arise.

Thanks,
baolu

  reply	other threads:[~2024-07-11  4:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  8:33 [PATCH 0/3] iommufd: Avoid PRI Response Failure Lu Baolu
2024-07-10  8:33 ` [PATCH 1/3] iommufd: Remove IOMMUFD_PAGE_RESP_FAILURE Lu Baolu
2024-07-10  9:45   ` Tian, Kevin
2024-07-10  8:33 ` [PATCH 2/3] iommufd: Add check on user response code Lu Baolu
2024-07-10  9:47   ` Tian, Kevin
2024-07-11 23:39   ` Jason Gunthorpe
2024-07-12  2:54     ` Baolu Lu
2024-07-12 12:43       ` Jason Gunthorpe
2024-07-10  8:33 ` [PATCH 3/3] iommu: Convert response code from failure to invalid Lu Baolu
2024-07-10  9:56   ` Tian, Kevin
2024-07-11  4:42     ` Baolu Lu [this message]
2024-07-11 23:37     ` Jason Gunthorpe
2024-07-11 23:45 ` [PATCH 0/3] iommufd: Avoid PRI Response Failure Jason Gunthorpe

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=9b3b05c0-b43a-4a56-b885-f79ef9efb38b@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®