Skip to contentSkip to conversation

swiotlb: add kernel error message to track iobtlb overflow buffer usage

PATCH In review Shuah Khan 2 participants 4 messages Sep 1, 2012 – Sep 5, 2012 Library code

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

PATCH 1/1 swiotlb: add kernel error message to track iobtlb overflow buffer usage

Add kernel error message to track iotlb overflow buffer triggers to understand how often the overflow buffer gets used.

---
 lib/swiotlb.c |    1 +
 1 file changed, 1 insertion(+)
lib/swiotlb.c +1 -0
index 45bc1f8..597d7b9 100644
@@ -682,6 +682,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
 	if (!map) {
 		swiotlb_full(dev, size, dir, 1);
 		map = io_tlb_overflow_buffer;
+		dev_err(dev, "SWIOTLB is full. Mapping overflow buffer.\n");
 	}
 
 	dev_addr = swiotlb_virt_to_bus(dev, map);
Signature · 1 line
1.7.9.5
author
#1 lore raw
Quoted 2 lines · Shuah Khan

Add kernel error message to track iotlb overflow buffer triggers to understand how often the overflow buffer gets used.

Does this change look reasonable? My intent is to be able to assess how often the overflow buffer usage gets triggered.

-- Shuah

Quoted 18 lines
---
 lib/swiotlb.c |    1 +
 1 file changed, 1 insertion(+)
lib/swiotlb.c +1 -0
index 45bc1f8..597d7b9 100644
@@ -682,6 +682,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
 	if (!map) {
 		swiotlb_full(dev, size, dir, 1);
 		map = io_tlb_overflow_buffer;
+		dev_err(dev, "SWIOTLB is full. Mapping overflow buffer.\n");
 	}
 
 	dev_addr = swiotlb_virt_to_bus(dev, map);
maintainer
#2 lore raw
In reply to Shuah Khan
Quoted 13 lines · On Fri, 31 Aug 2012 18:55:59 -0600 Shuah Khan <[email protected]> wrote:

Add kernel error message to track iotlb overflow buffer triggers to understand how often the overflow buffer gets used.

---
 lib/swiotlb.c |    1 +
 1 file changed, 1 insertion(+)
lib/swiotlb.c +0 -0
index 45bc1f8..597d7b9 100644

lib/swiotlb.c dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, · line 688

Quoted 7 lines
lib/swiotlb.c +1 -0
@@ -682,6 +682,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
 	if (!map) {
 		swiotlb_full(dev, size, dir, 1);
 		map = io_tlb_overflow_buffer;
+		dev_err(dev, "SWIOTLB is full. Mapping overflow buffer.\n");
 	}
 
 	dev_addr = swiotlb_virt_to_bus(dev, map);

hm. I would view this as a developer-only debugging thing which shouldn't be present in production code. Plus there's a potential that some poor person will have his logs flooded with this message.

A more typical way of handling this would be to increment a stats counter, accessible in procfs or debugfs.

author
#3 lore raw
Quoted 22 lines · Andrew Morton
Quoted 19 lines · On Fri, 31 Aug 2012 18:55:59 -0600 Shuah Khan <[email protected]> wrote:

Add kernel error message to track iotlb overflow buffer triggers to understand how often the overflow buffer gets used.

---
 lib/swiotlb.c |    1 +
 1 file changed, 1 insertion(+)
lib/swiotlb.c +1 -0
index 45bc1f8..597d7b9 100644
@@ -682,6 +682,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
 	if (!map) {
 		swiotlb_full(dev, size, dir, 1);
 		map = io_tlb_overflow_buffer;
+		dev_err(dev, "SWIOTLB is full. Mapping overflow buffer.\n");
 	}
 
Quoted 5 lines

lib/swiotlb.c dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, · line 688

Quoted 1 line
lib/swiotlb.c +0 -0
 	dev_addr = swiotlb_virt_to_bus(dev, map);

hm. I would view this as a developer-only debugging thing which shouldn't be present in production code. Plus there's a potential that some poor person will have his logs flooded with this message.

Yes. I agree.

Quoted 4 lines

A more typical way of handling this would be to increment a stats counter, accessible in procfs or debugfs.

Right. I will work on it. Maybe there is a way to combine this with dma-debug dma mapping error tracking work I am doing - will look into.

-- Shuah