[Vulkan][Linux][Mesa] SIGBUS, Bus error.

[Vulkan][Linux][Mesa] SIGBUS, Bus error.

My system: Linux archlinux 4.15.6-1-ARCH #1 SMP PREEMPT Sun Feb 25 12:53:23 UTC 2018 x86_64 GNU/Linux
My graphics: Intel(R) HD Graphics 630 (Kaby Lake GT2)
My vulkaninfo: https://pastebin.com/b38SHK6Z
Problematic function: https://pastebin.com/vN2WjA1W

I turned on validation layers and got no errors during device creation, swapchain creation, etc. Then my scene loader loads 71961 objects and every one of them has corresponding secondary command buffer. The error "Program received signal SIGBUS, Bus error." happens inside vkCmdDrawIndexed() when recording 32765th command buffer. What is the possible cause?

Error happens inside libvulkan_intel.so:
0  in ?? of /usr/lib/libvulkan_intel.so
1  in ?? of /usr/lib/libvulkan_intel.so
2  in ?? of /usr/lib/libvulkan_intel.so
3  in ?? of /usr/lib/libvulkan_intel.so
4  in ?? of /usr/lib/libVkLayer_core_validation.so
5  in ?? of /usr/lib/libVkLayer_parameter_validation.so
6  in ?? of /usr/lib/libVkLayer_threading.so
7  in vkcmd_create_secondary_command_buffer of vkcmd.c:207
8  in vkcmd_create_secondary_command_buffer_for_inst of vkcmd.c:88
9  in scn_load_scene of scene.c:407
10 in create_scene of main.c:903
11 in main of main.c:583

The code works fine on my other system with nvidia GTX-1070.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I installed latest mesa from git (18.1.0_devel.100894.fcf267ba08). It seems the problem is related to push constants size. But I use only 80 bytes (one matrix and one vec4 for color) and maxPushConstantsSize = 128. I use the following code for push constants:

        r32 diffToSend[4];
        memset(diffToSend, 0, sizeof(r32)*4);
        if(diffuseColorRGBA) memcpy(diffToSend, diffuseColorRGBA, sizeof(r32)*4);

        u8 pushConstants[80];
        memcpy(pushConstants, m, sizeof(r32)*16);
        memcpy(pushConstants+64, diffToSend, sizeof(r32)*4);

        vkCmdPushConstants(*cmdBuf, pipelineDescr->pipelineLayout,
                           0, 80, pushConstants);

Program received signal SIGBUS, Bus error.

anv_state_stream_alloc (stream=stream@entry=0x55559dbf9dd8, size=64, alignment=alignment@entry=32) at vulkan/anv_allocator.c:913

913       VG_NOACCESS_WRITE(&sb->block, stream->block);

0  in anv_state_stream_alloc of vulkan/anv_allocator.c:913
1  in anv_cmd_buffer_alloc_dynamic_state of vulkan/anv_batch_chain.c:654
2  in anv_cmd_buffer_push_constants of vulkan/anv_cmd_buffer.c:729
3  in cmd_buffer_flush_push_constants of vulkan/genX_cmd_buffer.c:2420
4  in gen9_cmd_buffer_flush_state of vulkan/genX_cmd_buffer.c:2571
5  in gen9_CmdDrawIndexed of vulkan/genX_cmd_buffer.c:2709
6  in ?? of /usr/lib/libVkLayer_core_validation.so
7  in ?? of /usr/lib/libVkLayer_parameter_validation.so
8  in ?? of /usr/lib/libVkLayer_threading.so
9  in vkcmd_create_secondary_command_buffer of vkcmd.c:207
10 in vkcmd_create_secondary_command_buffer_for_inst of vkcmd.c:88
11 in scn_load_scene of scene.c:407
12 in create_scene of main.c:903
13 in main of main.c:583

So I get no validation errors. This code works on nvidia card. This is probably a bug.

For questions and issues with the Mesa driver, your best options are:

I suggest that you open a Bugzilla ticket with the information in this post. The team will probably then ask you a lot of clarifying questions (OS? gpu pci id? Mesa version? etc etc).

Also, it's often helpful to directly contact the owner of the Mesa package for your Linux distribution. Sometimes the package owner is very familiar with frequent bugs that are specific to that distribution. On RPM based distros, such as Fedora, you can find the packager by examining the package's changelog with this command: `rpm -q --changelog mesa-libGL`. On Debian based distros, such as Ubuntu, I think the apt-cache command gives you the needed info.

Leave a Comment

Please sign in to add a comment. Not a member? Join today