ci: Use a dlclose-disabling preload library for leak checking in Vulkan.
authorEmma Anholt <emma@anholt.net>
Wed, 15 Dec 2021 22:47:06 +0000 (14:47 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 27 Jan 2022 23:47:46 +0000 (23:47 +0000)
For GL, we disable the dlclose() call on the driver in asan builds so that
leak reports get proper backtraces.  For Vulkan, the dlclose() happens
from libvulkan so you need a bigger hammer to keep our drivers loaded.

Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14235>

13 files changed:
.gitlab-ci.yml
.gitlab-ci/test-source-dep.yml
meson.build
meson_options.txt
src/freedreno/ci/deqp-freedreno-a630-vk-asan.toml [new file with mode: 0644]
src/freedreno/ci/freedreno-a630-asan-skips.txt [new file with mode: 0644]
src/freedreno/ci/gitlab-ci.yml
src/gallium/frontends/lavapipe/ci/gitlab-ci.yml
src/gallium/frontends/lavapipe/ci/lvp-asan-fails.txt
src/gallium/frontends/lavapipe/ci/lvp-asan-skips.txt
src/tool/dlclose-skip/dlclose-skip.c [new file with mode: 0644]
src/tool/dlclose-skip/meson.build [new file with mode: 0644]
src/tool/meson.build

index 1a963f3..d33dcf5 100644 (file)
@@ -771,6 +771,7 @@ debian-testing-asan:
     EXTRA_OPTION: >
       -D b_sanitize=address
       -D valgrind=false
+      -D tools=dlclose-skip
     MINIO_ARTIFACT_NAME: ""
     ARTIFACTS_DEBUG_SYMBOLS: 1
 
@@ -1035,6 +1036,7 @@ debian-arm64-asan:
       -D llvm=disabled
       -D b_sanitize=address
       -D valgrind=false
+      -D tools=dlclose-skip
     ARTIFACTS_DEBUG_SYMBOLS: 1
     MINIO_ARTIFACT_NAME: mesa-arm64-asan
     MESON_TEST_ARGS: "--no-suite mesa:compiler"
@@ -1389,7 +1391,7 @@ debian-mingw32-x86_64:
 
 .baremetal-arm64-asan-test:
   variables:
-    DEQP_RUNNER_OPTIONS: "--env LD_PRELOAD=libasan.so.6"
+    DEQP_RUNNER_OPTIONS: "--env LD_PRELOAD=libasan.so.6:/install/lib/libdlclose-skip.so"
     MINIO_ARTIFACT_NAME: mesa-arm64-asan
   needs:
     - debian/arm_test
index 788d46b..ae5191a 100644 (file)
@@ -41,6 +41,7 @@
       - src/mesa/vbo/**/*
       - src/mesa/x86/**/*
       - src/mesa/x86-64/**/*
+      - src/tool/**/*
       - src/util/**/*
 
 .vulkan-rules:
index 94bbfd3..bca6b1f 100644 (file)
@@ -73,6 +73,7 @@ with_tools = get_option('tools')
 if with_tools.contains('all')
   with_tools = [
     'drm-shim',
+    'dlclose-skip',
     'etnaviv',
     'freedreno',
     'glsl',
index 00205d1..1f6ef38 100644 (file)
@@ -417,7 +417,7 @@ option(
   'tools',
   type : 'array',
   value : [],
-  choices : ['drm-shim', 'etnaviv', 'freedreno', 'glsl', 'intel', 'intel-ui', 'nir', 'nouveau', 'xvmc', 'lima', 'panfrost', 'asahi', 'all'],
+  choices : ['drm-shim', 'etnaviv', 'freedreno', 'glsl', 'intel', 'intel-ui', 'nir', 'nouveau', 'xvmc', 'lima', 'panfrost', 'asahi', 'all', 'dlclose-skip'],
   description : 'List of tools to build. (Note: `intel-ui` selects `intel`)',
 )
 option(
diff --git a/src/freedreno/ci/deqp-freedreno-a630-vk-asan.toml b/src/freedreno/ci/deqp-freedreno-a630-vk-asan.toml
new file mode 100644 (file)
index 0000000..9ca8833
--- /dev/null
@@ -0,0 +1,17 @@
+# Basic test set
+[[deqp]]
+deqp = "/deqp/external/vulkancts/modules/vulkan/deqp-vk"
+caselists = ["/deqp/mustpass/vk-master.txt"]
+skips = ["install/freedreno-a630-premerge-skips.txt", "install/freedreno-a630-asan-skips.txt"]
+fraction = 1000
+renderer_check = "Turnip Adreno .* 630"
+
+# Force the spiller on one test so we see its memory usage.
+[[deqp]]
+deqp = "/deqp/external/vulkancts/modules/vulkan/deqp-vk"
+caselists = ["/deqp/mustpass/vk-master.txt"]
+skips = ["install/freedreno-a630-premerge-skips.txt", "install/freedreno-a630-asan-skips.txt"]
+include = ["dEQP-VK.graphicsfuzz.barrier-in-loop-with-break"]
+prefix = "spill-"
+[deqp.env]
+IR3_SHADER_DEBUG = "spillall"
diff --git a/src/freedreno/ci/freedreno-a630-asan-skips.txt b/src/freedreno/ci/freedreno-a630-asan-skips.txt
new file mode 100644 (file)
index 0000000..11eb12d
--- /dev/null
@@ -0,0 +1,2 @@
+# Leaky in VK-GL-cts
+dEQP-VK.binding_model
index 2cbc5fa..0d3bfa3 100644 (file)
@@ -238,13 +238,8 @@ a630_vk_asan:
     - .baremetal-arm64-asan-test
     - .test-manual
   variables:
-    DEQP_EXPECTED_RENDERER: "Turnip Adreno (TM) 630"
-    DEQP_FRACTION: 100
-    FDO_CI_CONCURRENT: 4 # We get OOMkills if we go too wide with asan enabled
-    TU_DEBUG: forcebin
-    # Disable the leak checks, since the library gets dlclose()d and thus get
-    # totally useless leak reports.  We can still catch buffer overflows.
-    ASAN_OPTIONS: "detect_leaks=0"
+    DEQP_SUITE: freedreno-a630-vk-asan
+    FDO_CI_CONCURRENT: 2 # We get OOMkills if we go too wide with asan enabled
 
 a630_piglit:
   extends:
index 45efdc9..5fe45d8 100644 (file)
@@ -28,11 +28,10 @@ lavapipe-vk-asan:
     - .lavapipe-test
   variables:
     GPU_VERSION: lvp-asan
-    DEQP_FRACTION: 50
-    DEQP_RUNNER_OPTIONS: "--env LD_PRELOAD=libasan.so.6"
-    # Disable the leak checks, since the library gets dlclose()d and thus get
-    # totally useless leak reports.  We can still catch buffer overflows.
-    ASAN_OPTIONS: "detect_leaks=0"
+    DEQP_FRACTION: 1000
+    # Skip dlclose so that we get good backtraces of the leaks.
+    # Don't batch the tests into caselists while we're leaky.
+    DEQP_RUNNER_OPTIONS: "--env LD_PRELOAD=libasan.so.6:libdlclose-skip.so --tests-per-group 1"
   needs:
     - debian/x86_test-vk
     - debian-testing-asan
index 45d0718..6493c58 100644 (file)
@@ -1,2 +1,57 @@
 dEQP-VK.glsl.builtin.precision.pow.highp.vec2,Fail
 dEQP-VK.glsl.texture_functions.query.texturequerylod.sampler2d_fixed_fragment,Fail
+
+# Memory leaks
+dEQP-VK.glsl.derivate.dfdxcoarse.texture.basic.float_highp,Fail
+dEQP-VK.glsl.texture_gather.basic.cube.rgba8i.size_npot.mirrored_repeat_clamp_to_edge,Fail
+dEQP-VK.glsl.texture_gather.offsets.min_required_offset.2d.rgba8.texture_swizzle.alpha_zero_one_red,Fail
+dEQP-VK.image.mutable.2d.b8g8r8a8_srgb_r16g16_sfloat_draw_texture,Fail
+dEQP-VK.image.mutable.2d.r8g8b8a8_uint_r16g16_sint_clear_texture,Fail
+dEQP-VK.image.texel_view_compatible.graphic.extended.3d_image.texture_read.bc6h_ufloat_block.r32g32b32a32_uint,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.1d.format.r16_uint.count_1.size.128x1,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.1d_array.format.r32_uint.count_1.size.32x1_array_of_6,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.2d_array.format.r16g16_snorm.count_1.size.8x16_array_of_6,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.3d.format.r32g32b32_sfloat.count_1.size.8x16x32,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.cube_array.format.r16g16_sfloat.count_1.size.13x13_array_of_36,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.1d.format.a2r10g10b10_uint_pack32.count_1.size.13x1,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.1d_array.format.r8g8_uint.count_1.size.13x1_array_of_6,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.2d.format.r16_unorm.count_1.size.2x2,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.3d.format.r32_sfloat.count_1.size.2x2x2,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.3d.format.r8g8_snorm.count_1.size.5x11x17,Fail
+dEQP-VK.pipeline.image.suballocation.sampling_type.separate.view_type.cube_array.format.a1r5g5b5_unorm_pack16.count_1.size.32x32_array_of_36,Fail
+dEQP-VK.pipeline.image_view.view_type.1d.format.r8g8b8a8_sint.subresource_range.array_layer_last_remaining_layers,Fail
+dEQP-VK.pipeline.image_view.view_type.2d_array.format.r32_sfloat.subresource_range.base_array_layer_remaining_layers,Fail
+dEQP-VK.pipeline.image_view.view_type.3d.format.r8_unorm.subresource_range.lod_base_mip_level_single_array_layer_remaining_levels_and_layers,Fail
+dEQP-VK.pipeline.image_view.view_type.cube.format.r16g16_unorm.subresource_range.array_layer_last,Fail
+dEQP-VK.pipeline.image_view.view_type.cube_array.format.a2r10g10b10_uint_pack32.subresource_range.base_array_layer,Fail
+dEQP-VK.pipeline.sampler.exact_sampling.r8g8_uint.gradient.unnormalized_coords.edge_right,Fail
+dEQP-VK.pipeline.sampler.view_type.1d_array.format.b10g11r11_ufloat_pack32.address_modes.all_mode_clamp_to_border_transparent_black,Fail
+dEQP-VK.pipeline.sampler.view_type.1d_array.format.r32_sfloat.mag_reduce.comp_r_g_b_a.min,Fail
+dEQP-VK.pipeline.sampler.view_type.1d_unnormalized.format.r8_sint.address_modes.uvw_mode_clamp_to_edge_mode_clamp_to_border_mode_repeat,Fail
+dEQP-VK.pipeline.sampler.view_type.2d.format.b5g5r5a1_unorm_pack16.address_modes.uvw_mode_repeat_mode_mirror_clamp_to_edge_mode_mirror_clamp_to_edge,Fail
+dEQP-VK.pipeline.sampler.view_type.2d.format.b8g8r8a8_unorm.mipmap.nearest.lod.select_bias_2_5,Fail
+dEQP-VK.pipeline.sampler.view_type.3d.format.a2b10g10r10_unorm_pack32.address_modes.all_mode_clamp_to_border_custom_1011,Fail
+dEQP-VK.pipeline.sampler.view_type.3d.format.r16g16_sint.address_modes.uvw_mode_clamp_to_edge_mode_repeat_mode_mirror_clamp_to_edge,Fail
+dEQP-VK.pipeline.sampler.view_type.3d.format.r8g8_snorm.mipmap.linear.lod.select_bias_3_1,Fail
+dEQP-VK.pipeline.sampler.view_type.3d.format.r8g8b8a8_snorm.mipmap.nearest.lod.select_bias_2_1,Fail
+dEQP-VK.pipeline.sampler.view_type.cube.format.r16_snorm.min_reduce.comp_r_g_b_a.min,Fail
+dEQP-VK.pipeline.sampler.view_type.cube_array.format.r8g8b8a8_unorm.mipmap.nearest.lod.equal_min_3_max_3,Fail
+dEQP-VK.renderpass.dedicated_allocation.formats.a8b8g8r8_unorm_pack32.input.dont_care.store.self_dep_clear_draw_use_input_aspect,Fail
+dEQP-VK.renderpass.dedicated_allocation.formats.d24_unorm_s8_uint.input.clear.dont_care.clear_draw_depth_read_only,Fail
+dEQP-VK.renderpass.dedicated_allocation.formats.r32_uint.input.load.store.clear_draw_use_input_aspect,Fail
+dEQP-VK.renderpass.suballocation.formats.d16_unorm.input.dont_care.dont_care.draw,Fail
+dEQP-VK.renderpass.suballocation.formats.r16g16b16a16_uint.input.load.store.clear_draw_use_input_aspect,Fail
+dEQP-VK.renderpass.suballocation.formats.r8g8b8a8_uint.input.dont_care.store.self_dep_clear_draw_use_input_aspect,Fail
+dEQP-VK.renderpass.suballocation.multisample.r8g8_uint.samples_4,Fail
+dEQP-VK.renderpass2.dedicated_allocation.formats.r16g16b16a16_unorm.input.load.store.clear_draw,Fail
+dEQP-VK.renderpass2.suballocation.formats.d32_sfloat.input.clear.dont_care.clear_draw,Fail
+dEQP-VK.renderpass2.suballocation.formats.r8g8_unorm.input.dont_care.dont_care.self_dep_clear_draw,Fail
+dEQP-VK.renderpass2.suballocation.multisample_resolve.r32g32b32a32_uint.max_attachments_8_samples_4,Fail
+dEQP-VK.synchronization.op.single_queue.binary_semaphore.write_image_compute_indirect_read_image_vertex.image_128_r32_uint,Fail
+dEQP-VK.synchronization.op.single_queue.event.write_image_compute_read_image_fragment.image_128x128_r16g16b16a16_uint,Fail
+dEQP-VK.synchronization.op.single_queue.timeline_semaphore.write_image_tess_control_read_image_vertex.image_128x128_r16g16b16a16_uint,Fail
+dEQP-VK.synchronization.timeline_semaphore.device_host.write_copy_buffer_to_image_read_image_fragment.image_128_r32_uint,Fail
+dEQP-VK.synchronization.timeline_semaphore.one_to_n.write_copy_image_to_buffer_read_ssbo_compute.buffer_262144,Fail
+dEQP-VK.synchronization.timeline_semaphore.wait_before_signal.write_copy_image_read_image_tess_control.image_64x64x8_r32_sfloat,Fail
+dEQP-VK.texture.swizzle.component_mapping.r8g8_unorm_2d_npot_oooo,Fail
+dEQP-VK.texture.swizzle.texture_coordinate.r16g16b16a16_snorm_2d_npot_xx,Fail
index 0cfdf78..dd10c11 100644 (file)
@@ -9,3 +9,6 @@ dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast.*
 dEQP-VK.ssbo.layout.3_level_unsized_array.scalar.*
 dEQP-VK.ssbo.layout.3_level_array.scalar.*
 dEQP-VK.ssbo.phys.layout.unsized_struct_array.per_block_buffer.*_instance_array_comp_access_store_cols
+
+# Leaky in VK-GL-cts
+dEQP-VK.binding_model
diff --git a/src/tool/dlclose-skip/dlclose-skip.c b/src/tool/dlclose-skip/dlclose-skip.c
new file mode 100644 (file)
index 0000000..6a77f26
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2021 Google LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <dlfcn.h>
+
+int dlclose(void *handle)
+{
+    /* do nothing */
+    return 0;
+}
diff --git a/src/tool/dlclose-skip/meson.build b/src/tool/dlclose-skip/meson.build
new file mode 100644 (file)
index 0000000..96e3de2
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright © 2021 Google LLC
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+shared_library('dlclose-skip',
+  'dlclose-skip.c',
+  install : true,
+)
index 1844a9b..826eeb0 100644 (file)
@@ -6,3 +6,7 @@
 if with_perfetto
   subdir('pps')
 endif
+
+if with_tools.contains('dlclose-skip')
+  subdir('dlclose-skip')
+endif