]> git.baikalelectronics.ru Git - kernel.git/commit
dma-debug: Dynamically expand the dma_debug_entry pool
authorRobin Murphy <robin.murphy@arm.com>
Mon, 10 Dec 2018 14:00:29 +0000 (14:00 +0000)
committerChristoph Hellwig <hch@lst.de>
Tue, 11 Dec 2018 13:31:17 +0000 (14:31 +0100)
commit4a87b0710fe2680c1da973b66240f756164ddb49
tree8f224b9fe62c452686c7b781f8a742c78e619605
parentf9cabfb890201c4eda4e76cd1e600a996cded27c
dma-debug: Dynamically expand the dma_debug_entry pool

Certain drivers such as large multi-queue network adapters can use pools
of mapped DMA buffers larger than the default dma_debug_entry pool of
65536 entries, with the result that merely probing such a device can
cause DMA debug to disable itself during boot unless explicitly given an
appropriate "dma_debug_entries=..." option.

Developers trying to debug some other driver on such a system may not be
immediately aware of this, and at worst it can hide bugs if they fail to
realise that dma-debug has already disabled itself unexpectedly by the
time their code of interest gets to run. Even once they do realise, it
can be a bit of a pain to emprirically determine a suitable number of
preallocated entries to configure, short of massively over-allocating.

There's really no need for such a static limit, though, since we can
quite easily expand the pool at runtime in those rare cases that the
preallocated entries are insufficient, which is arguably the least
surprising and most useful behaviour. To that end, refactor the
prealloc_memory() logic a little bit to generalise it for runtime
reallocations as well.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Documentation/DMA-API.txt
kernel/dma/debug.c