From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Will Deacon <will@kernel.org>,
Kunkun Jiang <jiangkunkun@huawei.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>,
Nicolin Chen <nicolinc@nvidia.com>,
Michael Shavit <mshavit@google.com>,
Mostafa Saleh <smostafa@google.com>,
"moderated list:ARM SMMU DRIVERS"
<linux-arm-kernel@lists.infradead.org>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"wanghaibin.wang@huawei.com" <wanghaibin.wang@huawei.com>,
"yuzenghui@huawei.com" <yuzenghui@huawei.com>,
"tangnianyao@huawei.com" <tangnianyao@huawei.com>
Subject: Re: [bug report] iommu/arm-smmu-v3: Event cannot be printed in some scenarios
Date: Thu, 25 Jul 2024 09:58:45 -0300 [thread overview]
Message-ID: <20240725125845.GA3030761@ziepe.ca> (raw)
In-Reply-To: <BN9PR11MB52762A8455449C6A432DA0BB8CAB2@BN9PR11MB5276.namprd11.prod.outlook.com>
On Thu, Jul 25, 2024 at 07:35:00AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@ziepe.ca>
> > Sent: Wednesday, July 24, 2024 9:03 PM
> >
> > On Wed, Jul 24, 2024 at 11:24:17AM +0100, Will Deacon wrote:
> > > > This event handling process is as follows:
> > > > arm_smmu_evtq_thread
> > > > ret = arm_smmu_handle_evt
> > > > iommu_report_device_fault
> > > > iopf_param = iopf_get_dev_fault_param(dev);
> > > > // iopf is not enabled.
> > > > // No RESUME will be sent!
> > > > if (WARN_ON(!iopf_param))
> > > > return;
> > > > if (!ret || !__ratelimit(&rs))
> > > > continue;
> > > >
> > > > In this scenario, the io page-fault capability is not enabled.
> > > > There are two problems here:
> > > > 1. The event information is not printed.
> > > > 2. The entire device(PF level) is stalled,not just the current
> > > > VF. This affects other normal VFs.
>
> Out of curiosity. From your code example the difference before
> and after this change is on the prints. Why would it lead to the
> stall problem?
Because of this:
iopf_param = iopf_get_dev_fault_param(dev);
if (WARN_ON(!iopf_param))
- return;
If you hit the WARN_ON then we don't do anything with the fault and it
remains uncompleted.
> > + * and the fault remains owned by the caller. The caller should log the DMA
> > + * protection failure and resolve the fault. Otherwise on success the fault is
> > + * always completed eventually.
>
> About "resolve the fault", I didn't find such logic from smmu side in
> arm_smmu_evtq_thread(). It just logs the event. Is it asking for new
> change in smmu driver or reflecting the current fact which if missing
> leads to the said stall problem?
It was removed in b554e396e51c ("iommu: Make iopf_group_response() return void")
ret = iommu_report_device_fault(master->dev, &fault_evt);
- if (ret && flt->type == IOMMU_FAULT_PAGE_REQ) {
- /* Nobody cared, abort the access */
- struct iommu_page_response resp = {
- .pasid = flt->prm.pasid,
- .grpid = flt->prm.grpid,
- .code = IOMMU_PAGE_RESP_FAILURE,
- };
- arm_smmu_page_response(master->dev, &fault_evt, &resp);
- }
-
Part of the observation going into b554e396e51c was that all drivers
have something like the above, and we can pull it into the core code.
So perhaps we should still always abort the request from
iommu_report_device_fault() instead of requiring boilerplate like
above in drivers. That does some better.
The return code only indicates if the event should be logged.
> > /*
> > * On success iopf_handler must call iopf_group_response() and
> >
>
> Now given a return value is required we should also return '0'
> in the following path with a valid iopf_handler.
Yes, that was my intention
Jason
next prev parent reply other threads:[~2024-07-25 12:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 1:42 [bug report] iommu/arm-smmu-v3: Event cannot be printed in some scenarios Kunkun Jiang
2024-07-24 9:15 ` Mostafa Saleh
2024-07-24 9:22 ` Kunkun Jiang
2024-07-24 10:24 ` Will Deacon
2024-07-24 13:03 ` Jason Gunthorpe
2024-07-25 7:35 ` Tian, Kevin
2024-07-25 12:58 ` Jason Gunthorpe [this message]
2024-07-26 0:04 ` Tian, Kevin
2024-07-29 5:29 ` Baolu Lu
2024-08-02 14:38 ` Pranjal Shrivastava
2024-08-05 12:13 ` Kunkun Jiang
2024-08-05 12:30 ` Will Deacon
[not found] ` <ZrDwolC6oXN44coq@google.com>
2024-08-06 0:09 ` Baolu Lu
2024-08-06 12:49 ` Jason Gunthorpe
2024-08-06 15:58 ` Pranjal Shrivastava
2024-08-07 5:35 ` Baolu Lu
2024-08-08 13:50 ` Pranjal Shrivastava
2024-08-13 17:56 ` Jason Gunthorpe
2024-08-14 9:02 ` Pranjal Shrivastava
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=20240725125845.GA3030761@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jiangkunkun@huawei.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=smostafa@google.com \
--cc=tangnianyao@huawei.com \
--cc=wanghaibin.wang@huawei.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.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;
as well as URLs for NNTP newsgroup(s).