Mesa-21.2.1 radeonsi crash on concurrent shared OpenGL context creation.
System information
System: Host: loki.datenwolf.net Kernel: 5.13.13_1 x86_64 bits: 64 compiler: gcc v: 10.2.1
Desktop: awesome 4.3 dm: XDM Distro: void
CPU: Info: Quad Core model: Intel Xeon E5-1620 v3 bits: 64 type: MT MCP arch: Haswell
rev: 2 cache: L2: 10 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 56003
Speed: 1692 MHz min/max: 1200/3600 MHz Core speeds (MHz): 1: 1692 2: 1283 3: 2109
4: 2268 5: 1396 6: 1616 7: 2448 8: 1201
Graphics: Device-1: Blackmagic Design Decklink SDI 4K driver: blackmagic-io v: 12.1a9
bus-ID: 01:00.0 chip-ID: bdbd:a138
Device-2: NVIDIA GM204 [GeForce GTX 980] driver: nvidia v: 470.63.01
bus-ID: 02:00.0 chip-ID: 10de:13c0
Device-3: AMD Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] driver: amdgpu v: kernel
bus-ID: 05:00.0 chip-ID: 1002:73bf
Display: x11 server: X.Org 1.20.13 driver: loaded: amdgpu,nvidia
resolution: 1920x1200~60Hz s-dpi: 97
OpenGL:
renderer: AMD Radeon RX 6900 XT (SIENNA_CICHLID DRM 3.41.0 5.13.13_1 LLVM 12.0.0)
v: 4.6 Mesa 21.2.1 direct render: Yes
Describe the issue
Attempting to create an additional OpenGL context sharing its resourced with an preexisting context fails with a SIGSEGV if the attempt to create that new context is made from a separate thread and happens concurrently with operations happening on the share context in a different thread.
Thread 18 "luro-sdihost" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffadffe640 (LWP 1501)]
0x00007ffff5478b96 in si_bind_gs_shader (ctx=0x5555562293a0, state=0xffffffffffffffff)
at ../src/gallium/drivers/radeonsi/si_state_shaders.c:3146
3146 ../src/gallium/drivers/radeonsi/si_state_shaders.c: No such file or directory.
(gdb) backtrace
#0 0x00007ffff5478b96 in si_bind_gs_shader (ctx=0x5555562293a0, state=0xffffffffffffffff)
at ../src/gallium/drivers/radeonsi/si_state_shaders.c:3146
#1 0x00007ffff5737be5 in util_blitter_restore_vertex_states (blitter=blitter@entry=0x55555623d950)
at ../src/gallium/auxiliary/util/u_blitter.c:653
#2 0x00007ffff573897e in util_blitter_clear_custom (blitter=0x55555623d950, width=1920, height=1080,
num_layers=<optimized out>, clear_buffers=clear_buffers@entry=1, color=color@entry=0x5555563b77e4,
depth=depth@entry=1, stencil=0, custom_dsa=0x0, msaa=false, custom_blend=<optimized out>)
at ../src/gallium/auxiliary/util/u_blitter.c:1538
#3 0x00007ffff5738b16 in util_blitter_clear (blitter=<optimized out>, width=<optimized out>,
height=<optimized out>, num_layers=<optimized out>, clear_buffers=clear_buffers@entry=1,
color=color@entry=0x5555563b77e4, depth=depth@entry=1, stencil=0, msaa=false)
at ../src/gallium/auxiliary/util/u_blitter.c:1551
#4 0x00007ffff549e597 in si_clear (ctx=0x5555562293a0, buffers=<optimized out>, scissor_state=<optimized out>,
color=0x5555563b77e4, depth=1, stencil=0) at ../src/gallium/drivers/radeonsi/si_clear.c:1050
#5 0x00007ffff51ef48f in tc_call_clear (pipe=<optimized out>, call=<optimized out>, last=<optimized out>)
at ../src/gallium/auxiliary/util/u_threaded_context.c:3514
#6 0x00007ffff51ef802 in tc_batch_execute (job=job@entry=0x5555563b7760, gdata=gdata@entry=0x0,
thread_index=thread_index@entry=0) at ../src/gallium/auxiliary/util/u_threaded_context.c:190
#7 0x00007ffff51f022b in _tc_sync (tc=tc@entry=0x5555563b6350, func=<optimized out>, info=<optimized out>)
at ../src/gallium/auxiliary/util/u_threaded_context.c:341
#8 0x00007ffff51f57d8 in tc_flush (_pipe=0x5555563b6350, fence=0x0, flags=0)
at ../src/gallium/auxiliary/util/u_threaded_context.c:2852
#9 0x00007ffff4cf6873 in st_flush (flags=0, fence=0x0, st=0x555556440960)
at ../src/mesa/state_tracker/st_cb_flush.c:61
#10 st_glFlush (ctx=<optimized out>, gallium_flush_flags=0) at ../src/mesa/state_tracker/st_cb_flush.c:99
#11 0x00007ffff4d5b2a9 in _mesa_make_current (newCtx=0x7fff7c0770c0, drawBuffer=0x7fff7c0d0960,
readBuffer=0x7fff7c0d0960) at ../src/mesa/main/context.c:1617
#12 0x00007ffff4ce63a3 in st_api_make_current (stapi=<optimized out>, streadi=0x555556444420,
stdrawi=0x555556444420, stctxi=0x7fff7c0cd230) at ../src/mesa/state_tracker/st_manager.c:1105
#13 st_api_make_current (stapi=<optimized out>, stctxi=0x7fff7c0cd230, stdrawi=0x555556444420,
streadi=0x555556444420) at ../src/mesa/state_tracker/st_manager.c:1072
#14 0x00007ffff4c893dd in dri_make_current (cPriv=<optimized out>, driDrawPriv=<optimized out>,
driReadPriv=<optimized out>) at ../src/gallium/frontends/dri/dri_context.c:306
#15 0x00007ffff519d9e6 in driBindContext (pcp=<optimized out>, pdp=<optimized out>, prp=<optimized out>)
at ../src/mesa/drivers/dri/common/dri_util.c:586
#16 0x00007ffff67f8ca6 in ?? () from /usr/lib/libGLX_mesa.so.0
#17 0x00007ffff67e8eee in ?? () from /usr/lib/libGLX_mesa.so.0
#18 0x00007ffff6838b2d in ?? () from /usr/lib/libGLX.so.0
#19 0x00007ffff683e7e3 in ?? () from /usr/lib/libGLX.so.0
#20 0x00007ffff7c9f904 in glxu_create_context_with_sharing (major=major@entry=4, minor=minor@entry=0,
profile=profile@entry=1, display=<optimized out>, surface=<optimized out>, share_context=<optimized out>,
out_context=0x7fffadffd238) at src/glxu_context.c:230
#21 0x00007ffff7c9d1bf in luroGfxGLContextPoolGLX::make_current (this=0x555556496ff0, holder=<optimized out>)
at src/lurogfx-glctxpool.cc:89
#22 0x00007ffff7c9cc19 in luroGfxGLCurrent::luroGfxGLCurrent (this=0x7fffadffd2a0, glctxpool=...)
at src/lurogfx-glctxpool.cc:18
#23 0x00007ffff7fc1463 in luroSDIHostDecklink::VideoInputFrameArrived (this=0x55555634bca0,
video=0x7fffadffd2a0, audio=<optimized out>) at luro-sdihost-decklink.cc:424
#24 0x00007fffd613e76b in CDeckLinkInputCallback_From_v11_5_1::VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*) () from /opt/desktopvideo/x86_64/lib/blackmagic/libDeckLinkAPI.so
#25 0x00007fffd6120e58 in CDeckLinkInput::inputFrameArrivalCallback() ()
from /opt/desktopvideo/x86_64/lib/blackmagic/libDeckLinkAPI.so
#26 0x00007fffd60ffe4b in CDeckLink::DriverNotificationThreadFunction(void*) ()
from /opt/desktopvideo/x86_64/lib/blackmagic/libDeckLinkAPI.so
#27 0x00007ffff7f5beae in start_thread (arg=0x7fffadffe640) at pthread_create.c:463
#28 0x00007ffff77b12ff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
I have the strong suspicion, that this crash might be related to another issue I've recently ran into, for which I intend to file a separate ticket, accompanied by a reliably reproducing MCVE source.
Any extra information would be greatly appreciated
Besides this visible (in the sense of, I can actually see stuff on my screen) crash, running the same program also caused a complete GPU driver crash, blacking out the X server, yet programs other than my crashing one kepts on running, even playing audio just fine. I'm attaching the relevant dmesg output for that, as I presume that these might be helpful.