Skip to contentSkip to conversation

dma-debug: Make things less spammy under memory pressure

PATCH Superseded Rob Clark 3 participants 4 messages May 31, 2022 – Jun 1, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 dma-debug: Make things less spammy under memory pressure

From: Rob Clark <[email protected]>

Ratelimit the error msg to avoid flooding the console.

---
 kernel/dma/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
index f8ff598596b8..683966f0247b 100644
@@ -564,7 +564,7 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs)
 
 	rc = active_cacheline_insert(entry);
 	if (rc == -ENOMEM) {
-		pr_err("cacheline tracking ENOMEM, dma-debug disabled\n");
+		pr_err_ratelimited("cacheline tracking ENOMEM, dma-debug disabled\n");
 		global_disable = true;
 	} else if (rc == -EEXIST && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
 		err_printk(entry->dev, entry,
Signature · 1 line
2.36.1
reviewer
#1 lore raw
Quoted 14 lines · Rob Clark

From: Rob Clark <[email protected]>

Ratelimit the error msg to avoid flooding the console.

---
  kernel/dma/debug.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +0 -0
index f8ff598596b8..683966f0247b 100644

kernel/dma/debug.c static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs) · line 568

Quoted 6 lines
kernel/dma/debug.c +1 -1
@@ -564,7 +564,7 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs)
 
  	rc = active_cacheline_insert(entry);
  	if (rc == -ENOMEM) {
-		pr_err("cacheline tracking ENOMEM, dma-debug disabled\n");
+		pr_err_ratelimited("cacheline tracking ENOMEM, dma-debug disabled\n");
  		global_disable = true;

Given that it's supposed to disable itself entirely if it ever gets here, just how spammy is it exactly?

Thanks,
Robin.

kernel/dma/debug.c static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs) · line 570

Quoted 2 lines
kernel/dma/debug.c +0 -0
  	} else if (rc == -EEXIST && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
  		err_printk(entry->dev, entry,

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author
#2 lore raw
Quoted 17 lines · Robin Murphy
Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

Ratelimit the error msg to avoid flooding the console.

---
  kernel/dma/debug.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +0 -0
index f8ff598596b8..683966f0247b 100644
@@ -564,7 +564,7 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs)
 
Quoted 8 lines

kernel/dma/debug.c static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs) · line 568

Quoted 5 lines
kernel/dma/debug.c +1 -1
      rc = active_cacheline_insert(entry);
      if (rc == -ENOMEM) {
-             pr_err("cacheline tracking ENOMEM, dma-debug disabled\n");
+             pr_err_ratelimited("cacheline tracking ENOMEM, dma-debug disabled\n");
              global_disable = true;

Given that it's supposed to disable itself entirely if it ever gets here, just how spammy is it exactly?

um, quite.. tbf that was in the context of a WIP igt test for shrinker which was trying to cycle thru ~2x RAM size worth of GEM buffers on something like 72 threads. So it could just be threads that had gotten past the dma_debug_disabled() check already before global_disable was set to true?

I guess this could be pr_err_once() instead, then?

BR,
-R

Quoted 5 lines

Thanks,
Robin.

Quoted 2 lines
kernel/dma/debug.c +0 -0
      } else if (rc == -EEXIST && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
              err_printk(entry->dev, entry,
#3 lore raw
Quoted 7 lines · Rob Clark

um, quite.. tbf that was in the context of a WIP igt test for shrinker which was trying to cycle thru ~2x RAM size worth of GEM buffers on something like 72 threads. So it could just be threads that had gotten past the dma_debug_disabled() check already before global_disable was set to true?

I guess this could be pr_err_once() instead, then?

Yes, we could use pr_err_once to reduce the chattyness while still keeping global_disable to disable all the actual tracking.