From: Ajay Garg <ajaygargnsit@gmail.com> To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org Cc: Ajay Garg <ajaygargnsit@gmail.com> Subject: [PATCH] iommu: intel: remove flooding of non-error logs, when new-DMA-PTE is the same as old-DMA-PTE. Date: Sat, 2 Oct 2021 18:10:12 +0530 [thread overview] Message-ID: <20211002124012.18186-1-ajaygargnsit@gmail.com> (raw) Taking a SD-MMC controller (over PCI) as an example, following is an example sequencing, where the log-flooding happened : 0. We have a host and a guest, both running latest x86_64 kernels. 1. Host-machine is booted up (with intel_iommu=on), and the DMA-PTEs are setup for the controller (on the host), for the first time. 2. The SD-controller device is added to a (L1) guest on a KVM-VM (via virt-manager). 3. The KVM-VM is booted up. 4. Above triggers a re-setup of DMA-PTEs on the host, for a second time. It is observed that the new PTEs formed (on the host) are same as the original PTEs, and thus following logs, accompanied by stacktraces, overwhelm the logs : ...... DMAR: ERROR: DMA PTE for vPFN 0x428ec already set (to 3f6ec003 not 3f6ec003) DMAR: ERROR: DMA PTE for vPFN 0x428ed already set (to 3f6ed003 not 3f6ed003) DMAR: ERROR: DMA PTE for vPFN 0x428ee already set (to 3f6ee003 not 3f6ee003) DMAR: ERROR: DMA PTE for vPFN 0x428ef already set (to 3f6ef003 not 3f6ef003) DMAR: ERROR: DMA PTE for vPFN 0x428f0 already set (to 3f6f0003 not 3f6f0003) ...... As the PTEs are same, so there is no cause of concern, and we can easily avoid the logs-flood for this non-error case. Signed-off-by: Ajay Garg <ajaygargnsit@gmail.com> --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index d75f59ae28e6..8bea8b4e3ff9 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2370,7 +2370,7 @@ __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, * touches the iova range */ tmp = cmpxchg64_local(&pte->val, 0ULL, pteval); - if (tmp) { + if (tmp && (tmp != pteval)) { static int dumps = 5; pr_crit("ERROR: DMA PTE for vPFN 0x%lx already set (to %llx not %llx)\n", iov_pfn, tmp, (unsigned long long)pteval); -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Ajay Garg <ajaygargnsit@gmail.com> To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org Subject: [PATCH] iommu: intel: remove flooding of non-error logs, when new-DMA-PTE is the same as old-DMA-PTE. Date: Sat, 2 Oct 2021 18:10:12 +0530 [thread overview] Message-ID: <20211002124012.18186-1-ajaygargnsit@gmail.com> (raw) Taking a SD-MMC controller (over PCI) as an example, following is an example sequencing, where the log-flooding happened : 0. We have a host and a guest, both running latest x86_64 kernels. 1. Host-machine is booted up (with intel_iommu=on), and the DMA-PTEs are setup for the controller (on the host), for the first time. 2. The SD-controller device is added to a (L1) guest on a KVM-VM (via virt-manager). 3. The KVM-VM is booted up. 4. Above triggers a re-setup of DMA-PTEs on the host, for a second time. It is observed that the new PTEs formed (on the host) are same as the original PTEs, and thus following logs, accompanied by stacktraces, overwhelm the logs : ...... DMAR: ERROR: DMA PTE for vPFN 0x428ec already set (to 3f6ec003 not 3f6ec003) DMAR: ERROR: DMA PTE for vPFN 0x428ed already set (to 3f6ed003 not 3f6ed003) DMAR: ERROR: DMA PTE for vPFN 0x428ee already set (to 3f6ee003 not 3f6ee003) DMAR: ERROR: DMA PTE for vPFN 0x428ef already set (to 3f6ef003 not 3f6ef003) DMAR: ERROR: DMA PTE for vPFN 0x428f0 already set (to 3f6f0003 not 3f6f0003) ...... As the PTEs are same, so there is no cause of concern, and we can easily avoid the logs-flood for this non-error case. Signed-off-by: Ajay Garg <ajaygargnsit@gmail.com> --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index d75f59ae28e6..8bea8b4e3ff9 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2370,7 +2370,7 @@ __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, * touches the iova range */ tmp = cmpxchg64_local(&pte->val, 0ULL, pteval); - if (tmp) { + if (tmp && (tmp != pteval)) { static int dumps = 5; pr_crit("ERROR: DMA PTE for vPFN 0x%lx already set (to %llx not %llx)\n", iov_pfn, tmp, (unsigned long long)pteval); -- 2.30.2 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2021-10-02 12:40 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-02 12:40 Ajay Garg [this message] 2021-10-02 12:40 ` [PATCH] iommu: intel: remove flooding of non-error logs, when new-DMA-PTE is the same as old-DMA-PTE Ajay Garg 2021-10-02 13:14 ` Lu Baolu 2021-10-02 13:14 ` Lu Baolu 2021-10-02 17:18 ` Ajay Garg 2021-10-02 17:18 ` Ajay Garg 2021-10-04 22:31 ` Alex Williamson 2021-10-04 22:31 ` Alex Williamson 2021-10-07 9:03 ` Ajay Garg 2021-10-07 9:03 ` Ajay Garg 2021-10-10 6:15 ` Ajay Garg 2021-10-10 6:15 ` Ajay Garg 2021-10-11 6:19 ` Ajay Garg 2021-10-11 6:19 ` Ajay Garg 2021-10-11 14:52 ` Alex Williamson 2021-10-11 14:52 ` Alex Williamson 2021-10-11 18:13 ` Ajay Garg 2021-10-11 18:13 ` Ajay Garg 2021-10-12 14:02 ` Ajay Garg 2021-10-12 14:02 ` Ajay Garg
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=20211002124012.18186-1-ajaygargnsit@gmail.com \ --to=ajaygargnsit@gmail.com \ --cc=iommu@lists.linux-foundation.org \ --cc=kvm@vger.kernel.org \ --cc=linux-kernel@vger.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: linkBe 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.