Bug 1847791

Summary: Setting "ramfb='on'" in the mdev device does not save in the guest xml and only works once
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yafu <yafu>
Component: libvirtAssignee: Jonathon Jongsma <jjongsma>
Status: CLOSED ERRATA QA Contact: yafu <yafu>
Severity: high Docs Contact:
Priority: high    
Version: 8.2CC: chhu, dyuan, jdenemar, jjongsma, jsuchane, lmen, virt-maint, xuzhang, yalzhang
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.5.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1876297 (view as bug list) Environment:
Last Closed: 2020-11-17 17:49:16 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1679680    

Description yafu 2020-06-17 04:03:54 UTC
Description of problem:
Setting "ramfb='on'" in the mdev device does not save in the guest xml and only works once 

Version-Release number of selected component (if applicable):
libvirt-6.0.0-24.module+el8.2.1+6997+c666f621.x86_64
qemu-kvm-4.2.0-25.module+el8.2.1+6985+9fd9d514.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Edit guest xml to set mdev device with "ramfb='on'":
#virsh edit test1
...
 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on' ramfb='on'>
      <source>
        <address uuid='03cdd8ec-eacf-4a4a-ae1d-9cacb2bf38d2'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </hostdev>
...

2.Check the guest xml, no 'ramfb' setting in the mdev device:
# virsh dumpxml test1 | grep -A5 mdev
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
      <source>
        <address uuid='03cdd8ec-eacf-4a4a-ae1d-9cacb2bf38d2'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>


3.Start the guest again:
# virsh start test1
Domain test1 started

4.Check the guest xml, no 'ramfb' setting in the mdev device:
# virsh dumpxml test1 | grep -A5 mdev
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
      <source>
        <address uuid='03cdd8ec-eacf-4a4a-ae1d-9cacb2bf38d2'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>

5.Check the qemu cmd line, can see the 'ramfb' setting:
#ps aux | grep -i ramfb
...-device vfio-pci-nohotplug,id=ua-0febf033-9953-40e1-b803-2df42b0bac4e,sysfsdev=/sys/bus/mdev/devices/03cdd8ec-eacf-4a4a-ae1d-9cacb2bf38d2,display=on,bus=pci.7,addr=0x0,ramfb=on...

6.Destroy the guest:
#virsh destroy test1

7.Start the guest:
#virsh start test1

8.Check the qemu cmd line:
#ps aux | grep -i ramfb
no output


Actual results:
Setting "ramfb='on'" in the mdev device does not save in the guest xml and only works once .

Expected results:
Should save the 'ramfb' setting in the mdev device.


Additional info:

Comment 1 Jonathon Jongsma 2020-06-26 15:50:32 UTC
The fix is now upstream:

c5815b31976f3982d18c7f6c1367ab6e403eb7eb   qemu: format 'ramfb' attribute for mediated devices

Comment 4 yafu 2020-08-12 10:59:53 UTC
Verified with:
libvirt-daemon-6.6.0-2.el8.x86_64
qemu-kvm-5.0.0-2.module+el8.3.0+7379+0505d6ca.x86_64

Test steps:
1.Edit guest xml to set mdev device with "ramfb='on'":
#virsh edit test1
...
 <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on' ramfb='on'>
      <source>
        <address uuid='47f3a998-5cbe-4e27-b716-614e6617e916'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </hostdev>
...

2.Check the guest xml:
# virsh dumpxml test1 | grep -A5 mdev
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
      <source>
        <address uuid='47f3a998-5cbe-4e27-b716-614e6617e916'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>


3.Start the guest:
# virsh start test1
Domain test1 started

4.Check the guest xml:
# virsh dumpxml test1 | grep -A5 mdev
    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on'>
      <source>
        <address uuid='47f3a998-5cbe-4e27-b716-614e6617e916'/>
      </source>
      <alias name='ua-0febf033-9953-40e1-b803-2df42b0bac4e'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>

5.Check the qemu cmd line, can see the 'ramfb' setting:
#ps aux | grep -i ramfb
...-device vfio-pci-nohotplug,id=ua-0febf033-9953-40e1-b803-2df42b0bac4e,sysfsdev=/sys/bus/mdev/devices/47f3a998-5cbe-4e27-b716-614e6617e916,display=on,bus=pci.7,addr=0x0,ramfb=on...

6.Destroy guest and start again:
#virsh destroy test1
#virsh start test1

7.Check the qemu cmd line, still can see the 'ramfb' setting:
#ps aux | grep -i ramfb
...-device vfio-pci-nohotplug,id=ua-0febf033-9953-40e1-b803-2df42b0bac4e,sysfsdev=/sys/bus/mdev/devices/47f3a998-5cbe-4e27-b716-614e6617e916,display=on,bus=pci.7,addr=0x0,ramfb=on...

Comment 7 errata-xmlrpc 2020-11-17 17:49:16 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 (virt:8.3 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/RHBA-2020:5137