$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T22:39:10.092864Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.0,addr=0x2: VFIO_MAP_DMA failed: Invalid argument
2023-03-04T22:39:10.161600Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.0,addr=0x2: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_map(0x564f10c231f0, 0x100000000, 0xfc00100000, )
$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T23:23:04.256407Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.0,addr=0x2: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
2023-03-04T23:23:04.333731Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.0,addr=0x2: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_map(0x564d804e61f0, 0x100000000, 0xfc00100000, 0x7e27d9400000) = -22 (Invalid argument)
...
$ sed s/1035265/1035264/ -i vm.xml
$ virsh create vm.xml
[ 323.339015] Out of memory: Killed process 1620 (qemu-system-x86) total-vm:1060989352kB, anon-rss:3738620kB, file-rss:2480kB, shmem-rss:0kB, UID:64055 pgtables:7492kB oom_score_adj:0
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
$ virsh create vm.xml
[ 405.938376] Out of memory: Killed process 1758 (qemu-system-x86) total-vm:1060989352kB, anon-rss:3729028kB, file-rss:2612kB, shmem-rss:0kB, UID:64055 pgtables:7460kB oom_score_adj:0
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T22:39:49.891100Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.3,addr=0x1: VFIO_MAP_DMA failed: Invalid argument
2023-03-04T22:39:49.940878Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.3,addr=0x1: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_map(0x5654f92fed40, 0x100000000, 0xfc00100000, )
$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T23:22:37.437632Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.3,addr=0x1: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
2023-03-04T23:22:37.475306Z qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0,id=hostdev0,bus=pci.3,addr=0x1: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_map(0x563958b30d40, 0x100000000, 0xfc00100000, 0x7eff31400000) = -22 (Invalid argument)
...
$ sed s/1034241/1034240/ -i vm.xml
$ virsh create vm.xml
[ 369.439912] Out of memory: Killed process 1692 (qemu-system-x86) total-vm:1059950088kB, anon-rss:3741496kB, file-rss:2632kB, shmem-rss:0kB, UID:64055 pgtables:7492kB oom_score_adj:0
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
$ virsh create vm.xml
[ 347.505012] Out of memory: Killed process 1652 (qemu-system-x86) total-vm:1059950088kB, anon-rss:3734352kB, file-rss:2648kB, shmem-rss:0kB, UID:64055 pgtables:7468kB oom_score_adj:0
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
Test steps on Jammy.
Output is provided for each test with the QEMU versions in -updates and test packages in a PPA.
RELEASE=jammy
...
$ dpkg -s qemu-system-x86 | grep Version: 2ubuntu6. 6
Version: 1:6.2+dfsg-
$ dpkg -s qemu-system-x86 | grep Version: 2ubuntu6. 7
Version: 1:6.2+dfsg-
...
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265 host=0000: 00:03.0: VFIO_MAP_DMA failed: Invalid argument host=0000: 00:03.0: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x55622b0fe d30, 0x100000000, 0xfc00100000, 0x7ec3e5400000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,
qemu-system-x86_64: -device vfio-pci,
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265 host=0000: 00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram) host=0000: 00:03.0: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x5650c6e5f d30, 0x100000000, 0xfc00100000, 0x7eca21400000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,
qemu-system-x86_64: -device vfio-pci,
...
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264 1060937100kB, anon-rss:3748652kB, file-rss:2672kB, shmem-rss:0kB, UID:0 pgtables:7508kB oom_score_adj:0
[ 234.987422] Out of memory: Killed process 1525 (qemu-system-x86) total-vm:
Killed
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264 1060937100kB, anon-rss:3738324kB, file-rss:2404kB, shmem-rss:0kB, UID:0 pgtables:7484kB oom_score_adj:0
[ 263.021576] Out of memory: Killed process 1547 (qemu-system-x86) total-vm:
Killed
...
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241 host=0000: 00:03.0: VFIO_MAP_DMA failed: Invalid argument host=0000: 00:03.0: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x55f6c1e06 7b0, 0x100000000, 0xfc00100000, 0x7ef2b1400000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,
qemu-system-x86_64: -device vfio-pci,
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241 host=0000: 00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram) host=0000: 00:03.0: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x55d58ab8c 7b0, 0x100000000, 0xfc00100000, 0x7e3b85400000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,
qemu-system-x86_64: -device vfio-pci,
...
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240 1059888832kB, anon-rss:3748872kB, file-rss:2408kB, shmem-rss:0kB, UID:0 pgtables:7508kB oom_score_adj:0
[ 274.289579] Out of memory: Killed process 1545 (qemu-system-x86) total-vm:
Killed
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240 1059888832kB, anon-rss:3740256kB, file-rss:2520kB, shmem-rss:0kB, UID:0 pgtables:7492kB oom_score_adj:0
[ 319.704136] Out of memory: Killed process 1614 (qemu-system-x86) total-vm:
Killed
...
$ cat vm.xml
<domain type='qemu'>
<name>vm</name>
<os> 'pc'>hvm< /type>
<type arch='x86_64' machine=
</os>
<memory unit='MiB' >1035265< /memory>
<devices>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</source>
</hostdev>
</devices>
</domain>
$ virsh create vm.xml 04T22:39: 10.092864Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 0,addr= 0x2: VFIO_MAP_DMA failed: Invalid argument 04T22:39: 10.161600Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 0,addr= 0x2: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x564f10c23 1f0, 0x100000000, 0xfc00100000, )
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-
2023-03-
$ virsh create vm.xml 04T23:23: 04.256407Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 0,addr= 0x2: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram) 04T23:23: 04.333731Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 0,addr= 0x2: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x564d804e6 1f0, 0x100000000, 0xfc00100000, 0x7e27d9400000) = -22 (Invalid argument)
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-
2023-03-
...
$ sed s/1035265/1035264/ -i vm.xml
$ virsh create vm.xml 1060989352kB, anon-rss:3738620kB, file-rss:2480kB, shmem-rss:0kB, UID:64055 pgtables:7492kB oom_score_adj:0
[ 323.339015] Out of memory: Killed process 1620 (qemu-system-x86) total-vm:
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
$ virsh create vm.xml 1060989352kB, anon-rss:3729028kB, file-rss:2612kB, shmem-rss:0kB, UID:64055 pgtables:7460kB oom_score_adj:0
[ 405.938376] Out of memory: Killed process 1758 (qemu-system-x86) total-vm:
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
...
$ cat vm.xml
<domain type='qemu'>
<name>vm</name>
<os> 'q35'>hvm< /type>
<type arch='x86_64' machine=
</os>
<memory unit='MiB' >1034241< /memory>
<devices>
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</source>
</hostdev>
</devices>
</domain>
$ virsh create vm.xml 04T22:39: 49.891100Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 3,addr= 0x1: VFIO_MAP_DMA failed: Invalid argument 04T22:39: 49.940878Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 3,addr= 0x1: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x5654f92fe d40, 0x100000000, 0xfc00100000, )
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-
2023-03-
$ virsh create vm.xml 04T23:22: 37.437632Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 3,addr= 0x1: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram) 04T23:22: 37.475306Z qemu-system-x86_64: -device vfio-pci, host=0000: 00:03.0, id=hostdev0, bus=pci. 3,addr= 0x1: vfio 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed: Region pc.ram: vfio_dma_ map(0x563958b30 d40, 0x100000000, 0xfc00100000, 0x7eff31400000) = -22 (Invalid argument)
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-
2023-03-
...
$ sed s/1034241/1034240/ -i vm.xml
$ virsh create vm.xml 1059950088kB, anon-rss:3741496kB, file-rss:2632kB, shmem-rss:0kB, UID:64055 pgtables:7492kB oom_score_adj:0
[ 369.439912] Out of memory: Killed process 1692 (qemu-system-x86) total-vm:
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
$ virsh create vm.xml 1059950088kB, anon-rss:3734352kB, file-rss:2648kB, shmem-rss:0kB, UID:64055 pgtables:7468kB oom_score_adj:0
[ 347.505012] Out of memory: Killed process 1652 (qemu-system-x86) total-vm:
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor