Bug 2229868
Summary: | [vfio migration]Disable postcopy for VM with migratable vfio device | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Yanghang Liu <yanghliu> |
Component: | qemu-kvm | Assignee: | Cédric Le Goater <clegoate> |
qemu-kvm sub component: | Live Migration | QA Contact: | Yanghang Liu <yanghliu> |
Status: | CLOSED ERRATA | Docs Contact: | |
Severity: | medium | ||
Priority: | medium | CC: | alex.williamson, chayang, clegoate, coli, gveitmic, jinzhao, juzhang, jwboyer, leiyang, lvivier, nilal, peterx, quintela, shdunne, virt-maint, yama, yanghliu, zhguo |
Version: | 9.3 | Keywords: | Triaged |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | qemu-kvm-8.0.0-16.el9_3 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-11-07 08:28:04 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Yanghang Liu
2023-08-08 06:06:05 UTC
Moved to backlog per internal discussion since it may be a while before this is implemented I don't know that anyone is considering enabling post-copy with device assignment. Doing so would certainly require support of IOMMU page faulting, which is some ways off. However the ability of these steps to trigger a fault and backtrace in QEMU is concerning. Do we need a means for a device to block post-copy? Indeed I am not aware of any explicit blocker for postcopy when there are assigned devices. It could have been overlooked when adding vfio migration for precopy, which silently allowed postcopy to also happen. To add it, one way to do is to fail the migration properly by checking ram_block_discard_is_disabled() (e.g., we can fail postcopy_start() when ram block discard is disabled). VFIO in this case should only be one provider of the features that will disable ram discard. In general postcopy should have issue as long as any page pinned, in this case I'd assume ram_block_discard_is_disabled() check would be the closest we can get so far from qemu. This should automatically also fail postcopy for other ram discard disable-ers, like vDPA. One thing I'm not sure though is we seem to have the failover-vf feature supported (which I am not extremely familiar with). In which case IIUC we'll have VFIO device but allow postcopy. But maybe it's fine: IIUC the vfio device needs to be unplugged before migration starts in that case (in replacement of the other pairing virtio device). Hopefully that unplug operation will also trigger a proper qemu_vfio_close() -> ram_block_discard_disable(false), so postcopy hopefully won't be affected in this case. But I really don't know enough on the feature to know. Copy Juan too. (In reply to Peter Xu from comment #4) > Indeed I am not aware of any explicit blocker for postcopy when there are > assigned devices. It could have been overlooked when adding vfio migration > for precopy, which silently allowed postcopy to also happen. > > To add it, one way to do is to fail the migration properly by checking > ram_block_discard_is_disabled() (e.g., we can fail postcopy_start() when ram > block discard is disabled). VFIO in this case should only be one provider > of the features that will disable ram discard. In general postcopy should > have issue as long as any page pinned, in this case I'd assume > ram_block_discard_is_disabled() check would be the closest we can get so far > from qemu. This should automatically also fail postcopy for other ram > discard disable-ers, like vDPA. > > One thing I'm not sure though is we seem to have the failover-vf feature > supported (which I am not extremely familiar with). In which case IIUC > we'll have VFIO device but allow postcopy. But maybe it's fine: IIUC the > vfio device needs to be unplugged before migration starts in that case (in > replacement of the other pairing virtio device). Hopefully that unplug > operation will also trigger a proper qemu_vfio_close() -> > ram_block_discard_disable(false), so postcopy hopefully won't be affected in > this case. But I really don't know enough on the feature to know. > > Copy Juan too. Here is a failover post-copy bug, we can do post-copy migration for failover, but still have some issue. Bug 1817965 - Live post-copy migration of the vm with failover VF device fails. This issue can be reproduced via libvirt: Test env: 5.14.0-355.el9.x86_64 qemu-kvm-8.0.0-13.el9.x86_64 libvirt-9.7.0-1.el9.x86_64 Test step: (1) create a MT2910 VF and setup the VF for migration (2) start a Q35 + SEABIOS RHEL93 domain <hostdev mode='subsystem' type='pci' managed='no'> <driver name='vfio'/> <source> <address domain='0x0000' bus='0xb1' slot='0x00' function='0x2'/> </source> <alias name='hostdev0'/> <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> </hostdev> (3) do post-copy migration for the domain $ sudo virsh migrate --verbose --live --postcopy --postcopy-after-precopy rhel93 qemu+ssh://10.8.3.15/system $ sudo virsh migrate-postcopy rhel93 (4) check the source qemu-kvm log 2023-09-01 09:19:04.792+0000: initiating migration 2023-09-01T09:19:08.861674Z qemu-kvm: failed to save SaveStateEntry with id(name): 3(ram): -5 2023-09-01T09:19:08.861782Z qemu-kvm: Detected IO failure for postcopy. Migration paused. (5) check the target qemu-kvm log: 2023-09-01T09:19:08.794938Z qemu-kvm: VFIO_MAP_DMA failed: Bad address 2023-09-01T09:19:08.794981Z qemu-kvm: vfio_dma_map(0x5596eb7ce630, 0xc0000, 0x7000, 0x7fb76e400000) = -2 (No such file or directory) qemu: hardware error: vfio: DMA mapping failed, unable to continue CPU #0: RAX=00000000ffffffa2 RBX=00007ffcbcb25c08 RCX=0000000000000001 RDX=0000000000000004 RSI=00007f5d5ffb7d94 RDI=00007ffcbcb25f82 RBP=000000000000434c RSP=00007ffcbcb25708 R8 =0000000000000000 R9 =0000000000000000 R10=0000000000000000 R11=00007f5d5fffac80 R12=00007ffcbcb25f80 R13=0000000000000006 R14=0000000000000004 R15=00007f5d5ffb7d94 RIP=00007f5d5fecff86 RFL=00000202 [-------] CPL=3 II=0 A20=1 SMM=0 HLT=0 ES =0000 0000000000000000 ffffffff 00c00000 CS =0033 0000000000000000 ffffffff 00a0fb00 DPL=3 CS64 [-RA] SS =002b 0000000000000000 ffffffff 00c0f300 DPL=3 DS [-WA] DS =0000 0000000000000000 ffffffff 00c00000 FS =0000 00007f5d60154240 ffffffff 00c00000 GS =0000 0000000000000000 ffffffff 00c00000 LDT=0000 0000000000000000 ffffffff 00c00000 TR =0040 fffffe0000003000 00004087 00008b00 DPL=0 TSS64-busy GDT= fffffe0000001000 0000007f IDT= fffffe0000000000 00000fff CR0=80050033 CR2=00007f5d6014a000 CR3=0000000102c1c006 CR4=00771ef0 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 DR6=00000000fffe0ff0 DR7=0000000000000400 EFER=0000000000000d01 FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80 FPR0=0000000000000000 0000 FPR1=0000000000000000 0000 FPR2=0000000000000000 0000 FPR3=0000000000000000 0000 FPR4=0000000000000000 0000 FPR5=0000000000000000 0000 FPR6=0000000000000000 0000 FPR7=0000000000000000 0000 Opmask00=0000000001000840 Opmask01=0000000000000001 Opmask02=00000000fffff7ff Opmask03=0000000000000000 Opmask04=0000000000000000 Opmask05=00000000fc00001d Opmask06=000000000000ec00 Opmask07=0000000000000000 ZMM00=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 00656c61636f6c2f 62696c2f7273752f ZMM01=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 00656c61636f6c2f 62696c2f7273752f ZMM02=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 5f5f004554415649 52505f4342494c47 ZMM03=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000068745f00 ZMM04=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 6c5f6c74706e5f5f 5f62645f64616572 ZMM05=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM06=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM07=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM08=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM09=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM10=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM11=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM12=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM13=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM14=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM15=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM16=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM17=0000000000000000 0000000000000000 0000000000000000 0000000000000000 3034323a383d4d41 455254535f4c414e 52554f4a00433d53 4547415353454d5f ZMM18=0000000000000000 0000000000000000 0000000000000000 0000000000000000 00007ffcbcb25f2f 0000000000000008 0000000000000010 00007f5d5fffbb00 ZMM19=0000000000000000 0000000000000000 0000000000000000 0000000000000000 4154454e4f4d5f43 4c2f386674752e43 2f656c61636f6c2f 62696c2f7273752f ZMM20=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000041 0000000000005952 4154454e4f4d5f43 4c2f386674752e43 ZMM21=0000000000000000 0000000000000000 0000000000000000 0000000000000000 000055c44df16d2e 000055c44df16d25 000055c44df16d70 000055c44df16d65 ZMM22=0000000000000000 0000000000000000 0000000000000000 0000000000000000 000055c44df16d59 000055c44df16d53 000055c44df16d14 000055c44df16d0c ZMM23=0000000000000000 0000000000000000 0000000000000000 0000000000000000 000055c44df16cfb 000055c44df16cf1 000055c44df16ce0 000055c44df16cd6 ZMM24=0000000000000000 0000000000000000 0000000000000000 0000000000000000 000055c44df16cc5 000055c44df16cbc 000055c44df16cab 000055c44df16ca4 ZMM25=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM26=0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ZMM27=0000000000000000 0000000000000000 0000000000000000 0000000000000000 00020e150d08bff2 fc2b352b262e2b37 202c1e2f2c34232a bff7ec051314ed02 ZMM28=0000000000000000 0000000000000000 0000000000000000 0000000000000000 bf2d202b20332022 bff0ecf8f4f7f7ec 0e1208ed0e0d1e21 2dbf2b202c2a2e21 ZMM29=0000000000000000 0000000000000000 0000000000000000 0000000000000000 4141414141414141 4141414141414141 4141414141414141 4141414141414141 ZMM30=0000000000000000 0000000000000000 0000000000000000 0000000000000000 1a1a1a1a1a1a1a1a 1a1a1a1a1a1a1a1a 1a1a1a1a1a1a1a1a 1a1a1a1a1a1a1a1a ZMM31=0000000000000000 0000000000000000 0000000000000000 0000000000000000 2020202020202020 2020202020202020 2020202020202020 2020202020202020 CPU #1: EAX=00000000 EBX=00000000 ECX=00000000 EDX=00080660 ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000 EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=1 ES =0000 00000000 0000ffff 00009300 CS =f000 ffff0000 0000ffff 00009b00 SS =0000 00000000 0000ffff 00009300 DS =0000 00000000 0000ffff 00009300 FS =0000 00000000 0000ffff 00009300 GS =0000 00000000 0000ffff 00009300 LDT=0000 00000000 0000ffff 00008200 TR =0000 00000000 0000ffff 00008b00 GDT= 00000000 0000ffff IDT= 00000000 0000ffff CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400 EFER=0000000000000000 FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80 FPR0=0000000000000000 0000 FPR1=0000000000000000 0000 FPR2=0000000000000000 0000 FPR3=0000000000000000 0000 FPR4=0000000000000000 0000 FPR5=0000000000000000 0000 FPR6=0000000000000000 0000 FPR7=0000000000000000 0000 XMM00=0000000000000000 0000000000000000 XMM01=0000000000000000 0000000000000000 XMM02=0000000000000000 0000000000000000 XMM03=0000000000000000 0000000000000000 XMM04=0000000000000000 0000000000000000 XMM05=0000000000000000 0000000000000000 XMM06=0000000000000000 0000000000000000 XMM07=0000000000000000 0000000000000000 CPU #2: EAX=00000000 EBX=00000000 ECX=00000000 EDX=00080660 ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000 EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=1 ES =0000 00000000 0000ffff 00009300 CS =f000 ffff0000 0000ffff 00009b00 SS =0000 00000000 0000ffff 00009300 DS =0000 00000000 0000ffff 00009300 FS =0000 00000000 0000ffff 00009300 GS =0000 00000000 0000ffff 00009300 LDT=0000 00000000 0000ffff 00008200 TR =0000 00000000 0000ffff 00008b00 GDT= 00000000 0000ffff IDT= 00000000 0000ffff CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400 EFER=0000000000000000 FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80 FPR0=0000000000000000 0000 FPR1=0000000000000000 0000 FPR2=0000000000000000 0000 FPR3=0000000000000000 0000 FPR4=0000000000000000 0000 FPR5=0000000000000000 0000 FPR6=0000000000000000 0000 FPR7=0000000000000000 0000 XMM00=0000000000000000 0000000000000000 XMM01=0000000000000000 0000000000000000 XMM02=0000000000000000 0000000000000000 XMM03=0000000000000000 0000000000000000 XMM04=0000000000000000 0000000000000000 XMM05=0000000000000000 0000000000000000 XMM06=0000000000000000 0000000000000000 XMM07=0000000000000000 0000000000000000 CPU #3: EAX=00000000 EBX=00000000 ECX=00000000 EDX=00080660 ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000 EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=1 ES =0000 00000000 0000ffff 00009300 CS =f000 ffff0000 0000ffff 00009b00 SS =0000 00000000 0000ffff 00009300 DS =0000 00000000 0000ffff 00009300 FS =0000 00000000 0000ffff 00009300 GS =0000 00000000 0000ffff 00009300 LDT=0000 00000000 0000ffff 00008200 TR =0000 00000000 0000ffff 00008b00 GDT= 00000000 0000ffff IDT= 00000000 0000ffff CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400 EFER=0000000000000000 FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80 FPR0=0000000000000000 0000 FPR1=0000000000000000 0000 FPR2=0000000000000000 0000 FPR3=0000000000000000 0000 FPR4=0000000000000000 0000 FPR5=0000000000000000 0000 FPR6=0000000000000000 0000 FPR7=0000000000000000 0000 XMM00=0000000000000000 0000000000000000 XMM01=0000000000000000 0000000000000000 XMM02=0000000000000000 0000000000000000 XMM03=0000000000000000 0000000000000000 XMM04=0000000000000000 0000000000000000 XMM05=0000000000000000 0000000000000000 XMM06=0000000000000000 0000000000000000 XMM07=0000000000000000 0000000000000000 2023-09-01 09:19:08.971+0000: shutting down, reason=failed Test with Cedric's build : https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=55043628 Test step: (1) create a MT2910 VF and setup the VF for migration (2) start a Q35 + SEABIOS RHEL93 domain (3) do post-copy migration for the domain $ sudo virsh migrate --verbose --live --postcopy --postcopy-after-precopy rhel93 qemu+ssh://10.8.3.15/system error: internal error: unable to execute QEMU command 'migrate': 0000:b1:00.2: VFIO migration is not supported with postcopy migration Test with Cedric's build : https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=55203844 Test result: PASS Test step: (1) create a MT2910 VF and setup the VF for migration (2) start a Q35 + OVMF RHEL93 domain (3) do post-copy migration for the domain $ sudo /bin/virsh migrate --verbose --persistent --postcopy --live rhel93-ovmf qemu+ssh://10.8.3.14/system error: internal error: unable to execute QEMU command 'migrate': 0000:b1:00.2: VFIO migration is not supported with postcopy migration QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass. Verification: Test env: qemu-kvm-8.0.0-16.el9_3.x86_64 Test result: PASS Test step: (1) create a MT2910 VF and setup the VF for migration (2) start a Q35 + SEABIOS RHEL93 VM (3) do post-copy migration for the VM # /bin/virsh migrate --verbose --persistent --postcopy --timeout 3 --timeout-postcopy --live rhel93-seabios qemu+ssh://10.73.212.98/system error: internal error: unable to execute QEMU command 'migrate': 0000:22:00.1: VFIO migration is not supported with postcopy migration Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: qemu-kvm security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2023:6368 |