<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>Dear all,</div>
<div><br>
</div>
<div>I am running a fresh Fedora 23 and want to use kvm/qemu to run a windows VM with GPU passthrough.</div>
<div><br>
</div>
<div>My setup is as follow:</div>
<div>Host OS: Fedora 23 (Workstation x86_64)</div>
<div>Kernel: 4.2.3-300.fc23.x86_64</div>
<div>QEMU version: qemu-2.4.0.1-1.fc23</div>
<div>Guest VM: Windows 7</div>
<div>CPU: Intel i7-6700K</div>
<div>Motherboard: Gigabyte B150-HD3</div>
<div>IGD: Intel® HD Graphics 530 (used by the host)</div>
<div>Graphics Card: GT710 (used by the VM)</div>
<div><br>
</div>
<div>First, enable IOMMU by appending the `intel_iommu=on` parameter to GRUB.</div>
<div>Next, prevent the kernel modules i915, nouveau and snd_hda_intel from being loaded for both initramfs and system.</div>
<div>Then, load vfio-pci with ids (modprobe vfio-pci ids=10de:128b,10de:0e0f)</div>
<div>Last, run qemu like this:</div>
<div>qemu-system-x86_64 -enable-kvm -m 4G -cpu host,kvm=off -smp 4,sockets=1,cores=2,threads=2 -hda ~/win7.img -usbdevice host:093a:2510 -usbdevice host:0c45:7603 -device vfio-pci,host=01:00.0,x-vga=on -device vfio-pci,host=01:00.1 -vga none</div>
<div><br>
</div>
<div>Everything looks good and the dedicated GPU detected by the guest VM (N.B. GPU driver `378.92-desktop-win8-win7-64bit-international-whql.exe` was ready), </div>
<div>But the guest VM is running very slow, and I observed kernel panic which generated by vfio_pci.</div>
<div><br>
</div>
<div>Here's the log from dmesg:</div>
<div>[  737.317946] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=io+mem:owns=none</div>
<div>[  737.356996] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=io+mem:owns=none</div>
<div>[  737.367606] vfio_pci: add [10de:128b[ffff:ffff]] class 0x000000/00000000</div>
<div>[  737.378437] vfio_pci: add [10de:0e0f[ffff:ffff]] class 0x000000/00000000</div>
<div>[  738.233680] vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)</div>
<div>[  739.755715] kvm: zapping shadow pages for mmio generation wraparound</div>
<div>[  739.874265] irq 16: nobody cared (try booting with the "irqpoll" option)</div>
<div>[  739.874269] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.3-300.fc23.x86_64 #1</div>
<div>[  739.874270] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./B150-HD3-CF, BIOS F5 03/11/2016</div>
<div>[  739.874271]  0000000000000000 e5300c14e6af3df1 ffff880470c03e28 ffffffff81771fca</div>
<div>[  739.874272]  0000000000000000 ffff88045b2844a4 ffff880470c03e58 ffffffff810f88a5</div>
<div>[  739.874273]  ffff880081f42e50 ffff88045b284400 0000000000000000 0000000000000010</div>
<div>[  739.874275] Call Trace:</div>
<div>[  739.874276]  <IRQ>  [<ffffffff81771fca>] dump_stack+0x45/0x57</div>
<div>[  739.874281]  [<ffffffff810f88a5>] __report_bad_irq+0x35/0xd0</div>
<div>[  739.874282]  [<ffffffff810f8c44>] note_interrupt+0x244/0x290</div>
<div>[  739.874284]  [<ffffffff810f607c>] handle_irq_event_percpu+0x11c/0x180</div>
<div>[  739.874285]  [<ffffffff810f6110>] handle_irq_event+0x30/0x60</div>
<div>[  739.874286]  [<ffffffff810f91f4>] handle_fasteoi_irq+0x84/0x150</div>
<div>[  739.874287]  [<ffffffff81016e42>] handle_irq+0x72/0x120</div>
<div>[  739.874289]  [<ffffffff810bd66a>] ? atomic_notifier_call_chain+0x1a/0x20</div>
<div>[  739.874291]  [<ffffffff8177b5df>] do_IRQ+0x4f/0xe0</div>
<div>[  739.874292]  [<ffffffff817794eb>] common_interrupt+0x6b/0x6b</div>
<div>[  739.874292]  <EOI>  [<ffffffff81108a4f>] ? hrtimer_start_range_ns+0x1bf/0x3b0</div>
<div>[  739.874296]  [<ffffffff816160c0>] ? cpuidle_enter_state+0x130/0x270</div>
<div>[  739.874297]  [<ffffffff8161609b>] ? cpuidle_enter_state+0x10b/0x270</div>
<div>[  739.874298]  [<ffffffff81616237>] cpuidle_enter+0x17/0x20</div>
<div>[  739.874300]  [<ffffffff810dfcc2>] call_cpuidle+0x32/0x60</div>
<div>[  739.874301]  [<ffffffff81616213>] ? cpuidle_select+0x13/0x20</div>
<div>[  739.874302]  [<ffffffff810dff58>] cpu_startup_entry+0x268/0x320</div>
<div>[  739.874304]  [<ffffffff8176870c>] rest_init+0x7c/0x80</div>
<div>[  739.874305]  [<ffffffff81d5702d>] start_kernel+0x49d/0x4be</div>
<div>[  739.874307]  [<ffffffff81d56120>] ? early_idt_handler_array+0x120/0x120</div>
<div>[  739.874308]  [<ffffffff81d56339>] x86_64_start_reservations+0x2a/0x2c</div>
<div>[  739.874309]  [<ffffffff81d56485>] x86_64_start_kernel+0x14a/0x16d</div>
<div>[  739.874309] handlers:</div>
<div>[  739.874313] [<ffffffffa05172d0>] vfio_intx_handler [vfio_pci]</div>
<div>[  739.874313] Disabling IRQ #16</div>
<div><br>
</div>
<div>What I've tried so far:</div>
<div>1. Different graphics card (GTX750Ti), with same results</div>
<div>2. Different host OS (Fedora 24: Kernel 4.5.5-300.fc24.x86_64 + qemu-2.6.2-8.fc24), without any issues</div>
<div>3. Load vfio-pci with `nointxmask=1`, without any issues</div>
<div>4. Remove `-hda ~/win7.img` from QEMU command (seabios only), still get the same crash</div>
<div><br>
</div>
<div>So I have some questions now:</div>
<div>1. Is this a known issue? what is the root cause?</div>
<div>2. Why Fedora 24 does not have this issue? related to kernel, qemu or other components?</div>
<div>3. Is `nointxmask=1` the right way to avoid crash?</div>
<div><br>
</div>
<div>Thank you in advance for any guidance.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Zhifeng</div>
<p></p>
</div>
</body>
</html>