Bug 1728947 - Hot unplug vfio-pci NIC devices from sev guest will cause qemu-kvm: sev_ram_block_removed: failed to unregister region
Summary: Hot unplug vfio-pci NIC devices from sev guest will cause qemu-kvm: sev_ram_b...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Amnon Ilan
QA Contact: Pei Zhang
URL:
Whiteboard:
Depends On:
Blocks: 1728958
TreeView+ depends on / blocked
 
Reported: 2019-07-11 05:26 UTC by Pei Zhang
Modified: 2019-11-06 07:18 UTC (History)
9 users (show)

Fixed In Version: qemu-kvm-4.1.0-1.module+el8.1.0+3966+4a23dca1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1728958 (view as bug list)
Environment:
Last Closed: 2019-11-06 07:17:49 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 0 None None None 2019-11-06 07:18:16 UTC

Description Pei Zhang 2019-07-11 05:26:45 UTC
Description of problem:
Boot guest with sev and device assignment, qemu print failed info.

Version-Release number of selected component (if applicable):
kernel-4.18.0-114.el8.x86_64
qemu-kvm-4.0.0-5.module+el8.1.0+3622+5812d9bf.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot guest with sev and device assignment

/usr/libexec/qemu-kvm \
-enable-kvm \
-cpu EPYC \
-smp 4 \
-m 4G \
-object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \
-machine q35,memory-encryption=sev0 \
-drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/sev/OVMF_CODE.secboot.fd,readonly \
-drive if=pflash,format=raw,unit=1,file=/usr/share/edk2/ovmf/sev/OVMF_VARS.fd \
-device pcie-root-port,id=root.1,chassis=1 \
-device pcie-root-port,id=root.2,chassis=2 \
-device pcie-root-port,id=root.3,chassis=3 \
-device pcie-root-port,id=root.4,chassis=4 \
-device pcie-root-port,id=root.5,chassis=5 \
-device virtio-scsi-pci,iommu_platform=on,id=scsi0,bus=root.1,addr=0x0 \
-drive file=/home/sev_guest.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0 \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scssi0-0-0-0,bootindex=1 \
-netdev tap,id=hostnet0,vhost=off \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=18:66:da:57:dd:03,bus=root.2,iommu_platform=true \
-vnc :0 \
-monitor stdio \
-serial unix:/tmp/console,server,nowait \
-device vfio-pci,host=0000:e3:00.0,bus=root.3,id=pf1 \
-device vfio-pci,host=0000:e3:00.1,bus=root.4,id=pf2 \


2. Hot unplug vfio-pci devices, qemu prints error info:

(qemu) device_del pf1 
(qemu) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f5537000000+0x1000000)
qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f555ee1a000+0x8000)

(qemu) 
(qemu) device_del pf2
(qemu) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f555ec44000+0x8000)
qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f5536000000+0x1000000)


Actual results:
qemu prints failed info.


Expected results:
qemu should not print any failed info.

Additional info:
1. Both host and guest work well, only qemu terminal shows failed info.

Comment 3 Alex Williamson 2019-07-22 16:02:11 UTC
See bug 1728958, this is the same issue.  The fix is already in QEMU 4.1-rc1.  As this is against RHAV, I expect this should move to ON_QA, fixed in v4.1-rc1.

Comment 4 Eduardo Habkost 2019-07-22 16:50:29 UTC
As noted in comment #3, fixed by:

commit 56e2ec9488b3b281130e064929f8ae5595d6ac39
Author: Alex Williamson <alex.williamson>
Date:   Mon Jul 15 08:28:39 2019 -0600

    target/i386: sev: Do not unpin ram device memory region
    
    The commit referenced below skipped pinning ram device memory when
    ram blocks are added, we need to do the same when they're removed.
    
    Cc: Brijesh Singh <brijesh.singh>
    Cc: Paolo Bonzini <pbonzini>
    Fixes: cedc0ad539af ("target/i386: sev: Do not pin the ram device memory region")
    Signed-off-by: Alex Williamson <alex.williamson>
    Message-Id: <156320087103.2556.10983987500488190423.stgit>
    Reviewed-by: Singh, Brijesh <brijesh.singh>
    Signed-off-by: Paolo Bonzini <pbonzini>

Comment 6 Pei Zhang 2019-08-21 08:53:40 UTC
Verified with qemu-kvm-4.1.0-4.module+el8.1.0+4020+16089f93.x86_64:

Following steps of Description.

After hot plug PFs, qemu works well without any error. So this bug has been fixed very well.

Move to 'VERIFIED'.

Comment 8 errata-xmlrpc 2019-11-06 07:17:49 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, 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/RHBA-2019:3723


Note You need to log in before you can comment on or make changes to this bug.