QEMU/KVM and GPU Passthrough Troubleshooting: Difference between revisions

From WikiMLT
Line 24: Line 24:


=== Linux ===
=== Linux ===
Linux guests usually enable MSI by themselves. To force use of MSI for GPU audio devices, use the following command and reboot.
Linux guests usually enable MSI by themselves. To force use of MSI for GPU audio devices, use the following command and reboot.<syntaxhighlight lang="shell" line="1">
 
echo "options snd-hda-intel enable_msi=1" | sudo tee /etc/modprobe.d/snd-hda-intel.conf
{{Collapse/begin}}
</syntaxhighlight><syntaxhighlight lang="shell" line="1">
sudo update-initramfs -u -k all
</syntaxhighlight>Use <code>lspci -vv</code> and check for the following line on your device to see if MSI is enabled.{{Collapse/begin}}
<syntaxhighlight lang="shell" line="1">
<syntaxhighlight lang="shell" line="1">
sudo lspci -nnv -s 09:00
sudo lspci -nnv -s 09:00
Line 65: Line 67:
Kernel modules: snd_hda_intel
Kernel modules: snd_hda_intel
</syntaxhighlight>
</syntaxhighlight>
{{collapse/end}}
{{collapse/end}}If it says <code>Enable+</code>, MSI is working, <code>Enable-</code> means it is supported but disabled, and if the line is missing, MSI is not supported by the PCIe hardware.
 
This can potentially also improve performance for other passthrough devices, including GPUs, but that depends on the hardware being used.


=== References ===
=== References ===
* [https://forums.unraid.net/topic/40593-windows-10-vm-losing-audio/?tab=comments#comment-398133 UNRAID Forums: Windows 10 VM Losing Audio]  
* UNRAID Forums: [https://forums.unraid.net/topic/40593-windows-10-vm-losing-audio/?tab=comments#comment-398133 Windows 10 VM Losing Audio]
* [https://forums.unraid.net/topic/44025-kernel-disabling-irq-16/page/2/ UNRAID Forums: Kernel Disabling IRQ #16]
* UNRAID Forums: [https://forums.unraid.net/topic/44025-kernel-disabling-irq-16/page/2/ Kernel Disabling IRQ #16]
* [https://listman.redhat.com/archives/vfio-users/2017-May/msg00046.html RedHat ListMAN: Kernel panic at vfio_intx_handler leads to low performance in guest VM]
* RedHat ListMAN: [https://listman.redhat.com/archives/vfio-users/2017-May/msg00046.html Kernel panic at vfio_intx_handler leads to low performance in guest VM]
* [http://vfio.blogspot.com/2014/08/vfiovga-faq.html Alex Williamson: VFIO tips and tricks (at vifo.blogspot.com): Usefully Q&A]
* Alex Williamson: [http://vfio.blogspot.com/2014/08/vfiovga-faq.html VFIO tips and tricks (at vifo.blogspot.com): Usefully Q&A]
* [https://pve.proxmox.com/wiki/Pci_passthrough#HDMI_Audio_crackling.2Fbroken Proxmox Wiki: Pci passthrough » HDMI Audio crackling/broken]
* Proxmox Wiki: [[pve:Pci_passthrough#HDMI_Audio_crackling.2Fbroken|'''Pci passthrough » HDMI Audio crackling/broken''']]


== Hide the Warnings KVM: vcpu0 ignored rdmsr ==
== Hide the Warnings KVM: vcpu0 ignored rdmsr ==

Revision as of 14:21, 2 September 2022

Guest GPU Au­dio Crack­ling and IRQ xx: No­body Cared Fix

Win­dows

The so­lu­tion of the is­sue Guest GPU HD­MI Au­dio Crack­ling, Bro­ken or Los­ing is well ex­plained by Jonp at UN­RAID Fo­rums. In short we must try to en­able the MSI – Mes­sage Sig­naled In­ter­rupts op­tion if the de­vice sup­port it. Here is a de­tailed step-by-step in­struc­tion how to do that.

I was men­tioned the ker­nel com­mand irqpool as so­lu­tion for this is­sue, but in my opin­ion and ac­cord­ing to some oth­er posts, pro­vid­ed in the ref­er­ences sec­tion, this set­ting is an ac­tu­al so­lu­tion for the prob­lem irq 44: no­body cared (try boot­ing with the "irqpool" op­tion); han­dlers: vfio_​​​intx_​​​handler; Dis­abling IRQ #44, that ap­pears at my sys­tem when boot­ing a VM with GPU passthrough with a dis­play at­tached to it, which was caus­ing host sys­tem re­boot.

Lin­ux

Lin­ux guests usu­al­ly en­able MSI by them­selves. To force use of MSI for GPU au­dio de­vices, use the fol­low­ing com­mand and re­boot.

echo "options snd-hda-intel enable_msi=1" | sudo tee /etc/modprobe.d/snd-hda-intel.conf
sudo update-initramfs -u -k all

Use lsp­ci ‑vv and check for the fol­low­ing line on your de­vice to see if MSI is en­abled.

sudo lspci -nnv -s 09:00
#Out­put
09:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU117GL [T600] [10de:1fb1] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: NVIDIA Corporation TU117GL [T600] [10de:1488]
	Flags: bus master, fast devsel, latency 0, IRQ 103, IOMMU group 23
	Memory at fb000000 (32-bit, non-prefetchable) [size=16M]
	Memory at 7fd0000000 (64-bit, prefetchable) [size=256M]
	Memory at 7fe0000000 (64-bit, prefetchable) [size=32M]
	I/O ports at f000 [size=128]
	Expansion ROM at fc000000 [virtual] [disabled] [size=512K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Legacy Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [250] Latency Tolerance Reporting
	Capabilities: [258] L1 PM Substates
	Capabilities: [128] Power Budgeting <?>
	Capabilities: [420] Advanced Error Reporting
	Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
	Capabilities: [900] Secondary PCI Express
	Capabilities: [bb0] Physical Resizable BAR
	Kernel driver in use: nvidia
	Kernel modules: nouveau, nvidia_drm, nvidia

09:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:10fa] (rev a1)
	Subsystem: NVIDIA Corporation Device [10de:1488]
	Flags: bus master, fast devsel, latency 0, IRQ 99, IOMMU group 23
	Memory at fc080000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel

If it says En­able+, MSI is work­ing, En­able- means it is sup­port­ed but dis­abled, and if the line is miss­ing, MSI is not sup­port­ed by the PCIe hard­ware.

This can po­ten­tial­ly al­so im­prove per­for­mance for oth­er passthrough de­vices, in­clud­ing GPUs, but that de­pends on the hard­ware be­ing used.

Ref­er­ences

Hide the Warn­ings KVM: vcpu0 ig­nored rdm­sr

sudo nano /etc/modprobe.d/kvm.conf
options kvm report_ignored_msrs=0 # Or: GRUB_CMDLINE_LINUX_DEFAULT="... kvm.report_ignored_msrs=0 ..."
sudo update-initramfs -u -k all
  • Note, ac­cord­ing to my ex­pe­ri­ence, this op­tion may cause crash­es of the host sys­tem!?

Ref­er­ences

KVM Mod­e­in­fo

modinfo kvm
filename:       /lib/modules/5.4.0-77-generic/kernel/arch/x86/kvm/kvm.ko
license:        GPL
author:         Qumranet
srcversion:     20C68083F39E14AB616D0B8
depends:
retpoline:      Y
intree:         Y
name:           kvm
vermagic:       5.4.0-77-generic SMP mod_unload modversions
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        67:66:2F:F8:26:8F:56:E9:37:7F:B7:AD:33:FA:97:31:CA:7F:FF:50
sig_hashalgo:   sha512
signature:      6C:0B:65:F9:46:AC:D8:B7:94:E8:B9:9D:A0:4B:97:E6:63:52:5A:FF:
                ...
parm:           nx_huge_pages:bool
parm:           nx_huge_pages_recovery_ratio:uint
parm:           ignore_msrs:bool
parm:           report_ignored_msrs:bool
parm:           min_timer_period_us:uint
parm:           kvmclock_periodic_sync:bool
parm:           tsc_tolerance_ppm:uint
parm:           lapic_timer_advance_ns:int
parm:           vector_hashing:bool
parm:           enable_vmware_backdoor:bool
parm:           force_emulation_prefix:bool
parm:           pi_inject_timer:bint
parm:           halt_poll_ns:uint
parm:           halt_poll_ns_grow:uint
parm:           halt_poll_ns_grow_start:uint
parm:           halt_poll_ns_shrink:uint