Module: Mesa
Branch: main
Commit: c9adcb605103d248dee991492939489478fbb8bd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9adcb605103d248dee991492939489478fbb8bd

Author: Tomeu Vizoso <[email protected]>
Date:   Fri Dec 17 14:57:27 2021 +0100

anv/tests: Free BO cache and device mutex

Was getting ASAN errors in CI when trying to add ANV to the
debian-testing job:

==10993==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4194304 byte(s) in 64 object(s) allocated from:
    #0 0x7f763c1bda3c in __interceptor_posix_memalign 
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:226
    #1 0x55f43d28627f in os_malloc_aligned ../src/util/os_memory_aligned.h:58
    #2 0x55f43d28627f in _util_sparse_array_node_alloc 
../src/util/sparse_array.c:107
    #3 0x55f43d28627f in util_sparse_array_get ../src/util/sparse_array.c:143
    #4 0x55f43d1fdaba in anv_device_lookup_bo 
../src/intel/vulkan/anv_private.h:1335
    #5 0x55f43d1fdaba in anv_device_import_bo_from_host_ptr 
../src/intel/vulkan/anv_allocator.c:1843
    #6 0x55f43d1ff571 in anv_block_pool_expand_range 
../src/intel/vulkan/anv_allocator.c:534
    #7 0x55f43d1ffcb5 in anv_block_pool_init 
../src/intel/vulkan/anv_allocator.c:417
    #8 0x55f43d18f082 in run_test 
../src/intel/vulkan/tests/block_pool_no_free.c:123
    #9 0x55f43d1862b6 in main ../src/intel/vulkan/tests/block_pool_no_free.c:152
    #10 0x7f763b942d09 in __libc_start_main ../csu/libc-start.c:308

Signed-off-by: Tomeu Vizoso <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14121>

---

 src/intel/vulkan/tests/block_pool_grow_first.c     | 2 ++
 src/intel/vulkan/tests/block_pool_no_free.c        | 1 +
 src/intel/vulkan/tests/state_pool.c                | 1 +
 src/intel/vulkan/tests/state_pool_free_list_only.c | 1 +
 src/intel/vulkan/tests/state_pool_no_free.c        | 1 +
 src/intel/vulkan/tests/state_pool_padding.c        | 2 ++
 6 files changed, 8 insertions(+)

diff --git a/src/intel/vulkan/tests/block_pool_grow_first.c 
b/src/intel/vulkan/tests/block_pool_grow_first.c
index a993fda48a8..d2d2b4f4a99 100644
--- a/src/intel/vulkan/tests/block_pool_grow_first.c
+++ b/src/intel/vulkan/tests/block_pool_grow_first.c
@@ -63,4 +63,6 @@ int main(void)
    memset(map, 22, block_size);
 
    anv_block_pool_finish(&pool);
+   anv_bo_cache_finish(&device.bo_cache);
+   pthread_mutex_destroy(&device.mutex);
 }
diff --git a/src/intel/vulkan/tests/block_pool_no_free.c 
b/src/intel/vulkan/tests/block_pool_no_free.c
index e2c99e97e64..f7cc85e6be3 100644
--- a/src/intel/vulkan/tests/block_pool_no_free.c
+++ b/src/intel/vulkan/tests/block_pool_no_free.c
@@ -143,6 +143,7 @@ static void run_test()
    validate_monotonic(block_ptrs);
 
    anv_block_pool_finish(&pool);
+   anv_bo_cache_finish(&device.bo_cache);
    pthread_mutex_destroy(&device.mutex);
 }
 
diff --git a/src/intel/vulkan/tests/state_pool.c 
b/src/intel/vulkan/tests/state_pool.c
index 30180cc7bb8..0b685ca4962 100644
--- a/src/intel/vulkan/tests/state_pool.c
+++ b/src/intel/vulkan/tests/state_pool.c
@@ -55,5 +55,6 @@ int main(void)
       anv_state_pool_finish(&state_pool);
    }
 
+   anv_bo_cache_finish(&device.bo_cache);
    pthread_mutex_destroy(&device.mutex);
 }
diff --git a/src/intel/vulkan/tests/state_pool_free_list_only.c 
b/src/intel/vulkan/tests/state_pool_free_list_only.c
index 8d27f652f14..b5e5146287b 100644
--- a/src/intel/vulkan/tests/state_pool_free_list_only.c
+++ b/src/intel/vulkan/tests/state_pool_free_list_only.c
@@ -64,5 +64,6 @@ int main(void)
    run_state_pool_test(&state_pool);
 
    anv_state_pool_finish(&state_pool);
+   anv_bo_cache_finish(&device.bo_cache);
    pthread_mutex_destroy(&device.mutex);
 }
diff --git a/src/intel/vulkan/tests/state_pool_no_free.c 
b/src/intel/vulkan/tests/state_pool_no_free.c
index b8446863f46..04245464e79 100644
--- a/src/intel/vulkan/tests/state_pool_no_free.c
+++ b/src/intel/vulkan/tests/state_pool_no_free.c
@@ -109,6 +109,7 @@ static void run_test()
    }
 
    anv_state_pool_finish(&state_pool);
+   anv_bo_cache_finish(&device.bo_cache);
    pthread_mutex_destroy(&device.mutex);
 }
 
diff --git a/src/intel/vulkan/tests/state_pool_padding.c 
b/src/intel/vulkan/tests/state_pool_padding.c
index d6703cf315f..54e8bc9cde8 100644
--- a/src/intel/vulkan/tests/state_pool_padding.c
+++ b/src/intel/vulkan/tests/state_pool_padding.c
@@ -75,4 +75,6 @@ int main(void)
    ASSERT(state.offset == pool_size);
 
    anv_state_pool_finish(&state_pool);
+   anv_bo_cache_finish(&device.bo_cache);
+   pthread_mutex_destroy(&device.mutex);
 }

Reply via email to