Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1375166 - [ppc64le] Guest has not initialized the display in vnc while using both virtio-vga and virtio-gpu-pci
Summary: [ppc64le] Guest has not initialized the display in vnc while using both virt...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: SLOF
Version: 7.3
Hardware: ppc64le
OS: Linux
unspecified
unspecified
Target Milestone: rc
: 7.4
Assignee: Thomas Huth
QA Contact: xianwang
URL:
Whiteboard:
Depends On: 1365613 1392055
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-12 11:10 UTC by Zhengtong
Modified: 2017-08-01 22:33 UTC (History)
12 users (show)

Fixed In Version: SLOF-20170303
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 22:33:27 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2093 normal SHIPPED_LIVE SLOF bug fix and enhancement update 2017-08-01 19:35:59 UTC

Description Zhengtong 2016-09-12 11:10:30 UTC
Description of problem:
Guest has not initialized the display  in vnc while using both virtio-vga and virtio-gpu-pci

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-24.el7

How reproducible:
100%

Steps to Reproduce:

/usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1'  \
    -sandbox off  \
    -machine pseries  \
    -nodefaults  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/avocado_rRQZgA/monitor-qmpmonitor1-20160912-013435-cwt1CMOW,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/tmp/avocado_rRQZgA/monitor-catch_monitor-20160912-013435-cwt1CMOW,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control  \
    -chardev socket,id=serial_id_serial0,path=/tmp/avocado_rRQZgA/serial-serial0-20160912-013435-cwt1CMOW,server,nowait \
    -device spapr-vty,reg=0x30000000,chardev=serial_id_serial0 \
    -device pci-ohci,id=usb1,bus=pci.0,addr=03 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=04 \
    -drive id=drive_image1,if=none,snapshot=off,aio=native,cache=none,format=qcow2,file=/root/virtual_desk_test/RHEL-Server-7.3-ppc64le-virtio-scsi.qcow2 \
    -device scsi-hd,id=image1,drive=drive_image1 \
    -device virtio-net-pci,mac=9a:a0:a1:a2:a3:a4,id=idqVqfm6,vectors=4,netdev=id04b1EX,bus=pci.0,addr=05  \
    -netdev tap,id=id04b1EX,vhost=on,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown \
    -m 8192  \
    -smp 8,maxcpus=8,cores=4,threads=1,sockets=2 \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -device usb-kbd \
    -device usb-mouse \
    -vnc :0  \
    -rtc base=utc,clock=host  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio \
    -device virtio-gpu-pci \
    -device virtio-vga \


Actual results:

VNC showing: "Guest has not initialized the display  in vnc"

Expected results:
Should show the normal output

Additional info:

Comment 2 David Gibson 2016-09-15 06:18:23 UTC
My first guess would be that the VNC connection is bound to one of the display devices, but the guest has chosen to use the other one by default.  I think qemu has a way of switching between multiple logical screens in its GUI, but I don't remember how immediately.

Comment 3 Thomas Huth 2016-09-15 11:02:25 UTC
Hi Zhengtong,
I've got two questions:
1) Which kernel version are you using for your guest?
2) Does it work for you on x86 if you specify the devices this way on the command line? (i.e. "-device virtio-gpu-pci" first, then "-device virtio-vga" second)

Comment 4 Thomas Huth 2016-09-15 11:52:30 UTC
So to keep things simple first, I'm currently trying to start QEMU only with the virtio-gpu-pci device, and not with the virtio-vga device, like this:

/usr/libexec/qemu-kvm -enable-kvm -nodefaults -serial stdio -vnc :10 \
  -device virtio-gpu-pci -hda /var/lib/libvirt/images/guest.img \
  -device pci-ohci -device usb-kbd -device usb-mouse

However, with the current downstream QEMU (qemu-kvm-rhev-2.6.0-25.el7), the guest fails to initialize the graphics card, and there is an error message in the
dmesg output like this:

# dmesg -t | grep virtio
virtio-pci 0000:00:00.0: BAR 4: can't reserve [mem 0x10120000000-0x101207fffff pref]
virtio-pci: probe of 0000:00:00.0 failed with error -16

But if I use upstream QEMU (v2.7.0-217-g7263da7) instead, the guest succeeds in initializing the graphics card after booting up. dmesg output looks here like this:

# dmesg -t | grep virtio
[drm] pci: virtio-gpu-pci detected
[drm] virtio vbuffers: 80 bufs, 192B each, 15kB total.
virtio_gpu virtio0: fb0: virtiodrmfb frame buffer device
[drm] Initialized virtio_gpu 0.0.1 0 on minor 0

Comment 5 Thomas Huth 2016-09-16 09:50:53 UTC
With the following upstream QEMU commit, the Linux kernel in the guest is able to initialize the virtio-gpu-pci device again:

    d9997d89a4a09a330a056929d06d4b7b0b7a8239
    virtio-pci: reduce modern_mem_bar size

Looks like Marcel is already in progress of backporting that patch for BZ 1365613, so adding that BZ as a dependency for this one here.

Comment 6 Zhengtong 2016-09-18 01:47:47 UTC
Hi. sorry for the late response.
Guest kernel : kernel-3.10.0-505.el7

For the same command line on x86, there is no problem to show the graphics window.  That's why I put "[ppc64le]" to the bug title.

Comment 8 Thomas Huth 2016-11-10 12:12:36 UTC
Work in progress: With the following SLOF patch, I get at least some graphical output when I specify the virtio-vga first on the command line:

 https://patchwork.ozlabs.org/patch/693179/

Colors are still wrong when Linux is trying to use the graphics card, though, and if I specify the virtio-gpu device first, I still do not get any output at all, so there are some more bugs to be fixed here...

Comment 9 Laurent Vivier 2016-11-10 16:08:27 UTC
(In reply to Thomas Huth from comment #8)
> Colors are still wrong when Linux is trying to use the graphics card,

Can be related to BZ1375153

You should check the driver is loaded (instead of the generic VGA one).

Comment 10 Thomas Huth 2016-11-10 19:51:35 UTC
(In reply to Laurent Vivier from comment #9)
> (In reply to Thomas Huth from comment #8)
> > Colors are still wrong when Linux is trying to use the graphics card,
> 
> Can be related to BZ1375153
> 
> You should check the driver is loaded (instead of the generic VGA one).

Thanks, very good hint, you're right, I did not use a kernel with that fix. So the color problem is then solved, too.
However, I still have problems with "-device virtio-gpu-pci -device virtio-vga" ... The virtio-gpu device only works if I omit the virtio-vga. So there is still something wrong here...

Comment 11 Thomas Huth 2016-11-16 12:11:35 UTC
OK, I've spent quite some time now with this issue to figure out the difference between x86 and ppc here.

First, I've got to say that the patch mentioned in comment #8 is needed here to fix a real problem. The patch has been accepted upstream now:

 http://git.qemu.org/?p=SLOF.git;a=commitdiff;h=38bf852e73ce6f0ac801d

So I think we should use this ticket to track the inclusion of that patch.

Now, with that patch (and the fix for BZ 1375153) everything looks fine if you start QEMU with "-device virtio-vga -device virtio-gpu-pci", you get output in the VNC window as expected.
But if you specify the virtio-gpu-pci device first, the VNC window initially stays black. This is because on ppc64, the Linux kernel seems to prefer virtio-vga over virtio-gpu for some reasons. However, you can switch to the second graphics card in the VNC window by pressing CTRL-ALT-2 and you get the normal output there, so basically everything is working fine. It's just that you get a slightly different behavior on x86 - there the Linux kernel seems to prefer the first graphics card instead, no matter whether it's virtio-vga or virtio-gpu. But if you press CTRL-ALT-2 in the x86 VNC window, you also get a black screen, i.e. Linux always only activates one of the two graphic cards and never uses both, so the black window on ppc64 is not a real bug, but just slightly different behaviour with the preferences of the graphic cards.

Now for the question why Linux is preferring virtio-vga over virtio-gpu on ppc64 but not on x86, I haven't found an ultimate answer. Part of the issue seems to be that the ppc64 code in the kernel tries to be smart and prefers to activate the graphics card that has been used by the firmware already. Since we've only got support for virtio-vga in SLOF, but not for virtio-gpu, the kernel seems to prefer that one. Another reason could be the order of the device-tree nodes - QEMU currently presents the PCI nodes in reverse order to the guests. There was a patch to fix this one year ago (https://patchwork.ozlabs.org/patch/549925/) but it had not been accepted, since the order should theoretically not matter - well, here it might matter.

Anyway, once the SLOF issue mentioned at the beginning is fixed, I think we do not have a real bug here anymore (since you can switch to the console with the output by pressing CTRL-ALT-2). And since it is quite unlikely that a user uses two graphic cards anyway, I stop further investigation here for now. But if you think that we should investigate the different behaviour further, we should likely open a new BZ in the "kernel" category instead.

Comment 12 Thomas Huth 2016-11-16 12:24:31 UTC
For the records, in case somebody wants to debug this issue further: You can force Linux to use the virtio-gpu device by applying the patch from https://patchwork.ozlabs.org/patch/549925/ to QEMU, and then typing something like this at the SLOF prompt:

 dev /pci/vga   
 s" device_type" delete-property

Linux then does not recognize the virtio-vga device as preferred "display" device from the firmware anymore and uses the first PCI graphics card instead. With the PCI device-tree in-order patch enabled, this is then the virtio-gpu graphics card.

Comment 13 Gerd Hoffmann 2016-11-16 13:47:01 UTC
> you also get a black screen, i.e. Linux always only activates one of the two
> graphic cards and never uses both, so the black window on ppc64 is not a
> real bug, but just slightly different behaviour with the preferences of the
> graphic cards.

Just FYI: It is possible to configure linux to use multiple display devices for a multiseat configuration, see docs/multiseat.txt.  gdm will show a login screen on each display then.  fbcon will appear on one display device only though.

Also note that qemu can have multiple vnc server instances, and they can be linked to display devices, so you can do this ...

qemu $lots_of_args
  -device virtio-gpu-pci,id=video1
  -device virtio-vga,id=video2
  -vnc :0,display=video2

... and the vnc server will show the virtio-vga so you don't need to mess with hotkeys to see it.  

Not that it is that useful in this specific case, as virtio-gpu-pci isn't shown anywhere then, so it is kida pointless to add the device in the first place ...

Comment 14 Thomas Huth 2016-11-16 15:37:04 UTC
Thanks a lot for that additional information, Gerd! After reading the "fbcon" keyword, I also remembered that there are some related kernel parameters, and indeed, if you specify "fbcon=map:10" as kernel parameter, you can at least swap the preference of the kernel for the graphic cards - it then also outputs the console text to virtio-gpu instead of virtio-vga.

Comment 17 Miroslav Rezanina 2017-03-14 13:56:22 UTC
Fixed by rebase

Comment 19 Yongxue Hong 2017-03-23 07:35:58 UTC
The following is the step of verification:

1.Version:
Host:3.10.0-623.el7.ppc64le
Qemu:qemu-kvm-rhev-2.9.0-0.el7.mrezanin201703210848
SLOF:SLOF.noarch  20170303-1.git66d250e.el7

2.Steps to Verify:
Same to the top Description

3.Actual results:
VNC showing: "Guest has not initialized the display  in vnc"

This fixed is failed.

Comment 20 Thomas Huth 2017-03-23 08:10:39 UTC
As mentioned in earlier comments, Linux has a slightly different priority order of using the graphic cards on ppc compared to x86. So to get output here, you've got to do one (but not all) of the following points:

- Press CTRL-ALT-2 in the VNC window to switch to the second graphics card (see comment 11)

- Bind the VNC session to the VGA graphics card with "-vnc :0,display=video2" (see comment 13)

- Use fbcon=map:10" as kernel parameter (see comment 14)

Please try again with one of the above three possibilities - if you get output in that case, I think it should be fine to mark this bug as verified.

Comment 21 Yongxue Hong 2017-03-24 02:07:22 UTC
(In reply to Thomas Huth from comment #20)
> As mentioned in earlier comments, Linux has a slightly different priority
> order of using the graphic cards on ppc compared to x86. So to get output
> here, you've got to do one (but not all) of the following points:
> 
> - Press CTRL-ALT-2 in the VNC window to switch to the second graphics card
> (see comment 11)
> 
> - Bind the VNC session to the VGA graphics card with "-vnc
> :0,display=video2" (see comment 13)
> 
> - Use fbcon=map:10" as kernel parameter (see comment 14)
> 
> Please try again with one of the above three possibilities - if you get
> output in that case, I think it should be fine to mark this bug as verified.

Hi Thomas Huth:

Thank you for answering. I have tried the 1th and 2th points, and the guest can successfully display in vnc. so this bug is fixed.Mark the status of bug as verified.

Comment 22 errata-xmlrpc 2017-08-01 22:33:27 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, 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-2017:2093


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