Bug 1648236

Summary: QEMU doesn't expose rendernode option for egl-headless display type
Product: Red Hat Enterprise Linux 7 Reporter: Erik Skultety <eskultet>
Component: qemu-kvm-rhevAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Guo, Zhiyi <zhguo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.6CC: chayang, jinzhao, juzhang, kraxel, virt-maint, zhguo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.12.0-25.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1652871 (view as bug list) Environment:
Last Closed: 2019-08-22 09:19:58 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:
Bug Depends On:    
Bug Blocks: 1628892, 1652871, 1671594    

Description Erik Skultety 2018-11-09 08:17:49 UTC
Description of problem:
It's not possible to specify rendernode with egl-headless compared to spice which means that QEMU will always pick the first render node available, which will never work with libvirt namespaces, because libvirt doesn't know which DRM node to put into the namespace which will inherently result in a failure to start a VM.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.12.0-14.el7.x86_64

How reproducible:

Steps to Reproduce:
1. 
2.
3.

Actual results:


Expected results:
QEMU accepts rendernode option for egl-headless display type so that libvirt can take care of the access rights.

Additional info:
See https://bugzilla.redhat.com/show_bug.cgi?id=1628892 for more detail and how to reproduce. Even though libvirt now lets QEMU to pick the rendernode for SPICE if the user didn't provide it, this will change due to namespaces and libvirt will pick the first available rendernode the same way QEMU has been doing it.

Comment 1 Erik Skultety 2018-11-19 13:02:01 UTC
Support was added upstream by commit:
commit 91e61947eb2be21b00091d34f5692f89cef41376
Author:     Erik Skultety <eskultet>
AuthorDate: Fri Nov 16 11:14:43 2018 +0100
Commit:     Gerd Hoffmann <kraxel>
CommitDate: Fri Nov 16 11:44:22 2018 +0100

    ui: Allow specifying 'rendernode' display option for egl-headless
    
    As libvirt can't predict which rendernode QEMU would pick, it
    won't adjust the permissions on the device, hence QEMU getting
    "Permission denied" when opening the DRI device. Therefore, enable
    'rendernode' option for egl-headless display type.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1648236
    
    Signed-off-by: Erik Skultety <eskultet>
    Message-id: 27f4617f19aa1072114f10f1aa9dd199735ef982.1542362949.git.eskultet
    Signed-off-by: Gerd Hoffmann <kraxel>

Comment 2 Gerd Hoffmann 2018-11-22 13:37:55 UTC
Also needed: https://patchwork.ozlabs.org/patch/1001567/

Comment 3 Ademar Reis 2018-12-21 21:57:20 UTC
(In reply to Gerd Hoffmann from comment #2)
> Also needed: https://patchwork.ozlabs.org/patch/1001567/

Merged upstream in 3.1, pending backport:

commit e1ca8f7e1915496148f6e0ce1f7c2309af013312
Author: Gerd Hoffmann <kraxel>
Date:   Thu Nov 22 08:16:13 2018 +0100

    qapi: add query-display-options command
    
    Add query-display-options command, which allows querying the qemu
    display configuration.  This isn't particularly useful, except it
    exposes QAPI type DisplayOptions in query-qmp-schema, so that libvirt
    can discover recently added -display parameter rendernode (commit
    d4dc4ab133b).  Works around lack of sufficiently powerful command line
    introspection.
    
    Signed-off-by: Gerd Hoffmann <kraxel>
    Reviewed-by: Eric Blake <eblake>
    Tested-by: Eric Blake <eblake>
    Tested-by: Erik Skultety <eskultet>
    Message-id: 20181122071613.2889-1-kraxel

Comment 10 Miroslav Rezanina 2019-03-20 04:57:19 UTC
Fix included in qemu-kvm-rhev-2.12.0-25.el7

Comment 12 Guo, Zhiyi 2019-04-24 06:41:43 UTC
Test against qemu-kvm-rhev-2.12.0-24.el7.x86_64 that without rendernode

Scenarios performed:

1) start qemu with /usr/libexec/qemu-kvm -display egl-headless
qemu can start

2) start qemu with /usr/libexec/qemu-kvm -display egl-headless,rendernode=/dev/dri/foo -qmp unix:/tmp/qmp,server,nowait -monitor stdio
qemu can start

3) check qmp commands supported from qemu, there is no command called query-display-options

Test against qemu-kvm-rhev-2.12.0-25.el7.x86_64 that has rendernode

1) can still pass

2) will report error as expected:
(qemu) qemu-kvm: egl: no drm render node available
qemu-kvm: egl: render node init failed

Switch to an existed render provider, qemu can start without error:
# /usr/libexec/qemu-kvm -display egl-headless,rendernode=/dev/dri/renderD128 -qmp unix:/tmp/qmp,server,nowait -monitor stdio
QEMU 2.12.0 monitor - type 'help' for more information
(qemu)

3)check qmp commands supported from qemu, command query-display-options prompt been supported:
{ "execute": "qmp_capabilities" }
{"return": {}}
{ "execute": "query-commands" }
...
{"name": "query-display-options"}
...

4) Execute this qmp command:
{ "execute": "query-display-options"}
{"return": {"type": "egl-headless"}}

5) Execute query-display-options when -display none:
{ "execute": "qmp_capabilities" }
{"return": {}}
{ "execute": "query-display-options"}
{"return": {"type": "none"}}

6) Execute query-display-options when -display option is not specified, vnc and spice has been tried:
{ "execute": "qmp_capabilities" }
{"return": {}}
{ "execute": "query-display-options"}
{"return": {"type": "none"}}

7) boot rhel 7.7 guest with qemu cli
# /usr/libexec/qemu-kvm -display egl-headless -device vfio-pci,sysfsdev=/sys/bus/mdev/devices/89d223b5-8e86-4682-b703-acf28f1fece8,display=on -monitor stdio -cpu Skylake-Client,enforce -m 8G -hda /home/rhel7.qcow2 -vnc :0 -serial unix:/tmp/console,server,nowait guest can boot to desktop and use gvt as desktop provider without problem

Comment 13 Guo, Zhiyi 2019-04-24 06:42:21 UTC
Verified per comment 12

Comment 15 errata-xmlrpc 2019-08-22 09:19:58 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/RHSA-2019:2553