<div dir="ltr">Small update. I managed to figure out an alternative way to unbind the graphics device properly and reuse it back on the host. Instead of directly unbinding it, I just remove the device(s) and then rescan the PCI bus. Like this:<div><br></div><div><div>echo > /sys/bus/pci/devices/${DEV}/driver_override</div><div>echo 1 > /sys/bus/pci/devices/${DEV}/remove<br></div></div><div>echo 1 > /sys/bus/pci/rescan<br></div><div><br></div><div>Seems to work reliably (for now, knocking on wood).<br></div><div><br></div><div>Regards,</div><div>-mg</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 25, 2016 at 2:56 AM, Mario Goebbels <span dir="ltr"><<a href="mailto:me@tomservo.cc" target="_blank">me@tomservo.cc</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm currently trying to figure weird behaviour with vfio-pci. When I fire up my Windows VM with VGA passthrough, I seem to be able to boot and shut it down just fine, binding and unbinding vfio-pci without issues, so long I just do simple things with the GPU inside the VM.</div><div><br></div><div>Whenever I run a game inside the VM, after shutting it down, unbinding vfio-pci usually ends up in a kernel panic, either saying...</div><div><div><br></div><div>[  311.157926] BUG: unable to handle kernel paging request at 00007f23c8b47000</div></div><div><br></div><div>-or-</div><div><br></div><div><div>[ 2782.316934] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)</div></div><div><br></div><div>It's pretty easy to reproduce, pretty much as described above. I start my VM with Windows 10, run say GTA V for just a minute, shut it down immediately, and when the helper script unbinds vfio-pci, it panics. However, if I start the VM, do some simpler things, like browsing the web, watching some video with hardware accelerated decoding, and even run some WebGL demos (that appear hardware accelerated, I suppose similar to a game), and shut it down again, everything unbinds cleanly. And I can repeatedly start the VM without needing to reboot in-between or other tricks, as long I don't run a fullblown game.</div><div><br></div><div>Any idea what's going on and how I can fix this?</div><div><br></div><div>The system is an Intel Core i7-5820K, an Asrock X99 Extreme4 mainboard and the card being passed through is an NVidia GTX780 from EVGA. This happens on both Linux 4.4 and 4.5-rc1.<br></div><div><br></div><div><div>My current version of the helper script for reference: <a href="http://pastebin.com/kz79Cppv" target="_blank">http://pastebin.com/kz79Cppv</a></div></div><div><br></div><div>Thanks for any help and ideas,<br></div><div>-mg</div></div>
</blockquote></div><br></div>