Bug 2155749

Summary: [regression][stable guest abi][qemu-kvm7.2]Migration failed due to virtio-rng device between RHEL8.8 and RHEL9.2/MSI-X
Product: Red Hat Enterprise Linux 9 Reporter: Min Deng <mdeng>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
qemu-kvm sub component: Live Migration QA Contact: Min Deng <mdeng>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: coli, jinzhao, juzhang, lijin, lvivier, virt-maint, yduan
Version: 9.2Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-7.2.0-4.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:23:43 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 Min Deng 2022-12-22 08:09:49 UTC
Description of problem:
[regression][stable guest abi][qemu-kvm7.2]Migration failed due to virtio-rng device between RHEL8.8 and RHEL9.2

Version-Release number of selected component (if applicable):
RHEL 8.8.0
kernel-4.18.0-446.el8.x86_64
qemu-kvm-6.2.0-27.module+el8.8.0+17473+3286524b.x86_64
RHEL 9.2.0
kenrel-5.14.0-212.el9.x86_64
How reproducible:
5/5
Steps to Reproduce:
1.boot up guest as follow command on src host
/usr/libexec/qemu-kvm -device virtio-rng-pci,id=rng0,rng=objrng0 -object rng-builtin,id=objrng0 -monitor stdio -cpu Icelake-Server -machine pc-q35-rhel8.6.0
On dst host
/usr/libexec/qemu-kvm -device virtio-rng-pci,id=rng0,rng=objrng0 -object rng-builtin,id=objrng0 -monitor stdio -cpu Icelake-Server -machine pc-q35-rhel8.6.0 -incoming defer

or just attached "-device virtio-rng-pci,id=rng0 ..."

2. do live migration
on dst, migrate_incoming tcp:[::]:5800
..
on src, migrate -d tcp:10.73.211.14:5800

Actual results:
On dst,
qemu) migrate_incoming tcp:[::]:5800
(qemu) qemu-kvm: get_pci_config_device: Bad config data: i=0x34 read: 84 device: 98 cmask: ff wmask: 0 w1cmask:0
qemu-kvm: Failed to load PCIDevice:config
qemu-kvm: Failed to load virtio-rng:virtio
qemu-kvm: error while loading state for instance 0x0 of device '0000:00:04.0/virtio-rng'
qemu-kvm: load of migration failed: Invalid argument

Expected results:
Migration completes without any problems.

Additional info:
The issue wasn't reproduced with build qemu-kvm-7.1.0-7.el9.x86_64.rpm
it's not reproducible on local migration on rhel9.2 host

Comment 2 Dr. David Alan Gilbert 2023-01-05 09:44:56 UTC
Could you please boot the guest on both 8.8 and 9.2 and give me the output of :

sudo lspci -vvv

for both guests.

Comment 5 Dr. David Alan Gilbert 2023-01-09 09:28:08 UTC
Thanks, the main difference there is MSI-X on the virtio-rng:

rhel8:
	Region 4: Memory at 5000300000 (64-bit, prefetchable) [size=16K]
rhel9:
	Region 1: Memory at c2000000 (32-bit, non-prefetchable) [size=4K]
	Region 4: Memory at 5000300000 (64-bit, prefetchable) [size=16K]
	Capabilities: [dc] MSI-X: Enable+ Count=2 Masked-
		Vector table: BAR=1 offset=00000000
		PBA: BAR=1 offset=00000800

(There are some minor MSI address differences on other devices, I'm not sure how important those are)

Comment 6 Dr. David Alan Gilbert 2023-01-09 09:38:24 UTC
This looks like it was caused by upstream 9ea02e8f13068d5f902c4bce909de2997fd77e41 in 7.2.0

Comment 7 Dr. David Alan Gilbert 2023-01-09 11:00:12 UTC
Posted upstream:
0001-virtio-rng-pci-fix-migration-compat-for-vectors.patch

Comment 9 Yanan Fu 2023-01-13 03:25:55 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 12 Min Deng 2023-01-17 02:36:41 UTC
Reproduced the issue with build qemu-kvm-7.2.0-2.el9
Verified the bug on the following builds
Source host: RHEL 8.6.z
qemu-kvm-6.2.0-11.module+el8.6.0+17576+33ee06a8.7.x86_64
kernel - 4.18.0-372.41.1.el8_6.x86_64
seabios-bin-1.15.0-2.module+el8.6.0+14757+c25ee005.noarch
edk2-ovmf-20220126gitbb1bba3d77-2.el8.noarch
Destination host:
qemu-kvm-block-curl-7.2.0-4.el9.x86_64
5.14.0-234.el9.x86_64
seabios-bin-1.16.1-1.el9.noarch
edk2-ovmf-20221207gitfff6d81270b5-2.el9.noarch
Verified the issue on the fix build, the migration can finish without issues.

Notes, will also provide the test results from rhel 8.8 to rhel9.2 later.

Thanks.

Comment 13 Min Deng 2023-01-18 05:25:02 UTC
Also tried the build between rhel8.8 to rhel9.2, 
rhel 8.8
kernel-4.18.0-449.el8.x86_64
qemu-kvm-6.2.0-28.module+el8.8.0+17721+63bacee8.x86_64
rhel9.2
kenrel-5.14.0-234.el9.x86_64
qemu-kvm-7.2.0-4.el9.x86_64
the test passed. The issue should be fixed well.

Comment 14 Min Deng 2023-01-18 05:25:48 UTC
Base on comment 12 and comment13, move this bug to be verified. Thanks.

Comment 15 Dr. David Alan Gilbert 2023-02-06 11:43:39 UTC
FYI the upstream equivalent of this is now merged as :

bad9c5a5166fd5e3a892b7b0477cf2f4bd3a959a 
virtio-rng-pci: fix migration compat for vectors

Comment 19 errata-xmlrpc 2023-05-09 07:23:43 UTC
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:2162