This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 965108 - With "-device sga" , QEMU fails to build libguestfs' appliance, hanging while trying to print TERM size.
With "-device sga" , QEMU fails to build libguestfs' appliance, hanging while...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Fedora Virtualization Maintainers
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-20 08:11 EDT by Kashyap Chamarthy
Modified: 2013-05-20 11:14 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-05-20 11:14:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Successful "make check" of libguestfs, with SGA device disabled (274.59 KB, text/x-log)
2013-05-20 08:51 EDT, Kashyap Chamarthy
no flags Details

  None (edit)
Description Kashyap Chamarthy 2013-05-20 08:11:02 EDT
Description of problem:
-----------------------
With SGA device, libguestfs appliance -- which uses QEMU appliance under
the hood -- fails to build, hanging while trying to print TERM size.


Version:
--------

    $ rpm -q seabios-bin sgabios-bin qemu
    seabios-bin-1.7.2-1.fc19.noarch
    sgabios-bin-0.20110622svn-5.fc19.noarch
    qemu-1.4.1-3.fc19.x86_64


How reproducible: Consistently.


Steps to Reproduce:
------------------

   1. yum-builddep libguestfs
   2. git clone git://github.com/libguestfs/libguestfs.git \
      && cd libguestfs
   3. ./autogen.sh
   4. make 
   5. make quickcheck
    

Actual results: 
---------------

"make quickcheck" just hangs, and finally times out:
=================
$ make quickcheck
[...]
libguestfs: command: run: \ -rf /home/kashyap/src/upstream-libguestfs/tmp/guestfs.1CElGF
libguestfs: [17481ms] begin testing qemu features
libguestfs: command: run: /bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -help
libguestfs: command: run: /bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -version
libguestfs: qemu version 1.4
libguestfs: command: run: /bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -machine accel=kvm:tcg
libguestfs: command: run: \ -device ?
libguestfs: [17595ms] finished testing qemu features
[17595ms] /bin/qemu-kvm \
    -global virtio-blk-pci.scsi=off \
    -nodefconfig \
    -nodefaults \
    -nographic \
    -device virtio-scsi-pci,id=scsi \
    -drive file=/tmp/libguestfs-test-tool-sda-rOfTzy,format=raw,id=hd0,if=none \
    -device scsi-hd,drive=hd0 \
    -drive file=/home/kashyap/src/upstream-libguestfs/tmp/.guestfs-1000/root.3815,snapshot=on,id=appliance,if=none,cache=unsafe \
    -device scsi-hd,drive=appliance \
    -machine accel=kvm:tcg \
    -m 500 \
    -no-reboot \
    -no-hpet \
    -device virtio-serial \
    -serial stdio \
    -device sga \
    -chardev socket,path=/home/kashyap/src/upstream-libguestfs/tmp/libguestfseRmt2B/guestfsd.sock,id=channel0 \
    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
    -kernel /home/kashyap/src/upstream-libguestfs/tmp/.guestfs-1000/kernel.3815 \
    -initrd /home/kashyap/src/upstream-libguestfs/tmp/.guestfs-1000/initrd.3815 \
    -append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=screen'\x1b[1;256r\x1b[256;256H\x1b[6n
Google, Inc.
Serial Graphics Adapter 02/18/13
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild@) Mon Feb 18 08:29:02 UTC 2013
Term: 
=================


Expected results:
-----------------
libugestfs appliance should build successfully with sgabios.

Additional info:
----------------

(1)  Rich suggested to disable sgabios: from
     ../libguestfs/src/launch-direct.c, elide the below two lines, save
     it:

     add_cmdline (g, "-device")
     add_cmdline (g, "sga");

And, then run:

    make clean
    make -j 6
    make quickcheck

is successful.


(2) RWMJ: The hang makes no sense because, from here:

    https://code.google.com/p/sgabios/source/browse/trunk/sgabios.S#2376

the code just prints out Term: followed immediately by the detected
terminal size. So it would indicate some sort of flow control problem in
virtio-serial.
Comment 1 Kashyap Chamarthy 2013-05-20 08:51:30 EDT
Created attachment 750566 [details]
Successful "make check" of libguestfs, with SGA device disabled
Comment 2 Kashyap Chamarthy 2013-05-20 08:54:09 EDT
And, I was also able to reproduce this issue with qemu git:

    $ cd qemu
    $ git describe
    v1.4.0-1926-gb9b5df6

In qemu direcotry, qemu-wrapper.sh containing:

    #!/bin/sh - 
    qemudir=/home/kashyap/src/qemu
    exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "$@"
    
Give it executable permissions.


From libguestfs dir:

    $ make clean && make -j4 && make quickcheck
Comment 3 Richard W.M. Jones 2013-05-20 09:08:16 EDT
I wasn't able to reproduce this, but as the reporter says
it does look like it might possibly be a flow-control problem
in the new qemu virtio-serial code.
Comment 4 Paolo Bonzini 2013-05-20 10:20:44 EDT
What kernel version?  This could be caused by the change in emulate_invalid_guest_state's default setting in the 3.9 kernel.

If this is the case, it will be fixed when the host kernel is updated to 3.9.3.  Alternatively you can load the kvm_intel module with emulate_invalid_guest_state=0.
Comment 5 Richard W.M. Jones 2013-05-20 11:02:35 EDT
Linux iciclelabengpnqredhatcom 3.9.1-301.fc19.x86_64 #1 SMP Wed May 8 18:02:34 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Will try a different kernel in a minute.
Comment 6 Josh Boyer 2013-05-20 11:09:54 EDT
(In reply to Richard W.M. Jones from comment #5)
> Linux iciclelabengpnqredhatcom 3.9.1-301.fc19.x86_64 #1 SMP Wed May 8
> 18:02:34 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
> 
> Will try a different kernel in a minute.

http://koji.fedoraproject.org/koji/buildinfo?buildID=420269

is 3.9.3.
Comment 7 Richard W.M. Jones 2013-05-20 11:12:40 EDT
Similar bug reported here:

http://www.mail-archive.com/kvm@vger.kernel.org/msg90247.html

As Paolo points out, it's something to do with
emulate_invalid_guest_state.
Comment 8 Richard W.M. Jones 2013-05-20 11:14:15 EDT
Excellent, fixed by installing 3.10.0-0.rc1.git6.2.fc20.x86_64.

Thanks everyone.

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