Bug 1463163 - Guest OS will down when disk enable the IOMMU for Virtio [NEEDINFO]
Guest OS will down when disk enable the IOMMU for Virtio
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: seabios (Show other bugs)
7.4
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: jason wang
FuXiangChun
: ZStream
Depends On:
Blocks: 1471076 1472131
  Show dependency treegraph
 
Reported: 2017-06-20 05:35 EDT by Jingjing Shao
Modified: 2017-09-28 09:20 EDT (History)
17 users (show)

See Also:
Fixed In Version: seabios-1.10.2-4.el7
Doc Type: Bug Fix
Doc Text:
Previously, after enabling the Input/Output Memory Management Unit (IOMMU) for a Q35 machine type guest, the guest failed to boot and displayed a "No bootable device" error message. This update fixes the handling of IOMMU on Q35 guests, and the described problem no longer occurs.
Story Points: ---
Clone Of:
: 1472131 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
ailan: needinfo? (jasowang)


Attachments (Terms of Use)
bios that supports IOMMU_PLATFORM (256.00 KB, application/octet-stream)
2017-07-03 00:27 EDT, jason wang
no flags Details
scsi controller enable virtio iommu (37.21 KB, image/png)
2017-07-04 02:36 EDT, Jingjing Shao
no flags Details

  None (edit)
Description Jingjing Shao 2017-06-20 05:35:56 EDT
Description of problem:
Guest OS will down when disk enable the IOMMU for Virtio

Version-Release number of selected component (if applicable):
3.10.0-681.el7.x86_64
qemu-kvm-rhev-2.9.0-10.el7.x86_64
libvirt-3.2.0-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. In host, add "iommu=pt intel_iommu=on" to kernel line
2. Add "intel_iommu=on" to kernel line of  q35  guest
3. Add the xml as below in the guest 
   <features>
    <ioapic driver='qemu'/>
  </features>
  ...
   <iommu model='intel'>
      <driver intremap='on' iotlb='on'/>
   </iommu>
 
4. Add the iommu='on' ats='on' to guest driver

<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' iommu='on' ats='on'/>
      <source file='/var/lib/libvirt/images/rhel7.3-q35.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </disk>

5.Start the guest
The guest OS will report  "No bootable device" 


Actual results:
As the step5 shows

Expected results:
The guest should start and can be login successfully
 
Additional info:
If delete the iommu='on' ats='on', the guest OS will start successfully.
Comment 2 Jingjing Shao 2017-06-26 03:24:32 EDT
There is a familiar error info with the scsi controller enabled virtio iommu,so
I add the comment here . If they are caused by different reasons and need to file a new bug, I will.


1. In host, add "iommu=pt intel_iommu=on" to kernel line
2. Add "intel_iommu=on" to kernel line of  q35  guest
3. Add the xml as below in the guest 
   <features>
    <ioapic driver='qemu'/>
  </features>
  ...
   <iommu model='intel'>
      <driver intremap='on' iotlb='on'/>
   </iommu>
 
4. Add the iommu='on' ats='on' to scsi controller and change the disk bus to scsi.
....
     <controller type='scsi' index='0' model='virtio-scsi'>
       <driver iommu='on' ats='on'/>
     </controller>
....
     <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none  iommu='on' ats='on'/>
      <source file='/nfs/rhel7.3-q35.qcow2'/>
      <target dev='vda' bus='scsi'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>


5. Start the guest and find the guest can not be accessed.
Comment 3 jason wang 2017-07-03 00:27 EDT
Created attachment 1293726 [details]
bios that supports IOMMU_PLATFORM
Comment 4 jason wang 2017-07-03 00:28:36 EDT
Please try the attached bios.bin to see if it solves the issue for 7.4 guest.

Note: you need to use qemu-kvm -bios bios.bin to test.

Thanks
Comment 6 Jingjing Shao 2017-07-03 08:34:39 EDT
(In reply to jason wang from comment #4)
> Please try the attached bios.bin to see if it solves the issue for 7.4 guest.
> 
> Note: you need to use qemu-kvm -bios bios.bin to test.
> 
> Thanks


Yes, I use the attached bios.bin to start the guest.

For the disk, it works and can start successfully enabled iommu
For the scsi controller, it does not work and the guest hanged
Comment 7 jason wang 2017-07-03 22:05:44 EDT
(In reply to Jingjing Shao from comment #6)
> (In reply to jason wang from comment #4)
> > Please try the attached bios.bin to see if it solves the issue for 7.4 guest.
> > 
> > Note: you need to use qemu-kvm -bios bios.bin to test.
> > 
> > Thanks
> 
> 
> Yes, I use the attached bios.bin to start the guest.
> 
> For the disk, it works and can start successfully enabled iommu
> For the scsi controller, it does not work and the guest hanged

Interesting, scsi seems to work for upstream qemu.

Please show me

1) qemu cli & version
2) guest kernel version
3) what phase did guest hang? did you see grub?

Thanks
Comment 8 jason wang 2017-07-03 22:21:59 EDT
Works for me with following cli:

$qemu_path -bios bios.bin \
           -drive file=$img_path,if=none,id=hd \
           -device virtio-scsi-pci,id=scsi,disable-legacy=on,disable-modern=off,iommu_platform=on \
           -device scsi-hd,drive=hd \
           -vnc :10 \
           -netdev tap,id=hn0,vhost=on,queues=4 \
           -device virtio-net-pci,netdev=hn0,vectors=10,mq=on,mrg_rxbuf=off,guest_tso4=off,guest_tso6=off,guest_ecn=off,guest_ufo=off,mac=$mac \
           -m 2G -enable-kvm \
           -cpu host \
           -smp 4 \
           -serial stdio \
           -snapshot

But I'm using upstream kernel as guest.
Comment 9 Jingjing Shao 2017-07-04 02:34:36 EDT
> Interesting, scsi seems to work for upstream qemu.
> 
> Please show me
> 
> 1) qemu cli & version
> 2) guest kernel version
> 3) what phase did guest hang? did you see grub?
> 
> Thanks

qemu-kvm-rhev-2.9.0-14.el7.x86_64
guest kernel : 3.10.0-691.el7.x86_64

qemu cli:
 -device virtio-scsi-pci,iommu_platform=on,ats=on,id=scsi0,bus=pci.3,addr=0x0
 -drive file=/var/lib/libvirt/images/q35-bios.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=scsi0-0-0-0,bootindex=1

But maybe I found the point.

If I add the "iommu=on" to the guest kernel command line, I can reproduce this scsi issue and add the image as attachment.

If I delete the "iommu=on" from the guest kernel command line, the guest can boot successfully.

But the disk part is OK for both scenarios. 


Additional info:
I also try the NIC device enable virtio iommu with the guest with "iommu=on" in kernel command line. The guest can not start successfully.

qemu cli:
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:7e:af:e6,bus=pci.7,addr=0x0,iommu_platform=on,ats=on
Comment 10 Jingjing Shao 2017-07-04 02:36 EDT
Created attachment 1294097 [details]
scsi controller enable virtio iommu
Comment 11 jason wang 2017-07-04 05:07:55 EDT
Thanks, intel_iommu=on works for upstream kernel. Let me try RHEL.
Comment 12 jason wang 2017-07-04 05:09:57 EDT
Btw, could you please try gpxe to see if it works? If net, please open a new bz for gpxe and assign it to me.

Thanks a lot.
Comment 15 jason wang 2017-07-04 07:45:43 EDT
(In reply to jason wang from comment #11)
> Thanks, intel_iommu=on works for upstream kernel. Let me try RHEL.

Speak too fast, looks like upstream is broken too. Please file a new bug with component set to kernel, and assign it to me.

Thanks
Comment 21 Jingjing Shao 2017-07-05 04:34:08 EDT
(In reply to jason wang from comment #15)
> (In reply to jason wang from comment #11)
> > Thanks, intel_iommu=on works for upstream kernel. Let me try RHEL.
> 
> Speak too fast, looks like upstream is broken too. Please file a new bug
> with component set to kernel, and assign it to me.
> 
> Thanks

Double check with jason, file new qemu-kvm-rhev bug for the scsi issue. 

https://bugzilla.redhat.com/show_bug.cgi?id=1467811
Comment 22 jason wang 2017-07-05 22:37:48 EDT
Seabios path has been posted upstream.
Comment 23 jason wang 2017-07-13 00:22:12 EDT
Patch accepted upstream.
Comment 44 Wainer dos Santos Moschetta 2017-09-28 09:11:40 EDT
Fixed in seabios-1.10.2-4.el7

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