linux-stable/kernel/dma
Barry Song b7176c261c dma-contiguous: provide the ability to reserve per-numa CMA
Right now, drivers like ARM SMMU are using dma_alloc_coherent() to get
coherent DMA buffers to save their command queues and page tables. As
there is only one default CMA in the whole system, SMMUs on nodes other
than node0 will get remote memory. This leads to significant latency.

This patch provides per-numa CMA so that drivers like SMMU can get local
memory. Tests show localizing CMA can decrease dma_unmap latency much.
For instance, before this patch, SMMU on node2  has to wait for more than
560ns for the completion of CMD_SYNC in an empty command queue; with this
patch, it needs 240ns only.

A positive side effect of this patch would be improving performance even
further for those users who are worried about performance more than DMA
security and use iommu.passthrough=1 to skip IOMMU. With local CMA, all
drivers can get local coherent DMA buffers.

Also, this patch changes the default CONFIG_CMA_AREAS to 19 in NUMA. As
1+CONFIG_CMA_AREAS should be quite enough for most servers on the market
even they enable both hugetlb_cma and pernuma_cma.
2 numa nodes: 2(hugetlb) + 2(pernuma) + 1(default global cma) = 5
4 numa nodes: 4(hugetlb) + 4(pernuma) + 1(default global cma) = 9
8 numa nodes: 8(hugetlb) + 8(pernuma) + 1(default global cma) = 17

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2020-09-01 09:19:28 +02:00
..
coherent.c dma-coherent: fix integer overflow in the reserved-memory dma allocation 2020-03-16 10:43:02 +01:00
contiguous.c dma-contiguous: provide the ability to reserve per-numa CMA 2020-09-01 09:19:28 +02:00
debug.c dma-debug: remove debug_dma_assert_idle() function 2020-08-14 15:22:43 -07:00
direct.c dma-pool: fix coherent pool allocations for IOMMU mappings 2020-08-14 16:27:00 +02:00
dummy.c dma-mapping: factor out dummy DMA ops 2018-12-13 21:06:12 +01:00
Kconfig dma-contiguous: provide the ability to reserve per-numa CMA 2020-09-01 09:19:28 +02:00
Makefile dma-mapping: make support for dma ops optional 2020-07-19 09:29:23 +02:00
mapping.c dma-mapping: add a dma_ops_bypass flag to struct device 2020-07-19 09:29:29 +02:00
pool.c dma-pool: Fix an uninitialized variable bug in atomic_pool_expand() 2020-08-27 09:22:56 +02:00
remap.c dma-remap: align the size in dma_common_*_remap() 2020-06-23 14:14:41 +02:00
swiotlb.c dma-direct: improve swiotlb error reporting 2020-02-05 18:53:05 +01:00
virt.c dma-mapping: zero memory returned from dma_alloc_* 2018-12-20 08:13:52 +01:00