# RE: \[PATCH v2\] dma-debug: Kconfig for PREALLOC\_DMA\_DEBUG\_ENTRIES

- From: David Laight \<hidden\>
- Date: 2018-12-04 13:36:15 
- List: netdev
- Page: https://ratatoskr.run/netdev/2018/12/5452362
- Thread: https://ratatoskr.run/netdev/2018/11/5449693/t.md

```text
From: Qian Cai
> Sent: 30 November 2018 21:48
> To: hch@lst.de; m.szyprowski@samsung.com; robin.murphy@arm.com
> Cc: <redacted>; <redacted>; <redacted>; <redacted>;
> iommu@lists.linux-foundation.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Qian Cai
> Subject: [PATCH v2] dma-debug: Kconfig for PREALLOC_DMA_DEBUG_ENTRIES
> 
> The amount of DMA mappings from Hisilicon HNS ethernet devices is huge,
> so it could trigger "DMA-API: debugging out of memory - disabling".
> 
> hnae_get_handle [1]
>   hnae_init_queue
>     hnae_init_ring
>       hnae_alloc_buffers [2]
>         debug_dma_map_page
>           dma_entry_alloc
> 
> [1] for (i = 0; i < handle->q_num; i++)
> [2] for (i = 0; i < ring->desc_num; i++)
> 
> Also, "#define HNS_DSAF_MAX_DESC_CNT 1024"
> 
> On this Huawei TaiShan 2280 aarch64 server, it has reached the limit
> already,
> 
> 4 (NICs) x 16 (queues) x 1024 (port descption numbers) = 65536
> 
> Added a Kconfig entry for PREALLOC_DMA_DEBUG_ENTRIES, so make it easier
> for users to deal with special cases like this.

Ugg. That is worse than a module parameter.

The driver needs to automatically reduce the number of mapping requests.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
```
