$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T23:27:57.955370Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:03.0","id":"hostdev0","bus":"pci.0","addr":"0x2"}: VFIO_MAP_DMA failed: Invalid argument
2023-03-04T23:27:58.033246Z qemu-system-x86_64: -device {"driver":"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(0x5627141a2040, 0x100000000, 0xfc00100000, 0x7e0a49400000) = -22 (Invalid argument)
$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T23:32:46.662885Z qemu-system-x86_64: -device {"driver":"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:32:46.705900Z qemu-system-x86_64: -device {"driver":"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(0x55ea7dcad040, 0x100000000, 0xfc00100000, 0x7eb631400000) = -22 (Invalid argument)
...
$ sed s/1035265/1035264/ -i vm.xml
$ virsh create vm.xml
[ 281.277086] Out of memory: Killed process 2044 (qemu-system-x86) total-vm:1060989740kB, anon-rss:3724768kB, file-rss:2568kB, shmem-rss:0kB, UID:64055 pgtables:7456kB 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
[ 522.966071] Out of memory: Killed process 2680 (qemu-system-x86) total-vm:1060989740kB, anon-rss:3734512kB, file-rss:2576kB, shmem-rss:0kB, UID:64055 pgtables:7472kB 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-04T23:28:46.042882Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:03.0","id":"hostdev0","bus":"pci.3","addr":"0x1"}: VFIO_MAP_DMA failed: Invalid argument
2023-03-04T23:28:46.097727Z qemu-system-x86_64: -device {"driver":"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(0x5634af190980, 0x100000000, 0xfc00100000, 0x7ef71d400000) = -22 (Invalid argument)
$ virsh create vm.xml
error: Failed to create domain from vm.xml
error: internal error: qemu unexpectedly closed the monitor: 2023-03-04T23:32:00.592090Z qemu-system-x86_64: -device {"driver":"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:32:00.629199Z qemu-system-x86_64: -device {"driver":"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(0x564878680980, 0x100000000, 0xfc00100000, 0x7e2985400000) = -22 (Invalid argument)
...
$ sed s/1034241/1034240/ -i vm.xml
$ virsh create vm.xml
[ 324.813508] Out of memory: Killed process 2119 (qemu-system-x86) total-vm:1059950540kB, anon-rss:3725672kB, file-rss:2544kB, shmem-rss:0kB, UID:64055 pgtables:7452kB 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
[ 484.549084] Out of memory: Killed process 2609 (qemu-system-x86) total-vm:1059950540kB, anon-rss:3734368kB, file-rss:2576kB, shmem-rss:0kB, UID:64055 pgtables:7476kB oom_score_adj:0
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor
Test steps on Kinetic.
Output is provided for each test with the QEMU versions in -updates and test packages in a PPA.
RELEASE=kinetic
...
$ dpkg -s qemu-system-x86 | grep Version: 7ubuntu2. 1
Version: 1:7.0+dfsg-
$ dpkg -s qemu-system-x86 | grep Version: 7ubuntu2. 2
Version: 1:7.0+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(0x55de52842 110, 0x100000000, 0xfc00100000, 0x7e73d9400000) = -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(0x557b14b21 110, 0x100000000, 0xfc00100000, 0x7e6221400000) = -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 1060937428kB, anon-rss:3758492kB, file-rss:2628kB, shmem-rss:0kB, UID:0 pgtables:7512kB oom_score_adj:0
[ 92.351799] Out of memory: Killed process 903 (qemu-system-x86) total-vm:
Killed
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264 1060937428kB, anon-rss:3735972kB, file-rss:2568kB, shmem-rss:0kB, UID:0 pgtables:7488kB oom_score_adj:0
[ 436.735278] Out of memory: Killed process 2559 (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(0x561beb4c8 5c0, 0x100000000, 0xfc00100000, 0x7ef375400000) = -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(0x561beb4c8 5c0, 0x100000000, 0xfc00100000, 0x7ef375400000) = -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 1059889168kB, anon-rss:3764036kB, file-rss:2636kB, shmem-rss:0kB, UID:0 pgtables:7536kB oom_score_adj:0
[ 119.865082] Out of memory: Killed process 918 (qemu-system-x86) total-vm:
Killed
$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240 1059889168kB, anon-rss:3737156kB, file-rss:2640kB, shmem-rss:0kB, UID:0 pgtables:7472kB oom_score_adj:0
[ 463.268559] Out of memory: Killed process 2574 (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 04T23:27: 57.955370Z qemu-system-x86_64: -device {"driver" :"vfio- pci","host" :"0000: 00:03.0" ,"id":" hostdev0" ,"bus": "pci.0" ,"addr" :"0x2"} : VFIO_MAP_DMA failed: Invalid argument 04T23:27: 58.033246Z qemu-system-x86_64: -device {"driver" :"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(0x5627141a2 040, 0x100000000, 0xfc00100000, 0x7e0a49400000) = -22 (Invalid argument)
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:32: 46.662885Z qemu-system-x86_64: -device {"driver" :"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:32: 46.705900Z qemu-system-x86_64: -device {"driver" :"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(0x55ea7dcad 040, 0x100000000, 0xfc00100000, 0x7eb631400000) = -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 1060989740kB, anon-rss:3724768kB, file-rss:2568kB, shmem-rss:0kB, UID:64055 pgtables:7456kB oom_score_adj:0
[ 281.277086] Out of memory: Killed process 2044 (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 1060989740kB, anon-rss:3734512kB, file-rss:2576kB, shmem-rss:0kB, UID:64055 pgtables:7472kB oom_score_adj:0
[ 522.966071] Out of memory: Killed process 2680 (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 04T23:28: 46.042882Z qemu-system-x86_64: -device {"driver" :"vfio- pci","host" :"0000: 00:03.0" ,"id":" hostdev0" ,"bus": "pci.3" ,"addr" :"0x1"} : VFIO_MAP_DMA failed: Invalid argument 04T23:28: 46.097727Z qemu-system-x86_64: -device {"driver" :"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(0x5634af190 980, 0x100000000, 0xfc00100000, 0x7ef71d400000) = -22 (Invalid argument)
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:32: 00.592090Z qemu-system-x86_64: -device {"driver" :"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:32: 00.629199Z qemu-system-x86_64: -device {"driver" :"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(0x564878680 980, 0x100000000, 0xfc00100000, 0x7e2985400000) = -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 1059950540kB, anon-rss:3725672kB, file-rss:2544kB, shmem-rss:0kB, UID:64055 pgtables:7452kB oom_score_adj:0
[ 324.813508] Out of memory: Killed process 2119 (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 1059950540kB, anon-rss:3734368kB, file-rss:2576kB, shmem-rss:0kB, UID:64055 pgtables:7476kB oom_score_adj:0
[ 484.549084] Out of memory: Killed process 2609 (qemu-system-x86) total-vm:
error: Failed to create domain from vm.xml
error: internal error: process exited while connecting to monitor