iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Subject: [PATCH 1/3] iommu/vt-d: Add rate limited information when PRQ overflows
Date: Thu, 21 Jan 2021 09:45:03 +0800	[thread overview]
Message-ID: <20210121014505.1659166-2-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20210121014505.1659166-1-baolu.lu@linux.intel.com>

So that the uses could get chances to know what happened.

Suggested-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index 033b25886e57..f49fe715477b 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -895,6 +895,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 	struct intel_iommu *iommu = d;
 	struct intel_svm *svm = NULL;
 	int head, tail, handled = 0;
+	struct page_req_dsc *req;
 
 	/* Clear PPR bit before reading head/tail registers, to
 	 * ensure that we get a new interrupt if needed. */
@@ -904,7 +905,6 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 	head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK;
 	while (head != tail) {
 		struct vm_area_struct *vma;
-		struct page_req_dsc *req;
 		struct qi_desc resp;
 		int result;
 		vm_fault_t ret;
@@ -1042,8 +1042,14 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 	 * Clear the page request overflow bit and wake up all threads that
 	 * are waiting for the completion of this handling.
 	 */
-	if (readl(iommu->reg + DMAR_PRS_REG) & DMA_PRS_PRO)
+	if (readl(iommu->reg + DMAR_PRS_REG) & DMA_PRS_PRO) {
+		head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK;
+		req = &iommu->prq[head / sizeof(*req)];
+		pr_warn_ratelimited("IOMMU: %s: Page request overflow: HEAD: %08llx %08llx",
+				    iommu->name, ((unsigned long long *)req)[0],
+				    ((unsigned long long *)req)[1]);
 		writel(DMA_PRS_PRO, iommu->reg + DMAR_PRS_REG);
+	}
 
 	if (!completion_done(&iommu->prq_complete))
 		complete(&iommu->prq_complete);
-- 
2.25.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-01-21  1:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  1:45 [PATCH 0/3] iommu/vt-d: Some misc tweaks in SVA Lu Baolu
2021-01-21  1:45 ` Lu Baolu [this message]
2021-01-22  6:38   ` [PATCH 1/3] iommu/vt-d: Add rate limited information when PRQ overflows Tian, Kevin
2021-01-25  6:28     ` Lu Baolu
2021-01-25  8:16       ` Tian, Kevin
2021-01-25  8:30         ` Lu Baolu
2021-01-21  1:45 ` [PATCH 2/3] iommu/vt-d: Allow devices to have more than 32 outstanding PRQ Lu Baolu
2021-01-21  1:45 ` [PATCH 3/3] iommu/vt-d: Use INVALID response code instead of FAILURE 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=20210121014505.1659166-2-baolu.lu@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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).