mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: m.szyprowski@samsung.com, robin.murphy@arm.com
Cc: ailiop@suse.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH v2 2/2] dma-debug: Remove obsolete mapping dump helper
Date: Thu, 19 Nov 2026 15:13:25 +0200	[thread overview]
Message-ID: <8d79f918823590770607279958d16fdd750d5829.1795093513.git.thnkslprpt@gmail.com> (raw)
In-Reply-To: <cover.1795093513.git.thnkslprpt@gmail.com>

debug_dma_dump_mappings() is only called by the legacy AMD GART IOMMU
leak diagnostic. The helper traverses DMA-debug hash buckets even when
DMA debugging was never initialized.

Remove the helper, its declarations and the GART call. Keep the GART
stack trace for diagnosing IOMMU exhaustion.

Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 arch/x86/kernel/amd_gart_64.c |  1 -
 include/linux/dma-map-ops.h   |  4 ----
 kernel/dma/debug.c            | 33 ---------------------------------
 3 files changed, 38 deletions(-)

diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index b5f1f031d45b..965844299a1b 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -157,7 +157,6 @@ static void dump_leak(void)
 	dump = 1;
 
 	show_stack(NULL, NULL, KERN_ERR);
-	debug_dma_dump_mappings(NULL);
 }
 #endif
 
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index afaf2c12189b..eb32ed923455 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -418,14 +418,10 @@ static inline void arch_teardown_dma_ops(struct device *dev)
 
 #ifdef CONFIG_DMA_API_DEBUG
 void dma_debug_add_bus(const struct bus_type *bus);
-void debug_dma_dump_mappings(struct device *dev);
 #else
 static inline void dma_debug_add_bus(const struct bus_type *bus)
 {
 }
-static inline void debug_dma_dump_mappings(struct device *dev)
-{
-}
 #endif /* CONFIG_DMA_API_DEBUG */
 
 extern const struct dma_map_ops dma_dummy_ops;
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 6e554dcfc9b9..f1b6f7b9aa14 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -535,39 +535,6 @@ static void active_cacheline_remove(struct dma_debug_entry *entry)
 	spin_unlock_irqrestore(&radix_lock, flags);
 }
 
-/*
- * Dump mappings entries on kernel space for debugging purposes
- */
-void debug_dma_dump_mappings(struct device *dev)
-{
-	int idx;
-	phys_addr_t cln;
-
-	for (idx = 0; idx < HASH_SIZE; idx++) {
-		struct hash_bucket *bucket = &dma_entry_hash[idx];
-		struct dma_debug_entry *entry;
-		unsigned long flags;
-
-		spin_lock_irqsave(&bucket->lock, flags);
-		list_for_each_entry(entry, &bucket->list, list) {
-			if (!dev || dev == entry->dev) {
-				cln = to_cacheline_number(entry);
-				dev_info(entry->dev,
-					 "%s idx %d P=%pa D=%llx L=%llx cln=%pa %s %s attrs=0x%lx\n",
-					 type2name[entry->type], idx,
-					 &entry->paddr, entry->dev_addr,
-					 entry->size, &cln,
-					 dir2name[entry->direction],
-					 maperr2str[entry->map_err_type],
-					 entry->attrs);
-			}
-		}
-		spin_unlock_irqrestore(&bucket->lock, flags);
-
-		cond_resched();
-	}
-}
-
 /*
  * Dump mappings entries on user space via debugfs
  */
-- 
2.43.0


      parent reply	other threads:[~2026-11-19 13:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 13:13 [PATCH v2 0/2] dma-debug: Avoid uninitialized mapping dumps Avi Weiss
2026-11-19 13:13 ` [PATCH v2 1/2] dma-debug: Skip debugfs registration when uninitialized Avi Weiss
2026-11-19 13:13 ` Avi Weiss [this message]

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=8d79f918823590770607279958d16fdd750d5829.1795093513.git.thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=ailiop@suse.com \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=x86@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

all inboxes | Powered by JetHome®