RE: [PATCH v2] dma-debug: Kconfig for PREALLOC_DMA_DEBUG_ENTRIES

From: David Laight
Date: Tue Dec 04 2018 - 08:36:15 EST


From: Qian Cai
> Sent: 30 November 2018 21:48
> To: hch@xxxxxx; m.szyprowski@xxxxxxxxxxx; robin.murphy@xxxxxxx
> Cc: yisen.zhuang@xxxxxxxxxx; salil.mehta@xxxxxxxxxx; john.garry@xxxxxxxxxx; linuxarm@xxxxxxxxxx;
> iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; 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)