Bug 2024435

Summary: ramfb='off' translate to wrong qemu option
Product: Red Hat Enterprise Linux 9 Reporter: Guo, Zhiyi <zhguo>
Component: libvirtAssignee: Peter Krempa <pkrempa>
libvirt sub component: General QA Contact: zhentang <zhetang>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: coli, jdenemar, jsuchane, juzhou, pkrempa, virt-maint, xuzhang, yafu
Version: 9.0Keywords: AutomationTriaged, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: libvirt-7.10.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 12:45:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.10.0
Embargoed:

Description Guo, Zhiyi 2021-11-18 05:24:58 UTC
Description of problem:
ramfb='off' translate to wrong qemu option

Version-Release number of selected component (if applicable):
libvirt-7.9.0-1.el9.x86_64
qemu-kvm-6.1.0-6.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Try to boot a intel vGPU VM with libvirt xml:
...
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on' ramfb='off'>
      <source>
        <address uuid='0328361c-ec35-4eb0-940f-0782bc5a1aa4'/>
      </source>
      <alias name='ua-0328361c-ec35-4eb0-940f-0782bc5a1aa4'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </hostdev>
...
2.
3.

Actual results:
Fail to boot VM and libvirt report error:
# virsh start rhel85_i915-GVTg_V5_4
error: Failed to start domain 'rhel85_i915-GVTg_V5_4'
error: internal error: qemu unexpectedly closed the monitor: 2021-11-18T05:22:32.739586Z qemu-kvm: -device vfio-pci,id=ua-0328361c-ec35-4eb0-940f-0782bc5a1aa4,sysfsdev=/sys/bus/mdev/devices/0328361c-ec35-4eb0-940f-0782bc5a1aa4,display=on,ramfb=off,bus=pci.7,addr=0x0: Property 'vfio-pci.ramfb' not found


Expected results:
vGPU VM can boot normally

Additional info:
This is a regression of libvirt-7.9.0-1.el9.x86_64, no such issue happen on libvirt-7.6.0-6.module+el8.5.0+13051+7ddbe958.x86_64

Comment 1 Peter Krempa 2021-11-18 08:14:36 UTC
Prior to the refactor which caused the above problem to pop-up the 'ramfb' property was added only if it was set to enabled.

Comment 2 Peter Krempa 2021-11-18 08:58:41 UTC
Patches posted for review:

https://listman.redhat.com/archives/libvir-list/2021-November/msg00487.html

Comment 3 Peter Krempa 2021-11-19 13:01:30 UTC
Fixed upstream by:

commit 84d1347dbe09743eec6d7b05c130923407c5e20f
Author: Peter Krempa <pkrempa>
Date:   Thu Nov 18 09:25:29 2021 +0100

    qemuxml2argvtest: Add device with 'ramfb=off' to 'hostdev-mdev-display-ramfb'
    
    Add a test case where 'ramfb' is explicitly disabled for a mediated
    device to prevent regressing again.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

commit c3bf7f5e620c6fe839df96e763b9aac2b110a369
Author: Peter Krempa <pkrempa>
Date:   Thu Nov 18 09:23:09 2021 +0100

    qemuBuildHostdevMediatedDevProps: Format 'ramfb' only when enabled
    
    Before commit 73c352ab8c97d3 which converted the hostdev commandline
    formatter to JSON the 'ramfb' property was formatted only if it was
    enabled.
    
    The main reason for that is that enabling 'ramfb' switches the device
    model to 'vfio-pci-nohotplug' which actually has the property, while
    'vfio-pci' (used when 'ramfb' is disabled or absent) doesn't have it.
    
    Restore the logic to format 'ramfb' only when it's enabled and add a
    comment that it's deliberate.
    
    Fixes: 73c352ab8c97d3
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024435
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

v7.9.0-186-g84d1347dbe

Comment 6 zhentang 2021-11-26 09:50:22 UTC
tested on the latest version: libvirt v7.10.0-rc1-2-gd120fc5253
It works well.

Comment 9 zhentang 2021-12-31 06:59:52 UTC
verified on 
libvirt-7.10.0-1.el9
qemu-kvm-6.2.0-1.el9

vGPU VM can boot normally as expected

# virsh start rhel8 
Domain 'rhel8' started

# virsh dumpxml rhel8
...
 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on' ramfb='off'>
      <source>
        <address uuid='8d08839c-e1ca-4b0a-b7b8-983f7876e18e'/>
      </source>
      <alias name='ua-0328361c-ec35-4eb0-940f-0782bc5a1aa4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </hostdev>
...

Comment 11 errata-xmlrpc 2022-05-17 12:45:52 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 (new packages: libvirt), 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-2022:2390