Skip to contentSkip to conversation

swiotlb: suppress warning when __GFP_NOWARN is set.

PATCH In review Christian König 3 participants 3 messages Dec 19, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swiotlb: suppress warning when __GFP_NOWARN is set.

TTM tries to allocate coherent memory in chunks of 2MB first to improve TLB efficiency and falls back to allocating 4K pages if that fails.

Suppress the warning when the 2MB allocations fails since there is a valid fall back path.

---
 lib/swiotlb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
lib/swiotlb.c +5 -3
index cea19aaf303c..63a44fb29ce6 100644
@@ -769,9 +769,11 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
 	return ret;
 
 err_warn:
-	pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n",
-		dev_name(hwdev), size);
-	dump_stack();
+	if (!(flags & __GFP_NOWARN)) {
+		pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n",
+			dev_name(hwdev), size);
+		dump_stack();
+	}
 
 	return NULL;
 }
Signature · 1 line
2.11.0
#1 lore raw
Quoted 7 lines · Christian König

TTM tries to allocate coherent memory in chunks of 2MB first to improve TLB efficiency and falls back to allocating 4K pages if that fails.

Suppress the warning when the 2MB allocations fails since there is a valid fall back path.

Is there an Reported by or such needed?

Quoted 20 lines

---
lib/swiotlb.c | 8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)
lib/swiotlb.c +0 -0
index cea19aaf303c..63a44fb29ce6 100644
@@ -769,9 +769,11 @@ swiotlb_alloc_coherent(struct device *hwdev,
 size_t size,
 	return ret;
 

err_warn:

lib/swiotlb.c +0 -1
-	pr_warn("swiotlb: coherent allocation failed for device %s

size=%zu\n",

lib/swiotlb.c +2 -2
-		dev_name(hwdev), size);
-	dump_stack();
+	if (!(flags & __GFP_NOWARN)) {
+		pr_warn("swiotlb: coherent allocation failed for device %s

size=%zu\n",

lib/swiotlb.c swiotlb_alloc_coherent(struct device *hwdev, size_t size, · line 776

Quoted 3 lines
lib/swiotlb.c +3 -0
+			dev_name(hwdev), size);
+		dump_stack();
+	}

Ok, let me queue it up.

Quoted 3 lines
	return NULL;
}
#2 lore raw

Am 19.12.2017 um 15:52 schrieb Konrad Rzeszutek Wilk:

Quoted 9 lines · Christian König
Quoted 7 lines

TTM tries to allocate coherent memory in chunks of 2MB first to improve TLB efficiency and falls back to allocating 4K pages if that fails.

Suppress the warning when the 2MB allocations fails since there is a valid fall back path.

Is there an Reported by or such needed?

Sorry my fault not to include that.

Quoted 12 lines
Quoted 12 lines

---
lib/swiotlb.c | 8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)
lib/swiotlb.c +0 -0
index cea19aaf303c..63a44fb29ce6 100644
@@ -769,9 +769,11 @@ swiotlb_alloc_coherent(struct device *hwdev,
 size_t size,
 	return ret;
 
Quoted 12 lines

lib/swiotlb.c swiotlb_alloc_coherent(struct device *hwdev, size_t size, · line 776

Quoted 11 lines

err_warn:

lib/swiotlb.c +0 -1
-	pr_warn("swiotlb: coherent allocation failed for device %s

size=%zu\n",

lib/swiotlb.c +2 -2
-		dev_name(hwdev), size);
-	dump_stack();
+	if (!(flags & __GFP_NOWARN)) {
+		pr_warn("swiotlb: coherent allocation failed for device %s

size=%zu\n",

lib/swiotlb.c +3 -0
+			dev_name(hwdev), size);
+		dump_stack();
+	}

Ok, let me queue it up.

Thanks,
Christian.

Quoted 2 lines
Quoted 2 lines
	return NULL;
}