qcacmn: Add debug version of qdf_mem_multi_pages_alloc/free

Under memory debug, qdf_mem_multi_pages_alloc function is getting
reported as the culprit of memory leaks when there is no associated
qdf_mem_multi_pages_free call. qdf_mem_multi_pages_alloc is
just an allocator function which uses qdf_mem_malloc internally to
serve the requested allocation and is not the actual source of the leak.
As there are multiple users of qdf_mem_multi_pages_alloc in the code base,
add memory debug versions of qdf_mem_multi_pages_alloc/free to track the
actual users of the allocations.

Change-Id: I8b2159de842a3c5d7f9cdb244ca148cf6df37d0d
CRs-Fixed: 2474749
This commit is contained in:
Shiva Krishna Pittala
2019-06-19 15:35:18 +05:30
committed by nshrivas
parent 5372d55f63
commit 1529d99839
2 changed files with 220 additions and 38 deletions

View File

@@ -128,6 +128,28 @@ void qdf_mem_free_debug(void *ptr, const char *file, uint32_t line);
#define qdf_mem_free(ptr) \
qdf_mem_free_debug(ptr, __func__, __LINE__)
void qdf_mem_multi_pages_alloc_debug(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
size_t element_size, uint16_t element_num,
qdf_dma_context_t memctxt, bool cacheable,
const char *func, uint32_t line,
void *caller);
#define qdf_mem_multi_pages_alloc(osdev, pages, element_size, element_num,\
memctxt, cacheable) \
qdf_mem_multi_pages_alloc_debug(osdev, pages, element_size, \
element_num, memctxt, cacheable, \
__func__, __LINE__, QDF_RET_IP)
void qdf_mem_multi_pages_free_debug(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
qdf_dma_context_t memctxt, bool cacheable,
const char *func, uint32_t line);
#define qdf_mem_multi_pages_free(osdev, pages, memctxt, cacheable) \
qdf_mem_multi_pages_free_debug(osdev, pages, memctxt, cacheable, \
__func__, __LINE__)
/**
* qdf_mem_check_for_leaks() - Assert that the current memory domain is empty
*
@@ -257,6 +279,15 @@ void qdf_mem_free_consistent(qdf_device_t osdev, void *dev,
qdf_size_t size, void *vaddr,
qdf_dma_addr_t paddr, qdf_dma_context_t memctx);
void qdf_mem_multi_pages_alloc(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
size_t element_size, uint16_t element_num,
qdf_dma_context_t memctxt, bool cacheable);
void qdf_mem_multi_pages_free(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
qdf_dma_context_t memctxt, bool cacheable);
#endif /* MEMORY_DEBUG */
/**
@@ -504,13 +535,6 @@ void qdf_mem_dma_sync_single_for_cpu(qdf_device_t osdev,
qdf_size_t size,
__dma_data_direction direction);
void qdf_mem_multi_pages_alloc(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
size_t element_size, uint16_t element_num,
qdf_dma_context_t memctxt, bool cacheable);
void qdf_mem_multi_pages_free(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
qdf_dma_context_t memctxt, bool cacheable);
int qdf_mem_multi_page_link(qdf_device_t osdev,
struct qdf_mem_multi_page_t *pages,
uint32_t elem_size, uint32_t elem_count, uint8_t cacheable);