Bug 1181938

Summary: iPXE virtio-net fail to complete tftp download [could be bug on vring_get_buf()]
Product: Red Hat Enterprise Linux 7 Reporter: Xiaoqing Wei <xwei>
Component: ipxeAssignee: Michael S. Tsirkin <mst>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: hhuang, juzhang, lersek, xwei
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-26 07:59:30 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:
Attachments:
Description Flags
vm snapshot none

Description Xiaoqing Wei 2015-01-14 07:18:52 UTC
Created attachment 979867 [details]
vm snapshot

Description of problem:

iPXE virtio-net fail to complete tftp download [could be bug on vring_get_buf()]

Version-Release number of selected component (if applicable):
ipxe-roms-qemu-20130517-6.gitc4bce43.el7.noarch
ipxe.git-1.0.0-1553.b203.gabf875a.x86_64
qemu-kvm-rhev-2.1.2-18.el7.x86_64
ipxe-bootimgs-20130517-6.gitc4bce43.el7.noarch
ipxe-roms-20130517-6.gitc4bce43.el7.noarch
OVMF-20140822-4.git9ece15a.el7.x86_64
kernel-3.10.0-221.el7.x86_64


How reproducible:
1/80 (met it only once during my PXE test for OVMF guest)

Steps to Reproduce:
1. detail configurateion
https://bugzilla.redhat.com/show_bug.cgi?id=1181934#c0
2. boot a uefi vm 
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name uefi-rhel66 -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=/var/lib/libvirt/qemu/nvram/uefi-rhel6_VARS.fd,if=pflash,format=raw,unit=1 -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid a4c10d00-ac50-400f-b05e-c629ffa7a020 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/uefi-rhel66.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot order=cd,menu=on,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x5 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x9 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/var/lib/libvirt/images/uefi-rhel6.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0 -drive file=/usr/share/OVMF/UefiShell.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw,cache=none,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
\
\
-netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:96:79:19,bus=pci.0,addr=0x3 \
\
\
\
\
-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5901,addr=0.0.0.0,disable-ticketing,seamless-migration=on -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on

3.

Actual results:
vm fail to complete the tftp download and boot into grub

Expected results:
vm should finish tftp process and boot into grub

Additional info:
virsh dumpxml uefi-rhel66
<domain type='kvm' id='9'>
  <name>uefi-rhel66</name>
  <uuid>a4c10d00-ac50-400f-b05e-c629ffa7a020</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/qemu/nvram/uefi-rhel6_VARS.fd</nvram>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/var/lib/libvirt/images/uefi-rhel6.img'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/usr/share/OVMF/UefiShell.iso'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <shareable/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='ide' index='1'>
      <alias name='ide1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <controller type='scsi' index='1' model='virtio-scsi'>
      <alias name='scsi1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:96:79:19'/>
      <source bridge='uefi-pxe'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c651,c708</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c651,c708</imagelabel>
  </seclabel>
</domain>

Comment 1 Xiaoqing Wei 2015-01-14 07:22:05 UTC
https://github.com/ipxe/ipxe/blob/master/src/drivers/bus/virtio-ring.c

void *vring_get_buf(struct vring_virtqueue *vq, unsigned int *len)
{
struct vring *vr = &vq->vring;
struct vring_used_elem *elem;
u32 id;
void *opaque;
BUG_ON(!vring_more_used(vq));     // this is line 69, the one vm screen shows
elem = &vr->used->ring[vq->last_used_idx % vr->num];
wmb();
id = elem->id;
if (len != NULL)
*len = elem->len;
opaque = vq->vdata[id];
vring_detach(vq, id);
vq->last_used_idx++;
return opaque;
}

Comment 3 Laszlo Ersek 2015-01-22 22:40:41 UTC
Please retest this scenario with the build in bug 1181980 comment 28. This BZ is a potential duplicate. Thanks.

Comment 4 Xiaoqing Wei 2015-01-26 06:26:41 UTC
with ipxe-roms-qemu-20130517-6.gitc4bce43.el7.efi_fixes_2.noarch

using virtio-net-pci(oprom), 20 pxe, doesn't happen
/usr/libexec/qemu-kvm -name uefi-rhel66 -S -machine pc-i440fx-rhel7.1.0,accel=kvm,usb=off -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=/var/lib/libvirt/qemu/nvram/uefi-rhel6_VARS.fd,if=pflash,format=raw,unit=1 -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid a4c10d00-ac50-400f-b05e-c629ffa7a020 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/uefi-rhel66.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot menu=on,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x5 -device virtio-scsi-pci,id=scsi1,bus=pci.0,addr=0x9 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/var/lib/libvirt/images/uefi-rhel6.img,if=none,id=drive-virtio-disk0,format=qcow2,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=3 -drive file=/usr/share/OVMF/UefiShell.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw,cache=none,aio=native -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=2 \
\
\
-netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=25 \
\
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:96:79:19,bus=pci.0,addr=0x3,bootindex=1 \
\
\
-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5901,addr=0.0.0.0,disable-ticketing,seamless-migration=on -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on

Comment 5 Laszlo Ersek 2015-01-26 07:59:30 UTC
(In reply to Xiaoqing Wei from comment #4)
> with ipxe-roms-qemu-20130517-6.gitc4bce43.el7.efi_fixes_2.noarch
> 
> using virtio-net-pci(oprom), 20 pxe, doesn't happen

Thank you.

*** This bug has been marked as a duplicate of bug 1181980 ***