Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906222 - media-libs/mesa-23.0.3-r1 causes segfaults in libva va_openDriver with radeonsi GPU
Summary: media-libs/mesa-23.0.3-r1 causes segfaults in libva va_openDriver with radeon...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-12 19:57 UTC by Michal Petrucha
Modified: 2023-10-07 01:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Petrucha 2023-05-12 19:57:23 UTC
After upgrading to mesa-23.0.3-r1 from 22.3.7-r1, anything trying to initialize libva segfaults

Reproducible: Always

Steps to Reproduce:
Run vainfo, for example
Actual Results:  
$  vainfo                                                                                                                                        
Trying display: x11                                                                                                                                                                   
libva info: VA-API version 1.17.0                                                                                                                                                     
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so                                                                                                                
libva info: Found init function __vaDriverInit_1_17    
Segmentation fault (core dumped)                       


Expected Results:  
This is what I get after downgrading back to 22.3.7-r1

$  vainfo 
Trying display: x11
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.17 (libva 2.17.1)
vainfo: Driver version: Mesa Gallium driver 22.3.7 for AMD Radeon RX 6900 XT (navi21, LLVM 15.0.7, DRM 3.49, 6.1.22-gentoo-dist)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc


Here's a stack trace from one of the crashed processes:

#0  0x00007f1a31726085 in list_addtail (list=<optimized out>, item=<optimized out>) at ../mesa-23.0.3/src/util/list.h:82
#1  add_use_cb (src=src@entry=0x5620f677634c, state=state@entry=0x5620f6776244) at ../mesa-23.0.3/src/compiler/nir/nir.c:1056
#2  0x00007f1a31726489 in _nir_visit_src (state=0x5620f6776244, cb=0x7f1a31726070 <add_use_cb>, src=0x5620f677634c) at ../mesa-23.0.3/src/compiler/nir/nir_inline_helpers.h:47
#3  nir_foreach_src (instr=0x5620f6776244, cb=0x7f1a31726070 <add_use_cb>, state=0x5620f6776244) at ../mesa-23.0.3/src/compiler/nir/nir_inline_helpers.h:83
#4  0x00007f1a31728480 in add_defs_uses (instr=0x5620f6776244) at ../mesa-23.0.3/src/compiler/nir/nir.c:1095
#5  nir_instr_insert (cursor=..., instr=instr@entry=0x5620f6776244) at ../mesa-23.0.3/src/compiler/nir/nir.c:1120
#6  0x00007f1a31a05c6f in nir_instr_insert_after_block (after=0x5620f6776244, block=0x5620f675dcb0) at ../mesa-23.0.3/src/compiler/nir/nir.h:4166
#7  read_instr (block=0x5620f675dcb0, ctx=0x7ffcd0204900) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:1787
#8  read_block (cf_list=0x5620f675dbf0, ctx=0x7ffcd0204900) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:1856
#9  read_cf_node (list=0x5620f675dbf0, ctx=0x7ffcd0204900) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:1937
#10 read_cf_list (ctx=ctx@entry=0x7ffcd0204900, cf_list=cf_list@entry=0x5620f675dbf0) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:1964
#11 0x00007f1a31a06eca in read_function_impl (fxn=0x5620f660ea30, ctx=0x7ffcd0204900) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:2000
#12 nir_deserialize (mem_ctx=mem_ctx@entry=0x0, options=options@entry=0x5620f6600ed8, blob=blob@entry=0x7ffcd0204b00) at ../mesa-23.0.3/src/compiler/nir/nir_serialize.c:2207
#13 0x00007f1a319a4523 in load_nir_from_disk_cache (processor=<optimized out>, key=0x7ffcd0204b20 "\377!S\331\322&\363S\035\361\n\235`O|\226\327ۯ\275", screen=0x5620f66007f0, cache=0x5620f66744e0) at ../mesa-23.0.3/src/gallium/auxiliary/nir/tgsi_to_nir.c:2661
#14 tgsi_to_nir (tgsi_tokens=0x7ffcd0204bd0, screen=screen@entry=0x5620f66007f0, allow_disk_cache=allow_disk_cache@entry=true) at ../mesa-23.0.3/src/gallium/auxiliary/nir/tgsi_to_nir.c:2687
#15 0x00007f1a318ffef7 in si_create_compute_state (ctx=0x5620f67104d0, cso=0x7ffcd0204bb0) at ../mesa-23.0.3/src/gallium/drivers/radeonsi/si_compute.c:252
#16 0x00007f1a316b415e in vl_compositor_cs_create_shader (c=c@entry=0x5620f65eaed8, compute_shader_text=<optimized out>) at ../mesa-23.0.3/src/gallium/auxiliary/vl/vl_compositor_cs.c:893
#17 0x00007f1a316b47d0 in vl_compositor_cs_init_shaders (c=c@entry=0x5620f65eaed8) at ../mesa-23.0.3/src/gallium/auxiliary/vl/vl_compositor_cs.c:935
#18 0x00007f1a316aeff0 in init_shaders (c=0x5620f65eaed8) at ../mesa-23.0.3/src/gallium/auxiliary/vl/vl_compositor.c:39
#19 vl_compositor_init (c=c@entry=0x5620f65eaed8, pipe=<optimized out>) at ../mesa-23.0.3/src/gallium/auxiliary/vl/vl_compositor.c:795
#20 0x00007f1a31656227 in __vaDriverInit_1_17 (ctx=0x5620f6562ad0) at ../mesa-23.0.3/src/gallium/frontends/va/context.c:186
#21 0x00007f1a324b0eb6 in va_openDriver () from /usr/lib64/libva.so.2
#22 0x00007f1a324b1f5e in vaInitialize () from /usr/lib64/libva.so.2
#23 0x00005620f4e793a6 in main ()


I don't have a lot of recent experience debugging C code, so if there's any additional steps that I can take to help figure this out, just let me know.

Here's emerge --info:

emerge --info 
Portage 3.0.44 (python 3.11.3-final-0, default/linux/amd64/17.1/desktop/plasma/systemd/merged-usr, gcc-12, glibc-2.36-r8, 6.1.22-gentoo-dist x86_64)
=================================================================
System uname: Linux-6.1.22-gentoo-dist-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.36
KiB Mem:    65736048 total,  15624036 free
KiB Swap:   16777212 total,  13111804 free
Timestamp of repository gentoo: Fri, 12 May 2023 10:00:01 +0000
Head commit of repository gentoo: f1f7f4f5e49dcf7dbeebcb642a2e7428249a95f0
sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p6) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.0-r2::gentoo
dev-lang/python:           3.10.10_p3::gentoo, 3.11.3::gentoo
dev-lang/rust:             1.66.1::gentoo
dev-util/cmake:            3.25.3::gentoo
dev-util/meson:            1.0.1::gentoo
sys-apps/baselayout:       2.13-r1::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-apps/systemd:          253.3-r1::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.7-r1::gentoo
sys-devel/gcc:             12.2.1_p20230428-r1::gentoo
sys-devel/gcc-config:      2.10::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            15.0.7::gentoo
sys-devel/make:            4.4.1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r8::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes

vlastne
    location: /usr/local/portage/vlastne
    masters: gentoo
    volatile: True

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50
    volatile: True

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j31"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities alsa amd64 amf avahi bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr encode exif fdk flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kwallet lastfm lcms libglvnd libnotify libtirpc mad mdns mng mp3 mp4 mpeg mtp multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pipewire plasma png policykit ppds pulseaudio python qml qt5 readline rtkit s3tc sdl seccomp semantic-desktop sound spell ssl startup-notification svg systemd test-rust tiff truetype udev udisks unicode upower usb vaapi vdpau vim-syntax vorbis vulkan widgets wxwidgets x264 xattr xcb xft xinerama xml xv xvid zeroconf zlib" ABI_X86="64 32" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby30" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Matt Turner gentoo-dev 2023-05-12 21:23:59 UTC
I added mesa-23.1.0 today. Could you check whether that version has the same problem? That would help narrow things down.
Comment 2 Michal Petrucha 2023-05-13 11:58:36 UTC
I just tried installing 23.1.0, and couldn't reproduce the segfault.
Comment 3 Nick Pelepchan 2023-05-14 18:19:31 UTC
Just commenting that I have the same issue describe above.  23.0.3-r1 appears to not be stable when using VAAPI.  Multiple applications crash (VLC, kodi, vinfo, firefox).

vainfo:
Trying display: x11
libva info: VA-API version 1.18.0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_18
Segmentation fault

dmesg:
vainfo[23173]: segfault at 8 ip 00007fac0f072745 sp 00007ffcb826b9f8 error 4 in radeonsi_drv_video.so[7fac0ef84000+6cd000] likely on CPU 11 (core 5, socket 0)

addr2line:
addr2line -e /usr/lib64/va/drivers/radeonsi_drv_video.so -fCi 0x50FC32
ac_init_shared_llvm_once
??:?

Package info:
[ebuild   R    ] media-libs/mesa-23.0.3-r1::gentoo  USE="X d3d9 gles2 llvm lm-sensors proprietary-codecs vaapi vulkan vulkan-overlay zstd -debug -gles1 -opencl -osmesa (-selinux) -test -unwind -valgrind -vdpau -wayland -xa -zink" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="sse2" VIDEO_CARDS="intel nouveau radeon radeonsi -d3d12 (-freedreno) (-lima) (-panfrost) -r300 -r600 (-v3d) (-vc4) -virgl (-vivante) -vmware" 0 KiB
Comment 4 Matt Turner gentoo-dev 2023-05-24 15:59:57 UTC
I asked on #dri-devel and #radeon and no one knew of this. I recommend opening an issue upstream at https://gitlab.freedesktop.org/mesa/mesa/-/issues (and linking it here).
Comment 5 Brian S. Stephan 2023-07-24 19:01:56 UTC
Did this issue ever get reported upstream? I have very similar behavior with vainfo getting OOM-killed (and VAAPI stuff like Chromium having problems), but ironically, media-libs/mesa-23.1.3 is the problem child and downgrading to media-libs/mesa-23.0.3-r1 is the fix.
Comment 6 Joseph McElroy 2023-08-08 11:22:28 UTC
I had the same experience as Brian on this (https://wiki.gentoo.org/wiki/ROG_Zephyrus_G14_(2022)_GA402) hardware. Just tried updating to Mesa 23.1.5 though and there seem to be no issues.
Comment 7 Matt Turner gentoo-dev 2023-09-29 01:42:43 UTC
Is this still a problem with 23.1.8 or 23.2.1?
Comment 8 Brian S. Stephan 2023-10-06 18:26:44 UTC
I had no crashes I can recall since upgrading to media-libs/mesa-23.1.6 in August, and can confirm that I no longer get a segfault with vainfo on media-libs/mesa-23.1.8.
Comment 9 Matt Turner gentoo-dev 2023-10-07 01:25:31 UTC
Thanks!