Ubuntu R9 390 stability; "Failed to pin framebuffer"

I've gotten my 390 almost stable on Ubuntu 16.04 using AMDGPU-PRO (16.04) and setting the pwm_dpm_state and performance_level to their highest values. I will get hours of run time during light web browsing, but when trying to run SFML applications, or viewing shadertoy.com, it'll lock up reliably in under 15 minutes. Looking at Dmesg amdgpu is complaining about not being able to pin a framebuffer.

I can only see these by sshing from another machine btw, I cant get to the tty.

"Failed to pin framebuffer" on google turns up some patches, a lot of them have an error code attached. I'm running 4.10.0-40-generic, should I try patching and compiling a kernel to include whatever changes have been made on these patches?

I've tried recovering my session by restarting lightdm and killing all my open processes, no dice. A reboot is the only way to recover.

Anyone have this problem before, or heard of it? I'd really like to continue developing on Ubuntu

So I found out a very naive repro case. When debugging in Clion, if I stop my opengl application before the renderwindow pops up it will put the PC into a very fragile state where I can move the mouse and move windows around, but the instant I click any buttons or try to render a new window the system will lock up. I haven't been able to reproduce the dmesg message I got in my original post though which is odd...

I tried repro'ing it by fork()ing before I create the render window, one thread goes to an exit() and the other continues creating the render window. My thinking being to short circuit the window creation to replicate the problem with Clion. No dice, it works just fine. I also tried doing the same but launching it via gdb, like Clion does with it's debugger still nothing....

I was able to get it to repro fairly easily. I compiled my app with debug symbols and ran it through gdb with a piece of code that segfaults. When it hit the segfault, I would `run` the app again and terminate the current instance. After a few rounds, instead of breaking in my code, it would start breaking at something inside the amdgpu driver. Here's the backtrace