PCI passthrough on AMD IOMMU fails with "VFIO_MAP_DMA failed: Invalid argument" for VMs with ~1 TiB RAM or more

Bug #2009048 reported by Mauricio Faria de Oliveira
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qemu (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Wishlist
Mauricio Faria de Oliveira
Focal
Fix Released
Wishlist
Mauricio Faria de Oliveira
Jammy
Fix Released
Wishlist
Mauricio Faria de Oliveira
Kinetic
Fix Released
Wishlist
Mauricio Faria de Oliveira
Lunar
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

 * PCI passthrough on systems with AMD IOMMU
   for VMs with approximately 1 terabyte RAM
   or more will fail with this error message
   that is not trivial to diagnose to relate
   to the root cause (AMD IOMMU limitation):

   VFIO_MAP_DMA failed: Invalid argument.
   failed to setup container for group ...:
     memory listener initialization failed: Region pc.ram:
     vfio_dma_map(...) = -22 (Invalid argument)

 * The usage of AMD-based systems with IOMMU
   is increasingly common, and apparently VMs
   with increasingly more RAM are also rising.

 * The maximum memory (limitation) for QEMU VMs
   with PCI passthorugh on AMD IOMMU systems is:
   - machine 'pc': 1035264 MiB (1011 GiB)
   - machine 'q35': 1034240 MiB (1010 GiB)

 * This issue is resolved in QEMU 7.1 (lunar has
   QEMU 7.2 in -proposed, currently) with a large
   patch series that is not worth backporting for
   non-too common cases, given regression risk.

 * In order to improve the user experience on
   this particular error, check for this case,
   and provide the error message with a hint:

   VFIO_MAP_DMA failed: Invalid argument. (hint: AMD IOMMU: reduce VM ram)
   ...

[ Test Plan ]

 * Check for the error message/hint on QEMU VMs
   in the command line and libvirt, on pc / q35,
   with memory size at the limit values.

   The only change must be the hint on errors.

   Detailed steps in comment #1.

[ Regression Potential ]

 * The code changes are contained within the
   vfio_dma_map() function, and check for a
   1) specific error code from the kernel
   2) starting address match
   3) length in excess of spec-defined limit
   4) AMD CPU (for AMD IOMMU)

 * Thus, theoretical regression potential is
   restricted to PCI passthrough via VFIO,
   and tooling that expects error messages
   without the hint (should be unlikely to
   be this strict on the error path).

[ Other Info ]

 * Patch set:
   https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg03461.html

 * Git commits:

 $ git describe --contains e5b6555fb8e8a91dd1d6
 v7.1.0-rc0~1

 $ git show e5b6555fb8e8a91dd1d6
 ...
       i386/pc: restrict AMD only enforcing of 1Tb hole to new machine type
       i386/pc: relocate 4g start to 1T where applicable
       i386/pc: bounds check phys-bits against max used GPA
       i386/pc: factor out device_memory base/size to helper
       i386/pc: handle unitialized mr in pc_get_cxl_range_end()
       i386/pc: factor out cxl range start to helper
       i386/pc: factor out cxl range end to helper
       i386/pc: factor out above-4g end to an helper
       i386/pc: pass pci_hole64_size to pc_memory_init()
       i386/pc: create pci-host qdev prior to pc_memory_init()
       hw/i386: add 4g boundary start to X86MachineState
 ...

[ Original Description ]

$ virsh start vm
error: Failed to start domain 'vm'
error: internal error: qemu unexpectedly closed the monitor:
... qemu-system-x86_64: -device vfio-pci,...: VFIO_MAP_DMA failed: Invalid argument
... qemu-system-x86_64: -device vfio-pci,...: vfio 0000:a6:00.0:
failed to setup container for group 128: memory listener initialization failed: Region pc.ram:
vfio_dma_map(0x560368e65a30, 0x100000000, 0x1f340000000, 0x7d28c3e00000) = -22 (Invalid argument)

Changed in qemu (Ubuntu Lunar):
status: New → Fix Committed
Changed in qemu (Ubuntu Kinetic):
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Wishlist
assignee: nobody → Mauricio Faria de Oliveira (mfo)
Changed in qemu (Ubuntu Jammy):
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Mauricio Faria de Oliveira (mfo)
Changed in qemu (Ubuntu Focal):
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Mauricio Faria de Oliveira (mfo)
Changed in qemu (Ubuntu Bionic):
status: New → Triaged
importance: Undecided → Wishlist
assignee: nobody → Mauricio Faria de Oliveira (mfo)
description: updated
description: updated
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (5.2 KiB)

Test Steps
---

1) Create cloud-init data ISO to initialize cloud images:

 cat >meta-data <<EOF
 instance-id: iid-local01
 local-hostname: qemu-vm
 EOF

 cat >user-data <<EOF
 #cloud-config
 password: passw0rd
 chpasswd: { expire: False }
 ssh_pwauth: True
 EOF

 genisoimage -output cloud-init-data.iso -volid cidata -joliet -rock user-data meta-data

2) Download cloud image, and create larger disk image:

 for RELEASE in kinetic jammy focal bionic; do
   wget https://cloud-images.ubuntu.com/$RELEASE/current/$RELEASE-server-cloudimg-amd64.img

   qemu-img create -f qcow2 -F qcow2 -b $RELEASE-server-cloudimg-amd64.img $RELEASE.qcow2 8G
 done

Now, for each RELEASE:

3) Run QEMU to emulate an AMD IOMMU system, with an audio device to be used for PCI passthrough.

(We'll run QEMU inside it, to verify the changes, as it running in a bare-metal AMD system).

 qemu-system-x86_64 \
   -accel kvm -machine q35 -smp 1 -m 4G \
   -nodefaults -nographic -no-user-config \
   -serial stdio \
   \
   -drive file=$RELEASE.qcow2,if=virtio \
   -drive file=cloud-init-data.iso,if=virtio,read-only=on,driver=raw \
   \
   -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22 \
   -device virtio-net,netdev=net0 \
   \
   -cpu EPYC-v1 \
   -device amd-iommu \
   -device intel-hda

 ...
 login: ubuntu
 password: passw0rd
 ...
 (watch out for ctrl-c)

 or
 ssh ubuntu@127.0.0.1 -p 2222 # passw0rd

...

4) We'll need qemu-system-x86_64 and virsh/libvirt

 sudo apt update && sudo apt install --yes --no-install-recommends qemu-system libvirt-daemon-system
 logout # login again

5) Check the emulated hardware (and reserved ranges just below 1TiB on all IOMMU groups)

 $ grep 'AMD EPYC' /proc/cpuinfo
 model name : AMD EPYC Processor

 $ lspci | grep -i iommu
 00:02.0 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 0010

 $ grep reserved /sys/kernel/iommu_groups/*/reserved_regions
 /sys/kernel/iommu_groups/0/reserved_regions:0x000000fd00000000 0x000000ffffffffff reserved
 /sys/kernel/iommu_groups/1/reserved_regions:0x000000fd00000000 0x000000ffffffffff reserved
 /sys/kernel/iommu_groups/2/reserved_regions:0x000000fd00000000 0x000000ffffffffff reserved
 /sys/kernel/iommu_groups/3/reserved_regions:0x000000fd00000000 0x000000ffffffffff reserved
 /sys/kernel/iommu_groups/4/reserved_regions:0x000000fd00000000 0x000000ffffffffff reserved

6) Configure the audio device for PCI passthrough

 $ lspci | grep -i audio
 00:03.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 01)

 $ ls /sys/bus/pci/devices/0000:00:03.0/iommu_group/devices/
 0000:00:03.0

 PCI=0000:00:03.0

 sudo modprobe vfio-pci
 echo vfio-pci | sudo tee /sys/bus/pci/devices/$PCI/driver_override

 echo $PCI | sudo tee /sys/bus/pci/devices/$PCI/driver/unbind 2>/dev/null; sleep 1
 echo $PCI | sudo tee /sys/bus/pci/drivers/vfio-pci/bind; sleep 1

 echo 1 | sudo tee /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts

7) Enable memory overcommit to allow early start of VM w/ 1TB RAM:

 echo 1 | sudo tee /proc/sys/vm/overcommit_memory

8) Verify the error with memory size above limit:

 $ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Test Steps on QEMU 7.2 (lunar-proposed), which addresses the issue:

RELEASE=lunar

 $ apt policy qemu-system-x86
 qemu-system-x86:
   Installed: 1:7.2+dfsg-4ubuntu1
   Candidate: 1:7.2+dfsg-4ubuntu1
   Version table:
  *** 1:7.2+dfsg-4ubuntu1 100
  100 http://security.ubuntu.com/ubuntu lunar-proposed/main amd64 Packages
  100 http://archive.ubuntu.com/ubuntu lunar-proposed/main amd64 Packages
  100 /var/lib/dpkg/status
      1:7.0+dfsg-7ubuntu4 500
  500 http://archive.ubuntu.com/ubuntu lunar/main amd64 Packages

The VM now mentions it needs more phys-bits for the 1+ TiB assignment/usage (~2 TiB in this example)

 $ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 2048000
 qemu-system-x86_64: Address space limit 0xffffffffff < 0x2f3bfffffff phys-bits too low (40)

If the physical bits are specified, the VFIO MAP DMA error no longer happens,
and we proceed to out-of-memory as expected.

 $ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 2048000 -cpu qemu64,phys-bits=48
 [ 578.875598] Out of memory: Killed process 2715 (qemu-system-x86) total-vm:2098083568kB, anon-rss:3749768kB, file-rss:2640kB, shmem-rss:0kB, UID:0 pgtables:7524kB oom_score_adj:0

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (7.9 KiB)

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:
Version: 1:7.0+dfsg-7ubuntu2.1

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:7.0+dfsg-7ubuntu2.2

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x55de52842110, 0x100000000, 0xfc00100000, 0x7e73d9400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x557b14b21110, 0x100000000, 0xfc00100000, 0x7e6221400000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 92.351799] Out of memory: Killed process 903 (qemu-system-x86) total-vm:1060937428kB, anon-rss:3758492kB, file-rss:2628kB, shmem-rss:0kB, UID:0 pgtables:7512kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 436.735278] Out of memory: Killed process 2559 (qemu-system-x86) total-vm:1060937428kB, anon-rss:3735972kB, file-rss:2568kB, shmem-rss:0kB, UID:0 pgtables:7488kB oom_score_adj:0
Killed

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x561beb4c85c0, 0x100000000, 0xfc00100000, 0x7ef375400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x561beb4c85c0, 0x100000000, 0xfc00100000, 0x7ef375400000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 119.865082] Out of memory: Killed process 918 (qemu-system-x86) total-vm:1059889168kB, anon-rss:3764036kB, file-rss:2636kB, shmem-rss:0kB, UID:0 pgtables:7536kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 463.268559] Out of memory: Killed process 2574 (qemu-system-x86) total-vm:1059889168kB, anon-rss:3737156kB, file-rss:2640kB, shmem-rss:0kB, UID:0 pgtables:7472kB o...

Read more...

description: updated
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (7.6 KiB)

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:
Version: 1:6.2+dfsg-2ubuntu6.6

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:6.2+dfsg-2ubuntu6.7

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x55622b0fed30, 0x100000000, 0xfc00100000, 0x7ec3e5400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x5650c6e5fd30, 0x100000000, 0xfc00100000, 0x7eca21400000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 234.987422] Out of memory: Killed process 1525 (qemu-system-x86) total-vm:1060937100kB, anon-rss:3748652kB, file-rss:2672kB, shmem-rss:0kB, UID:0 pgtables:7508kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 263.021576] Out of memory: Killed process 1547 (qemu-system-x86) total-vm:1060937100kB, anon-rss:3738324kB, file-rss:2404kB, shmem-rss:0kB, UID:0 pgtables:7484kB oom_score_adj:0
Killed

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x55f6c1e067b0, 0x100000000, 0xfc00100000, 0x7ef2b1400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x55d58ab8c7b0, 0x100000000, 0xfc00100000, 0x7e3b85400000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 274.289579] Out of memory: Killed process 1545 (qemu-system-x86) total-vm:1059888832kB, anon-rss:3748872kB, file-rss:2408kB, shmem-rss:0kB, UID:0 pgtables:7508kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 319.704136] Out of memory: Killed process 1614 (qemu-system-x86) total-vm:1059888832kB, anon-rss:3740256kB, file-rss:2520kB, shmem-rss:0kB, UID:0 pgtables:7492kB oom...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (7.5 KiB)

Test steps on Focal.

Output is provided for each test with the QEMU versions in -updates and test packages in a PPA.

RELEASE=focal

...

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.24

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.25

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,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(0x5643c9c67ed0, 0x100000000, 0xfc00100000, 0x7ec443e00000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x55d0eab24ed0, 0x100000000, 0xfc00100000, 0x7eeccfe00000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 309.250922] Out of memory: Killed process 2308 (qemu-system-x86) total-vm:1062539444kB, anon-rss:3792788kB, file-rss:2660kB, shmem-rss:0kB, UID:0 pgtables:7612kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
[ 701.552716] Out of memory: Killed process 3299 (qemu-system-x86) total-vm:1062539444kB, anon-rss:3797480kB, file-rss:2624kB, shmem-rss:0kB, UID:0 pgtables:7604kB oom_score_adj:0
Killed

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,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(0x56507a021d90, 0x100000000, 0xfc00100000, 0x7e147be00000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x557569ff5d90, 0x100000000, 0xfc00100000, 0x7e5b6be00000) = -22 (Invalid argument)

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 333.722501] Out of memory: Killed process 2348 (qemu-system-x86) total-vm:1061490748kB, anon-rss:3805964kB, file-rss:2612kB, shmem-rss:0kB, UID:0 pgtables:7640kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034240
[ 730.205077] Out of memory: Killed process 3309 (qemu-system-x86) total-vm:1061490748kB, anon-rss:3799620kB, file-rss:2704kB, shmem-rss:0kB, UID:0 pgtables:7616kB oom_score_adj:0
Killed

...

$ cat vm.xml
<domain type='qemu'>
  <name>vm</name>

  <os>
  ...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (10.1 KiB)

Test steps on Bionic.

Output is provided for each test with the QEMU versions in -updates and test packages in a PPA.

RELEASE=bionic

# only the 5.4 kernel validates the IOMMU reserved ranges

$ sudo apt install --yes --no-install-recommends linux-generic-hwe-18.04
$ sudo reboot

...

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.41

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.42

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035265
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio_dma_map(0x55c57a2aa790, 0x100000000, 0xfc00100000, 0x7e42dfe00000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio error: 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed for container: Invalid argument

qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio_dma_map(0x55b5cb9a9790, 0x100000000, 0xfc00100000, 0x7e545be00000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio error: 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed for container: Invalid argument

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
[ 148.065577] Out of memory: Killed process 1453 (qemu-system-x86) total-vm:1062679292kB, anon-rss:3872400kB, file-rss:4kB, shmem-rss:0kB, UID:0 pgtables:8100kB oom_score_adj:0
Killed

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M pc -m 1035264
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
[ 343.622730] Out of memory: Killed process 2082 (qemu-system-x86) total-vm:1062679292kB, anon-rss:3868344kB, file-rss:4kB, shmem-rss:0kB, UID:0 pgtables:8100kB oom_score_adj:0
Killed

...

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio_dma_map(0x55e792ec0e80, 0x100000000, 0xfc00100000, 0x7ea923e00000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio error: 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed for container: Invalid argument

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -M q35 -m 1034241
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Uploaded to k/j/f/b.

Marking as Fix Released on lunar (QEMU >= 7.1 migrated).

$ rmadison -a source -s lunar qemu
 qemu | 1:7.2+dfsg-4ubuntu1 | lunar | source

Changed in qemu (Ubuntu Kinetic):
status: Triaged → In Progress
Changed in qemu (Ubuntu Jammy):
status: Triaged → In Progress
Changed in qemu (Ubuntu Focal):
status: Triaged → In Progress
Changed in qemu (Ubuntu Bionic):
status: Triaged → In Progress
Changed in qemu (Ubuntu Lunar):
status: Fix Committed → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Mauricio, or anyone else affected,

Accepted qemu into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:7.0+dfsg-7ubuntu2.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in qemu (Ubuntu Kinetic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-kinetic
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (qemu/1:7.0+dfsg-7ubuntu2.2)

All autopkgtests for the newly accepted qemu (1:7.0+dfsg-7ubuntu2.2) for kinetic have finished running.
The following regressions have been reported in tests triggered by the package:

sbuild/0.83.1ubuntu1 (amd64)
ubuntu-image/2.2+22.04ubuntu3 (ppc64el)
dropbear/2022.82-4 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/kinetic/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification done on kinetic-proposed.

The error messages now include "(hint: AMD IOMMU: reduce VM ram)"
and are otherwise identical (except for pointers; it's expected).

Before:
------

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:7.0+dfsg-7ubuntu2.1

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x561a77cc8590, 0x100000000, 0xfc00100000, 0x7ebb21400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 153.681434] Out of memory: Killed process 3069 (qemu-system-x86) total-vm:1060937424kB, anon-rss:3722604kB, ...
Killed

After:
-----

$ sudo add-apt-repository -yp proposed
$ sudo apt install -y qemu-system-x86

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:7.0+dfsg-7ubuntu2.2

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x55a6ee2ff590, 0x100000000, 0xfc00100000, 0x7e6971400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 241.058329] Out of memory: Killed process 3830 (qemu-system-x86) total-vm:1060937424kB, anon-rss:3728976kB, ...
Killed

tags: added: verification-done-kinetic
removed: verification-needed-kinetic
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Autopkgtests regression seem to be unrelated; looking.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:7.0+dfsg-7ubuntu2.2

---------------
qemu (1:7.0+dfsg-7ubuntu2.2) kinetic; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden> Thu, 02 Mar 2023 17:29:05 -0300

Changed in qemu (Ubuntu Kinetic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for qemu has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Mauricio, or anyone else affected,

Accepted qemu into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:6.2+dfsg-2ubuntu6.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in qemu (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed-jammy
Changed in qemu (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Mauricio, or anyone else affected,

Accepted qemu into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:4.2-3ubuntu6.25 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Any particular reason why the patch for bionic and focal does not use strerror(errno) in error_report(), and just logs the errno value? Not a big deal, but I noticed it when comparing the fixes.

Changed in qemu (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed-bionic
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Mauricio, or anyone else affected,

Accepted qemu into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/qemu/1:2.11+dfsg-1ubuntu7.42 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (qemu/1:6.2+dfsg-2ubuntu6.7)

All autopkgtests for the newly accepted qemu (1:6.2+dfsg-2ubuntu6.7) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

initramfs-tools/0.140ubuntu13.1 (amd64)
ubuntu-image/2.2+22.04ubuntu3 (amd64, arm64, ppc64el)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (qemu/1:4.2-3ubuntu6.25)

All autopkgtests for the newly accepted qemu (1:4.2-3ubuntu6.25) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

livecd-rootfs/2.664.46 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (qemu/1:2.11+dfsg-1ubuntu7.42)

All autopkgtests for the newly accepted qemu (1:2.11+dfsg-1ubuntu7.42) for bionic have finished running.
The following regressions have been reported in tests triggered by the package:

systemd/237-3ubuntu10.57 (i386)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/bionic/update_excuses.html#qemu

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Hi Andreas,

> Any particular reason why the patch for bionic and focal does not use strerror(errno) in error_report(), and just logs the errno value? Not a big deal, but I noticed it when comparing the fixes.

This is due to the original call to error_report(), which uses strerror() in jammy only (not on focal/bionic) -- the patch just copies the original call, for simplicity.

$ git show pkg/ubuntu/jammy-proposed:debian/patches/ubuntu/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch | grep error_report
+ error_report("VFIO_MAP_DMA failed: %s (hint: AMD IOMMU: reduce VM ram)",
     error_report("VFIO_MAP_DMA failed: %s", strerror(errno));

$ git show pkg/ubuntu/focal-proposed:debian/patches/ubuntu/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch | grep error_report
+ error_report("VFIO_MAP_DMA: %d (hint: AMD IOMMU: reduce VM ram)",
     error_report("VFIO_MAP_DMA: %d", -errno);

$ git show pkg/ubuntu/bionic-proposed:debian/patches/ubuntu/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch | grep error_report
+ error_report("VFIO_MAP_DMA: %d (hint: AMD IOMMU: reduce VM ram)",
     error_report("VFIO_MAP_DMA: %d", -errno);

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification done on jammy.

...

$ lsb_release -cs
jammy

$ grep 'AMD EPYC' /proc/cpuinfo
model name : AMD EPYC Processor

$ lspci | grep -i iommu
00:02.0 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 0010

...

Before:
---

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:6.2+dfsg-2ubuntu6.6

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument
qemu-system-x86_64: -device vfio-pci,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(0x55e63d528420, 0x100000000, 0xfc00100000, 0x7ed58d400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 115.278933] Out of memory: Killed process 1095 (qemu-system-x86) total-vm:1060937092kB, anon-rss:3746972kB, file-rss:2540kB, shmem-rss:0kB, UID:0 pgtables:7492kB oom_score_adj:0
Killed
$

After:
---

$ sudo add-apt-repository -yp proposed
$ sudo apt install -y qemu-system-x86

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:6.2+dfsg-2ubuntu6.7

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA failed: Invalid argument (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x563f1fdfa420, 0x100000000, 0xfc00100000, 0x7e76fd400000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 68.494579] Out of memory: Killed process 1036 (qemu-system-x86) total-vm:1060937092kB, anon-rss:3742544kB, file-rss:2644kB, shmem-rss:0kB, UID:0 pgtables:7496kB oom_score_adj:0
Killed

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification done on focal.

...

$ lsb_release -cs
focal

$ grep 'AMD EPYC' /proc/cpuinfo
model name : AMD EPYC Processor

$ lspci | grep -i iommu
00:02.0 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 0010

...

Before:
---

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.24

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,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(0x561a25890a70, 0x100000000, 0xfc00100000, 0x7e7e7fe00000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 197.849263] Out of memory: Killed process 4968 (qemu-system-x86) total-vm:1062539320kB, anon-rss:3787224kB, file-rss:2624kB, shmem-rss:0kB, UID:0 pgtables:7600kB oom_score_adj:0
Killed

After:
---

$ sudo add-apt-repository -y 'deb http://archive.ubuntu.com/ubuntu focal-proposed main'
$ sudo apt install -y qemu-system-x86

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:4.2-3ubuntu6.25

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,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(0x5605ab3aea70, 0x100000000, 0xfc00100000, 0x7e79cbe00000) = -22 (Invalid argument)

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
[ 313.558785] Out of memory: Killed process 5747 (qemu-system-x86) total-vm:1062539320kB, anon-rss:3797352kB, file-rss:2668kB, shmem-rss:0kB, UID:0 pgtables:7616kB oom_score_adj:0
Killed

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification done on bionic.

...

ubuntu@qemu-vm:~$ lsb_release -cs
bionic

ubuntu@qemu-vm:~$ uname -rv
5.4.0-144-generic #161~18.04.1-Ubuntu SMP Fri Feb 10 15:55:22 UTC 2023

ubuntu@qemu-vm:~$ grep 'AMD EPYC' /proc/cpuinfo
model name : AMD EPYC Processor

ubuntu@qemu-vm:~$ lspci | grep -i iommu
00:02.0 IOMMU: Advanced Micro Devices, Inc. [AMD] Device 0010

...

Before:
---

ubuntu@qemu-vm:~$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.41

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio_dma_map(0x5638f21a7590, 0x100000000, 0xfc00100000, 0x7ec667e00000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio error: 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed for container: Invalid argument

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
[ 111.873129] Out of memory: Killed process 1316 (qemu-system-x86) total-vm:1062679240kB, anon-rss:3872536kB, file-rss:4kB, shmem-rss:0kB, UID:0 pgtables:8096kB oom_score_adj:0
Killed

After:
---

$ sudo add-apt-repository -y 'deb http://archive.ubuntu.com/ubuntu bionic-proposed main'
$ sudo apt install -y qemu-system-x86

$ dpkg -s qemu-system-x86 | grep Version:
Version: 1:2.11+dfsg-1ubuntu7.42

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035265
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: VFIO_MAP_DMA: -22 (hint: AMD IOMMU: reduce VM ram)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio_dma_map(0x5575a8825590, 0x100000000, 0xfc00100000, 0x7e2ac7e00000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=0000:00:03.0: vfio error: 0000:00:03.0: failed to setup container for group 2: memory listener initialization failed for container: Invalid argument

$ sudo qemu-system-x86_64 -nographic -device vfio-pci,host=$PCI -m 1035264
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
[ 176.751235] Out of memory: Killed process 2056 (qemu-system-x86) total-vm:1062679240kB, anon-rss:3871176kB, file-rss:4kB, shmem-rss:0kB, UID:0 pgtables:8112kB oom_score_adj:0
Killed

tags: added: verification-done verification-done-bionic verification-done-focal verification-done-jammy
removed: verification-needed verification-needed-bionic verification-needed-focal verification-needed-jammy
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

autopkgtests regressions cleared; unrelated to these changes.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I verified the test results and am satisfied that they show the executed planned test case, and that the results are correct.

The package built correctly in all architectures and Ubuntu releases it was meant for.

There are no DEP8 regressions at the moment.

There is no SRU freeze ongoing at the moment.

There is no halted phasing on the previous update.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:6.2+dfsg-2ubuntu6.7

---------------
qemu (1:6.2+dfsg-2ubuntu6.7) jammy; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)
  * d/rules: move "Disable LTO on non-amd64" before buildflags.mk on Jammy.

  [ Michal Maloszewski ]
  * d/rules: Disable LTO on non-amd 64 architectures to prevent QEMU
    coroutines from failing (LP: #1921664)

 -- Mauricio Faria de Oliveira <email address hidden> Mon, 06 Mar 2023 17:00:46 -0300

Changed in qemu (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:4.2-3ubuntu6.25

---------------
qemu (1:4.2-3ubuntu6.25) focal; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden> Thu, 02 Mar 2023 18:07:21 -0300

Changed in qemu (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu - 1:2.11+dfsg-1ubuntu7.42

---------------
qemu (1:2.11+dfsg-1ubuntu7.42) bionic; urgency=medium

  [ Brett Milford ]
  * d/p/u/lp1994002-migration-Read-state-once.patch: Fix for libvirt
    error 'migration was active, but no RAM info was set' (LP: #1994002)

  [ Mauricio Faria de Oliveira ]
  * d/p/u/lp2009048-vfio_map_dma_einval_amd_iommu_1tb.patch: Add hint
    to VFIO_MAP_DMA error on AMD IOMMU for VMs with ~1TB+ RAM (LP: #2009048)

 -- Mauricio Faria de Oliveira <email address hidden> Thu, 02 Mar 2023 18:26:12 -0300

Changed in qemu (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.