Bug 97643

Summary: Shader crashes radeon driver and brings the whole system down
Product: Mesa Reporter: Cris <cristiano04>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: critical    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Cris 2016-09-08 17:23:29 UTC
This shader https://gist.github.com/igv/a015fc885d5c22e6891820ad89555637 (5th of September revision, crossbilateral only) crashes the radeon driver and brings the whole system down. Previous version does not.

1. Get mpv
2. Create ~/.config/mpv/shaders/crossbilateral.glsl
3. Add user-shaders:"~~/shaders/crossbilateral.glsl" to your mpv.conf 
4. System will crash

GPU: R9 280x
Driver: xf86-video-ati 7.7.0 (radeon)
Mesa: 12.0.1
Xorg-server: 1.18.4
libdrm: 2.4.68
Comment 1 Iaroslav Andrusyak 2016-09-08 17:44:45 UTC
works fine on 7970 and mesa-git,llvm-git
vo=opengl-hq:user-shaders="/home/pont/CrossBilateral.glsl"  

http://pastebin.com/6TNTa6ry
Comment 2 Cris 2016-09-08 17:54:52 UTC
(In reply to Iaroslav Andrusyak from comment #1)
> works fine on 7970 and mesa-git,llvm-git
> vo=opengl-hq:user-shaders="/home/pont/CrossBilateral.glsl"  
> 
> http://pastebin.com/6TNTa6ry

I forgot to mention that for crossbilateral to work, cscale must be set to bilinear.

My mpv.conf:

profile=opengl-hq
scale=ewa_lanczossharp
cscale=bilinear
opengl-shaders="~~/shaders/crossbilateral.glsl"
dscale=mitchell
tscale=sinc
interpolation
tscale-radius=2
interpolation-threshold=0.01
scale-radius=3
temporal-dither
dither-depth=8
deband-iterations=2
deband-range=12
correct-downscaling
blend-subtitles
video-sync=display-resample
hwdec=no
framedrop=vo
cache=262144
stop-screensaver=yes

vd-lavc-threads=4

llvm is 3.8.0-r2
Comment 3 Iaroslav Andrusyak 2016-09-08 18:22:38 UTC
still works


vo=opengl-hq:user-shaders="/home/pont/CrossBilateral.glsl":cscale=bilinear:dscale=mitchell:tscale=sinc:tscale-radius=2:interpolation-threshold=0.01:scale-radius=3:dither-depth=8:deband-iterations=2:deband-range=12
video-sync=display-resample
hwdec=no
framedrop=vo
cache=262144
stop-screensaver=yes

vd-lavc-threads=4

http://pastebin.com/neW3rkHA
Comment 4 Cris 2016-09-08 22:26:20 UTC
I don't know then. Is there a way for me to diagnose it myself?
Comment 5 smoki 2016-09-09 02:58:03 UTC
 You can try both mesa and llvm from git, as that is what Iaroslav probably using.

 12.0.1 mesa and llvm 3.8-rc2 does not sound current, even for stable mesa/llvm branches.
Comment 6 Nicolai Hähnle 2016-09-09 12:25:01 UTC
Cris, do please try with more recent Mesa + LLVM as well.

If that still crashes, can you provide a backtrace of where mpv crashes? dmesg output from the crash could also give some context.
Comment 7 Cris 2016-09-09 20:33:04 UTC
(In reply to Nicolai Hähnle from comment #6)
> Cris, do please try with more recent Mesa + LLVM as well.
> 
> If that still crashes, can you provide a backtrace of where mpv crashes?
> dmesg output from the crash could also give some context.

I did, I upgraded to llvm-3.9.0 and mesa-git, and the issue went away. Most conservative distros might have a hard time though.

Thanks anyway.
Comment 8 almos 2016-09-17 09:29:21 UTC
(In reply to Cris from comment #7)
> (In reply to Nicolai Hähnle from comment #6)
> > Cris, do please try with more recent Mesa + LLVM as well.
> > 
> > If that still crashes, can you provide a backtrace of where mpv crashes?
> > dmesg output from the crash could also give some context.
> 
> I did, I upgraded to llvm-3.9.0 and mesa-git, and the issue went away. Most
> conservative distros might have a hard time though.
> 
> Thanks anyway.

Doesn't that mean that a userspace code can crash the kernel, but the most recent version of that code doesn't do it? Ideally, the kernel should be more resilient than that IMHO.
Comment 9 Cris 2016-10-05 18:07:15 UTC
(In reply to almos from comment #8)
> (In reply to Cris from comment #7)
> > (In reply to Nicolai Hähnle from comment #6)
> > > Cris, do please try with more recent Mesa + LLVM as well.
> > > 
> > > If that still crashes, can you provide a backtrace of where mpv crashes?
> > > dmesg output from the crash could also give some context.
> > 
> > I did, I upgraded to llvm-3.9.0 and mesa-git, and the issue went away. Most
> > conservative distros might have a hard time though.
> > 
> > Thanks anyway.
> 
> Doesn't that mean that a userspace code can crash the kernel, but the most
> recent version of that code doesn't do it? Ideally, the kernel should be
> more resilient than that IMHO.

It's crashing now and I'm using -git (llvm, mesa, radeon). When it doesn't, it's unbearably slow. It definitely shouldn't happen.
Comment 10 Cris 2016-10-27 08:08:06 UTC
Can confirm this is no longer happening and the performance is BEARABLE. I still get dropped frames here and there though, which definitely shouldn't be happening.
Comment 11 Cris 2016-11-04 11:46:25 UTC
No longer an issue. Recompiled llvm-git and mesa-git and everything works fine with no frame drops, including lower resolution videos (which were grinding everything to a halt).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.