Bug 1026550

Summary: QEMU VFIO update ROM loading code
Product: Red Hat Enterprise Linux 7 Reporter: Alex Williamson <alex.williamson>
Component: qemu-kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, alex.williamson, chayang, juzhang, michen, mrezanin, virt-maint, xuhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-17.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:48:03 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:

Description Alex Williamson 2013-11-04 23:18:29 UTC
Description of problem:
Device ROM loading has been a bit of a nuisance in the past.  Previous versions of vfio will attempt to read the device ROM regardless of whether the romfile= option is provided.  For devices with broken ROMs, this leads to kernel messages about an invalid ROM file regardless of whether it's being used.  vfio also attempted to read the ROM during the QEMU initialization of the device, not being careful whether the device was configured for access.

Upstream changes fix this to not attempt to read the device ROM if romfile= is specified and if it's not, size the ROM based on the ROM BAR size and not attempt to read the actual ROM until the guest does.

In doing this, we can also switch the memory region for the ROM to not consume a memory slots from KVM, adding some scalability.

This bz is opened primarily as an indication to QE to make a special effort to verify there are no regressions in things like PXE boot with this code update.  Please re-validate any portions of the test plan making use of device ROMs with this update.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Miroslav Rezanina 2013-11-07 15:56:31 UTC
Fix included in qemu-kvm-1.5.3-17.el7

Comment 4 Xu Han 2013-11-19 05:38:33 UTC
Reproduce this bug with components:
qemu-kvm-rhev-1.5.3-16.el7.x86_64

Scenario 1, without specify rom file.
Steps:
1. boot guest with vfio assigned device and stop vm.
# /usr/libexec/qemu-kvm -nodefaults -M q35 -m 4G -cpu Opteron_G3 -smp 4,cores=2,threads=2,sockets=1 -boot menu=on -monitor stdio -rtc base=localtime,clock=host,driftfix=slew -qmp tcp:0:5555,server,nowait -vga qxl -drive file=/home/pxe-install.qcow2_v3,format=qcow2,id=guest-img,if=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,drive=guest-img,id=os-disk -spice disable-ticketing,port=5931 -device virtio-balloon,id=balloon -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -monitor unix:/tmp/guest-sock,server,nowait \
-device vfio-pci,host=01:00.0,id=pf0 -S

Results:
After step1,
(qemu) info status
VM status: paused (prelaunch)

Could found such a message below in host dmesg.
[83317.280796] vfio-pci 0000:01:00.0: Invalid ROM contents

Scenario 2, specify rom file.
Steps:
1. boot guest with vfio assigned device and stop vm.
# /usr/libexec/qemu-kvm -nodefaults -M q35 -m 4G -cpu Opteron_G3 -smp 4,cores=2,threads=2,sockets=1 -boot menu=on -monitor stdio -rtc base=localtime,clock=host,driftfix=slew -qmp tcp:0:5555,server,nowait -vga qxl -drive file=/home/pxe-install.qcow2_v3,format=qcow2,id=guest-img,if=none,werror=stop,rerror=stop -device virtio-blk-pci,scsi=off,drive=guest-img,id=os-disk -spice disable-ticketing,port=5931 -device virtio-balloon,id=balloon -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -monitor unix:/tmp/guest-sock,server,nowait \
-device vfio-pci,host=01:00.0,id=pf0,romfile=/home/82576PF.rom -S

Results:
After step1,
(qemu) info status
VM status: paused (prelaunch)

Could found such a message below in host dmesg.
[83608.927952] vfio-pci 0000:01:00.0: Invalid ROM contents


Verify this bug with component:
qemu-kvm-rhev-1.5.3-19.el7.x86_64

Same steps as above.

Scenario 1
Results:
After step1,
(qemu) info status
VM status: paused (prelaunch)

Could not found a kernel messages about invalid ROM file.
Then continue guest. While seabios loaded, would found that message.
[84875.784916] vfio-pci 0000:01:00.0: Invalid ROM contents

Scenario 2
Results:
After step1,
(qemu) info status
VM status: paused (prelaunch)

Could not found a kernel messages about invalid ROM file.
Then continue guest. While seabios loaded, could not found that message as well, and guest boot from that vfio assigned device.


Base on these test results above, can we confirm if this bug has been fixed? Thanks.

Comment 5 juzhang 2013-11-25 08:32:02 UTC
Hi Alex,

Would you pleas have a look comment4? Does QE testing can make this issue as verified?

Best Regards,
Junyi

Comment 6 Alex Williamson 2013-12-02 16:33:17 UTC
(In reply to juzhang from comment #5)
> Hi Alex,
> 
> Would you pleas have a look comment4? Does QE testing can make this issue as
> verified?

Yes, this looks like the expected results.  In Scenario 1, the ROM was only accessed when seabios attempted to scan it, resulting in the invalid ROM contents message.  In scenario 2, we never touch the device ROM, so we never get the message.  Thanks.

Comment 8 Ludek Smid 2014-06-13 10:48:03 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.