Skip to contentSkip to conversation

swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit

PATCH In review Christoph Hellwig 3 participants 4 messages Jan 14, 2019 – Jan 16, 2019 3 messages not in the archive DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit

Otherwise is_swiotlb_buffer will return false positives when we first initialize a swiotlb buffer, but then free it because we have an IOMMU available.

Fixes 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
---
 kernel/dma/swiotlb.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/dma/swiotlb.c +2 -0
index d6361776dc5c..1fb6fd68b9c7 100644
@@ -378,6 +378,8 @@ void __init swiotlb_exit(void)
 		memblock_free_late(io_tlb_start,
 				   PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
 	}
+	io_tlb_start = 0;
+	io_tlb_end = 0;
 	io_tlb_nslabs = 0;
 	max_segment = 0;
 }
Signature · 1 line
2.20.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 8 lines · Christoph Hellwig

Otherwise is_swiotlb_buffer will return false positives when we first initialize a swiotlb buffer, but then free it because we have an IOMMU available.

Fixes 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")

Thank you!

Quoted 20 lines
---
 kernel/dma/swiotlb.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/dma/swiotlb.c +2 -0
index d6361776dc5c..1fb6fd68b9c7 100644
@@ -378,6 +378,8 @@ void __init swiotlb_exit(void)
 		memblock_free_late(io_tlb_start,
 				   PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
 	}
+	io_tlb_start = 0;
+	io_tlb_end = 0;
 	io_tlb_nslabs = 0;
 	max_segment = 0;
 }
Signature · 1 line
2.20.1

A message that is not in the archive (sent off-list or not yet received): 20190114202513.GG32038-he5eyhs8q0BAdwtm4QZOy9BPR1lH4CV8@public.gmane.org

#4 lore raw
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Christoph Hellwig

Otherwise is_swiotlb_buffer will return false positives when we first initialize a swiotlb buffer, but then free it because we have an IOMMU available.

Fixes 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")

Do you want to send this to Linus, or do you want me to pick it up through the dma-mapping tree?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Christoph Hellwig

Otherwise is_swiotlb_buffer will return false positives when we first initialize a swiotlb buffer, but then free it because we have an IOMMU available.

Fixes 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
Quoted 4 lines
Quoted 1 line

Do you want to send this to Linus, or do you want me to pick it up through the dma-mapping tree?

I will do it. Thanks!