[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#1102914: VMs don't start up when being passed through a PCI device



>On Sun, Apr 13, 2025 at 08:53:13AM +0200, Bernd Rinn wrote:
>> Package: linux-image-amd64
>> Version: 6.1.133-1
>>
>> Description:
>> I noticed a regression with the most recent kernel 6.1.0-33 (6.1.133) of
>Debian Bookworm:
>> libvirtd VMs don't start up anymore when they are being passed through
>> a PCI device (in my case the PCI device is a network card). The error message
>is:
>>
>> """
>> Apr 13 07:35:08 noc libvirtd\[4984\]: libvirt version: 9.0.0, package:
>> 9.0.0-4+deb12u2 (Debian) Apr 13 07:35:08 xyz libvirtd\[4984\]:
>> hostname: xyz Apr 13 07:35:08 xyz libvirtd\[4984\]: Unable to read
>> from monitor: Connection reset by peer Apr 13 07:35:08 xyz
>> libvirtd\[4984\]: internal error: qemu unexpectedly closed the
>> monitor: 2025-04-13T05:35:08.436709Z qemu-system-x86_64: -device
>{"driver":"vfio-pci","host":"0000:05:00.0","id":"hostdev0","bus":"
>> pci.8","addr":"0x0"}: VFIO_MAP_DMA failed: Cannot allocate memory
>> 2025-04-13T05:35:08.447462Z qemu-system-x86_64: -device
>{"driver":"vfio-pci","host":"0000:05:00.0","id":"hostdev0","bus":"pci.8","addr
>":"0x0"}:
>> vfio 0000:05:00.0: failed to set
>> """
>>
>> The definition of the PCI device pass through looks like this:
>>
>> """
>> <hostdev mode="subsystem" type="pci" managed="yes"> <driver
>> name="vfio"/> <source> <address domain="0x0000" bus="0x05"
>slot="0x00"
>> function="0x0"/> </source> <alias name="hostdev0"/> <address
>> type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
>> </hostdev> """
>>
>> When reverting the kernel back to previous version 6.1.0-32 (6.1.129),
>> the VM boots up OK, i.e. the error is gone.
>
>Given in the above PCI passthrough is involved I suspect this has the same root
>cause as #1102914 .
>
>Can you bisect the changes between 6.1.129 and 6.1.133 to identify the
>offending commit? Can you test 6.1.134 from upstream?

I met the same issue below when trying to launch a Qemu VM in one intel-x86-64 board when using Yocto Kirkstone project which uses Linux 6.1 branch.

root@intel-x86-64:~# virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2025-03-13T06:32:37.009365Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:15.0","id":"hostdev0","bus":"pci.0","addr":"0x5"}: VFIO_MAP_DMA failed: Cannot allocate memory
2025-03-13T06:32:37.009462Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:15.0","id":"hostdev0","bus":"pci.0","addr":"0x5"}: VFIO_MAP_DMA failed: Cannot allocate memory
2025-03-13T06:32:37.352332Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:15.0","id":"hostdev0","bus":"pci.0","addr":"0x5"}: VFIO_MAP_DMA failed: Cannot allocate memory
2025-03-13T06:32:37.372670Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:15.0","id":"hostdev0","bus":"pci.0","addr":"0x5"}: vfio 0000:00:15.0: failed to setup container for group 10: memory listener initialization failed: Region pc.rom: vfio_dma_map(0x5628d6130160, 0xc0000, 0x20000, 0x7fca12000000) = -2 (No such file or directory)

I tried to bisect my Linux 6.1 branch and found the bad commit was 476c1dfefab8. 

476c1dfefab8 mm: Don't pin ZERO_PAGE in pin_user_pages()

Regards,
Libo

>
>As mentioned in the other bugreport I will look at it ASAP.
>
>Regards,
>Salvatore


Reply to: