• Robin Murphy's avatar
    dma-debug: Dynamically expand the dma_debug_entry pool · 2b9d9ac0
    Robin Murphy authored
    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: default avatarRobin Murphy <robin.murphy@arm.com>
    Tested-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    2b9d9ac0
debug.c 46.2 KB