allanp81 Posted June 24, 2015 Share Posted June 24, 2015 I've set up a windows 7 VM and successfully passed through my PCI-E TV tuner for use with Mediaportal TV tuner. Unfortunately I'm having some latency issues that are manifesting themselves as drop packets in the TV server software. Normally this is caused by bad signal but I know this not to be the case. This means that watching TV on a client has picture breakups that are incredibly annoying. Using a latency checker (http://www.thesycon.de/deu/latency_check.shtml) I can see that the latency is all over the place, way above what it should be. Lots of yellow and red spikes. Here is a copy of my kvm xml in case anyone has any ideas if there's a way I can solve this: <domain type='kvm' id='22'> <name>downloadbox</name> <uuid>a9120f0a-bd27-57c4-7720-26ce50f5ad53</uuid> <metadata> <vmtemplate name="Custom" icon="windows7.png" os="windows7"/> </metadata> <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <memoryBacking> <nosharepages/> <locked/> </memoryBacking> <vcpu placement='static'>2</vcpu> <cputune> <vcpupin vcpu='0' cpuset='0'/> <vcpupin vcpu='1' cpuset='1'/> </cputune> <resource> <partition>/machine</partition> </resource> <os> <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> </os> <features> <acpi/> <apic/> <hap/> <viridian/> </features> <cpu mode='host-passthrough'> <topology sockets='1' cores='2' threads='1'/> </cpu> <clock offset='localtime'> <timer name='rtc' tickpolicy='catchup'/> <timer name='pit' tickpolicy='delay'/> <timer name='hpet' present='yes'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source file='/mnt/disk8/VMs/downloadbox/vdisk1.img'/> <backingStore/> <target dev='hdb' bus='virtio'/> <boot order='1'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/mnt/user/Apps/virtio-win-0.1.96.iso'/> <backingStore/> <target dev='hda' bus='ide'/> <readonly/> <boot order='2'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='usb' index='0'> <alias name='usb0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci.0'/> </controller> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:64:79:17'/> <source bridge='br0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/0'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/0'> <source path='/dev/pts/0'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/downloadbox.org.qemu.guest_agent.0'/> <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/> <alias name='channel0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> </channel> <input type='tablet' bus='usb'> <alias name='input0'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-us'> <listen type='address' address='0.0.0.0'/> </graphics> <video> <model type='vmvga' vram='16384' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='pci' managed='yes'> <driver name='vfio'/> <source> <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/> </source> <alias name='hostdev0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </hostdev> <hostdev mode='subsystem' type='pci' managed='yes'> <driver name='vfio'/> <source> <address domain='0x0000' bus='0x07' slot='0x00' function='0x0'/> </source> <alias name='hostdev1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </hostdev> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </memballoon> </devices> </domain> Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 No-one? As it I'm starting to think this is not going to work as the TV part is a major component I need to work properly and I feel like I've wasted money if there's no solution. Link to comment
dlandon Posted June 25, 2015 Share Posted June 25, 2015 Did you create the xml by hand? There are some things I see that don't look like the VM Manager created it. FWIW, I have a Windows 7 Media Center VM working perfectly with an Xbox 360 and Ceton Media Extenders. I am using a network TV tuner. It is possible. I don't let Windows update install every update available. I select only those that would apply. I also don't have any other applications running on the VM. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 No, but I added the section at the end for the hostdevice (my pci-e tv tuner) and the 2 entries under features for viridian and hap as I'd read on another forum that someone had success adding those entries. I also created a brand new VM for testing with nothing installed other than the virtio drivers and it has the same issue with latency. FWIW, my server is a corei4 4460, asus z97-p motherboard with 16Gb of RAM. I have tried using a proper GPU but for some reason it just blue screens the win7 guest complaining about viostor.sys if I try and enable passthrough! Link to comment
dlandon Posted June 25, 2015 Share Posted June 25, 2015 Your motherboard has a Realtek NIC. They are known to be problematic with unRAID. You should get an Intel NIC card and disable the Realtek and try that. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 Ok cool, I can borrow one from work and give it a go and let you know. Otherwise there's no other obvious reason why it would be spiking so badly on the latency? Link to comment
dlandon Posted June 25, 2015 Share Posted June 25, 2015 I would also try the latest .100 virtio drivers. I have had the best luck with those. Any later version of the net driver causes my Windows 7 VM to lock up when the XBox 360 extender tries to connect. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 I think I installed the virtio-win-0.1.96 but any newer versions I download don't install as Windows says it already has the latest version of the NIC driver installed. Link to comment
dlandon Posted June 25, 2015 Share Posted June 25, 2015 You should be able to update the drivers manually. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 I *think* I may have sorted this. I changed the virtio network adapter link speed to be 1Gbit rather than the 10Gbit that it defaulted to and so far I'm seeing almost entirely green when I run the DPC latency checker. It's not perfect but it seems to be definite improvement. I have an intel gigabit nic I can try now as well in place of the onboard realtek so will see if that helps matters further. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 Well I think I spoke too soon I tried a dlink dge-530t (pci) and intel gigabit (pci-e) card and had the same results with both I think I'm going to have to give up and just use win7 and something like drive bender which is a shame as I've paid for unraid now. Link to comment
jonp Posted June 25, 2015 Share Posted June 25, 2015 To be fair, what you are trying to do isn't officially supported by us yet. We want to support more and more, but initially its just GPU/Audio for PCI devices. There are other devices you can try to pass through using the XML editor, but as we don't have those devices on a lab setting, we can't guarantee success or even effectively troubleshoot beyond some basic tweaks. This is also why we have a trial so folks can test out capabilities before committing to a purchase. Link to comment
allanp81 Posted June 25, 2015 Author Share Posted June 25, 2015 Thanks for the reply. I don't think the issue is with my tv card etc. though as I have the same issue on a blank machine with nothing passed through. Link to comment
jonp Posted June 25, 2015 Share Posted June 25, 2015 Thanks for the reply. I don't think the issue is with my tv card etc. though as I have the same issue on a blank machine with nothing passed through. I think what you're saying here is that you're having latency issues with virtual machines in general, independent of passing through a tuner card. If that's the case, we can continue troubleshooting/diagnosis. 1 - does this only happen with your Windows 7 VM? Do you have access to / can you try Windows 8.1? What about a Linux VM? 2 - This DPC Latency Checker. I don't know much about it, but I downloaded it on my system (running Win 8.1 as a VM with GPU, Audio, a capture card, and a USB controller passed through). It gives me this message: Some device drivers on this machine behave bad and will probably cause drop-outs in real-time audio and/or video streams. To isolate the misbehaving driver use Device Manager and disable/re-enable various devices, one at a time. Try network and W-LAN adapters, modems, internal sound devices, USB host controllers, etc. I've never had audio drop outs, issues with video streams, or anything else that it's indicating. Not when playing music, videos, games, or anything else. Even if I'm capturing video from my NVIDIA GPU and my capture card at the same time while playing a game, I don't have a problem. Is it possible this tool just isn't built for analyzing data inside a VM and may be reporting bad information? EDIT: Duh! Just saw this on their website about Win 8: Windows 8 Compatibility: The DPC latency utility runs on Windows 8 but does not show correct values. The output suggests that the Windows 8 kernel performs badly and introduces a constant latency of one millisecond, which is not the case in practice. DPCs in the Windows 8 kernel behave identical to Windows 7. The utility produces incorrect results because the implementation of kernel timers has changed in Windows 8, which causes a side effect with the measuring algorithm used by the utility. Thesycon is working on a new version of the DPC latency utility and will make it available on this site as soon as it is finished. Will have to have a go with Win7 sometime to see if I can reproduce your issue. Link to comment
allanp81 Posted June 26, 2015 Author Share Posted June 26, 2015 Latencymon (http://www.resplendence.com/latencymon) also gives the same results sadly. The way mediaportal works is it uses the BDA functions in Windows to tune to a channel and just writes the transport stream to the local disk (or location of your choice). You can see that the latency spikes it makes Mediaportal drop packets which basically means you get the picture broken up when you try to watch TV on a client. Some more info can be found here http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/16_Support/Troubleshooting/Stuttering_Playback Link to comment
CHBMB Posted June 26, 2015 Share Posted June 26, 2015 Have you tried an Argus backend? Integrates with Mediaportal and I have used it in a Win 7 VM on Unraid without issue, I've now migrated to a TVHeadEnd backend in a docker container since I've managed to get my drivers into bzroot & bzimage which is another possibility and serves my Kodi clients perfectly But I assume since you're using a Mediaportal backend you're serving Mediaportal clients so that leaves you with Argus as the only other option. Link to comment
allanp81 Posted August 27, 2015 Author Share Posted August 27, 2015 As a follow up to this, I've since tried this on another motherboard (with DQ67OW chipset) and have exactly the same issue. Is there no config etc. that can changed/adjusted to combat this? Link to comment
jonp Posted August 27, 2015 Share Posted August 27, 2015 As a follow up to this, I've since tried this on another motherboard (with DQ67OW chipset) and have exactly the same issue. Is there no config etc. that can changed/adjusted to combat this? A few things: 1 - You can try changing from using the <hostdev> method for PCI device assignment to using <qemu:arg> statements at the end of the XML. Change your current XML to this: <domain type='kvm' id='22' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> <name>downloadbox</name> <uuid>a9120f0a-bd27-57c4-7720-26ce50f5ad53</uuid> <metadata> <vmtemplate name="Custom" icon="windows7.png" os="windows7"/> </metadata> <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <memoryBacking> <nosharepages/> <locked/> </memoryBacking> <vcpu placement='static'>2</vcpu> <cputune> <vcpupin vcpu='0' cpuset='0'/> <vcpupin vcpu='1' cpuset='1'/> </cputune> <resource> <partition>/machine</partition> </resource> <os> <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type> </os> <features> <acpi/> <apic/> <hyperv> <relaxed state='on'/> <vapic state='on'/> <spinlocks state='on' retries='8191'/> </hyperv> </features> <cpu mode='host-passthrough'> <topology sockets='1' cores='2' threads='1'/> </cpu> <clock offset='localtime'> <timer name='hypervclock' present='yes'/> <timer name='hpet' present='no'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='writeback'/> <source file='/mnt/disk8/VMs/downloadbox/vdisk1.img'/> <backingStore/> <target dev='hdb' bus='virtio'/> <boot order='1'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/mnt/user/Apps/virtio-win-0.1.96.iso'/> <backingStore/> <target dev='hda' bus='ide'/> <readonly/> <boot order='2'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='usb' index='0'> <alias name='usb0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'> <alias name='pci.0'/> </controller> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='virtio-serial' index='0'> <alias name='virtio-serial0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </controller> <interface type='bridge'> <mac address='52:54:00:64:79:17'/> <source bridge='br0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/0'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/0'> <source path='/dev/pts/0'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/downloadbox.org.qemu.guest_agent.0'/> <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/> <alias name='channel0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> </channel> <input type='tablet' bus='usb'> <alias name='input0'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-us'> <listen type='address' address='0.0.0.0'/> </graphics> <video> <model type='vmvga' vram='16384' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </memballoon> </devices> <qemu:arg value='-device'/> <qemu:arg value='ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=2,chassis=1,id=root.1'/> <qemu:arg value='-device'/> <qemu:arg value='vfio-pci,host=07:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on'/> <qemu:arg value='-device'/> <qemu:arg value='vfio-pci,host=01:00.1,bus=root.1,addr=00.1'/> </domain> I've highlighted the few spots I've changed with bold / enlarged text. Also note that I removed all your <hostdev> statements and some of the <timer> sections. 2 - Windows 7 VMs are known to be "more difficult" with PCI device assignments. I would suggest trying a more modern OS. 3 - Without reviewing your diagnostics, I'm assuming you are passing through the HDMI audio on a GPU you have installed, but without passing through the video for that (e.g. 01:00.1 is being passed through, but not 01:00.0). I don't know how well that may work as it may confuse the device in windows (untested configuration). If you need HDMI audio, I would consider passing through the on-board hdmi audio (if you have it). This would most likely be device 00:03.0. 4 - It appears you are not taking advantage of hyper-v. Is this a Windows VM? If so, it may be better to turn hyper-v settings on, then make these XML edits. EDIT: I added the hyper-v enlightenments in the XML edit I provided. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.