libxl: Implement basic video device selection
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Stefan Bader
Re-pushing this as the old thread got rather stale.
Thanks.
Quoted 4 lines
Some of the
VFB setup went in a bug fix. Not sure I missed a detail in rebasing bug the keyboard setting may be the only thing missing...
Yes, agreed.
Quoted 31 lines
-Stefan
[v2: Check return code of
VIR_STRDUPand fix indentation] [v3: Split out VRAM fixup and return error for unsupported video type] [v4: Re-arrange code and move VFB setup into libxlMakeVfbList] [v5: Rebased against head which already had some VFB setup code]Quoted 1 line
From
b3ff8f4c658d29f15e673af88b9ae2fdfa3c1317Mon Sep 17 00:00:00 2001From: Stefan Bader <[email protected]>
Date: Thu, 27 Mar 2014 16:01:18 +0100
Subject: [PATCH] libxl: Implement basic video device selectionThis started as an investigation into an issue where libvirt (using the libxl driver) and the Xen host, like an old couple, could not agree on who is responsible for selecting the VNC port to use.
Things usually (and a bit surprisingly) did work because, just like that old couple, they had the same idea on what to do by default. However it was possible that this ended up in a big argument.
The problem is that display information exists in two different places:
in the vfbs list and in the build info. And for launching the device model, only the latter is used. But that never gets initialized from libvirt. So Xen allows the device model to select a default port while libvirt thinks it has told Xen that this is done by libvirt (though the vfbs config).While fixing that, I made a stab at actually evaluating the configuration of the video device. So that it is now possible to at least decide between a Cirrus or standard VGA emulation and to modify the VRAM within certain limits using libvirt.
Quoted 5 lines
Signed-off-by Stefan Bader <[email protected]>--- src/libxl/libxl_conf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
This patch suffers the same issues as the last version. And when commenting on that version, I promised to work on a followup to address my concerns
https://www.redhat.com/archives/libvir-list/2014-July/msg00931.html
Your repost poked me into reworking my first attempt, the result of which is below. I should probably look at a sensible split-up of these patches that would be easier to review, but in the meantime comments on my followup would be appreciated.
With both patches, my tests are passing and my concerns are subdued :-).
Regards,
Jim
Quoted 1 line
From
5003420c1e4d22726c596594988169a37544f867Mon Sep 17 00:00:00 2001
From: Jim Fehlig <[email protected]>
Date: Thu, 17 Jul 2014 12:00:31 -0600
Subject: [PATCH 2/2] Xen: Improve handling of video device vram
The minimum vram values supported by libxl depend upon the device model used. E.g. the minimum values are doubled when using QEMU_XEN, as compared to the old QEMU_XEN_TRADITIONAL.
This patch introduces a function to detect whether the specified emulator is QEMU_XEN or QEMU_XEN_TRADITIONAL. Detection is based on the string "Options specific to the Xen version:" in '$qemu -help' output. AFAIK, the only qemu containing that string in help output is the old Xen fork (aka qemu-dm).
The detection function is then used to sanity check user-provided vram values, and set appropriate defaults when not provided. For the latter, virDomainVideoDefaultRAM was changed to defer setting the default to the Xen drivers.
Note:QEMU_XEN means a qemu that contains support for Xen.
QEMU_XEN_TRADITIONAL means Xen's old forked qemu 0.10.2
--- src/conf/domain_conf.c | 4 +++ src/libxl/libxl_conf.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++-- src/libxl/libxl_conf.h | 3 ++ src/libxl/libxl_domain.c | 21 +++++++++++++ src/xen/xen_driver.c | 18 +++++++++++ 5 files changed, 122 insertions(+), 3 deletions(-)
src/conf/domain_conf.c +4 -0
@@ -9683,6 +9683,10 @@ int virDomainVideoDefaultRAM(const virDomainDef *def, int type) { +/* Defer setting vram to the Xen drivers */ +if (def->virtType ==VIR_DOMAIN_VIRT_XEN ) +return 0 ; +switch (type) {/* Weird, QEMU defaults to 9 MB ??! */ case VIR_DOMAIN_VIDEO_TYPE_VGA :
src/libxl/libxl_conf.c +76 -3
112 lines not on this page · raw message
src/libxl/libxl_conf.h +3 -0
@@ -163,6 +163,9 @@ virCapsPtrlibxlMakeCapabilities (libxl_ctx *ctx);int +libxlDomainGetEmulatorType (const virDomainDef *def); + +int libxlMakeDisk (virDomainDiskDefPtr l_dev,libxl_device_disk *x_dev); int libxlMakeNic(virDomainDefPtr def,
src/libxl/libxl_domain.c +21 -0
@@ -510,6 +510,27 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, pcisrc->backend =VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN ; } +if (dev->type ==VIR_DOMAIN_DEVICE_VIDEO &&STREQ (def->os.type,"hvm" )) { +int dm_type =libxlDomainGetEmulatorType (def); + +if (dev->data.video->type ==VIR_DOMAIN_VIDEO_TYPE_VGA || + dev->data.video->type ==VIR_DOMAIN_VIDEO_TYPE_XEN ) { +if (dev->data.video->vram ==0 ) { +if (dm_type ==LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ) + dev->data.video->vram =16 *1024 ; +else + dev->data.video->vram =8 *1024 ; + } + }else if (dev->data.video->type ==VIR_DOMAIN_VIDEO_TYPE_CIRRUS ) { +if (dev->data.video->vram ==0 ) { +if (dm_type ==LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ) + dev->data.video->vram =8 *1024 ; +else + dev->data.video->vram =4 *1024 ; + } + } + } +return 0 ; }
src/xen/xen_driver.c +18 -0
@@ -353,6 +353,24 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,return -1 ; } +if (dev->type ==VIR_DOMAIN_DEVICE_VIDEO && dev->data.video->vram ==0 ) { +switch (dev->data.video->type) { +case VIR_DOMAIN_VIDEO_TYPE_VGA : +case VIR_DOMAIN_VIDEO_TYPE_CIRRUS : +case VIR_DOMAIN_VIDEO_TYPE_VMVGA : + dev->data.video->vram =9 *1024 ; +break ; + +case VIR_DOMAIN_VIDEO_TYPE_XEN : + dev->data.video->vram =4 *1024 ; +break ; + +case VIR_DOMAIN_VIDEO_TYPE_QXL : +/* Use 64M as the minimal video video memory for qxl device */ +return 64 *1024 ; + } + } +return 0 ; }
Signature · 1 line
1.8.4.5
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 49 lines · Jim Fehlig
Quoted 1 line · Stefan Bader
Re-pushing this as the old thread got rather stale.
Thanks.
Quoted 4 lines
Some of the
VFB setup went in a bug fix. Not sure I missed a detail in rebasing bug the keyboard setting may be the only thing missing...Yes, agreed.
Quoted 31 lines
-Stefan
[v2: Check return code of
VIR_STRDUPand fix indentation] [v3: Split out VRAM fixup and return error for unsupported video type] [v4: Re-arrange code and move VFB setup into libxlMakeVfbList] [v5: Rebased against head which already had some VFB setup code]Quoted 1 line
From
b3ff8f4c658d29f15e673af88b9ae2fdfa3c1317Mon Sep 17 00:00:00 2001From: Stefan Bader <[email protected]>
Date: Thu, 27 Mar 2014 16:01:18 +0100
Subject: [PATCH] libxl: Implement basic video device selectionThis started as an investigation into an issue where libvirt (using the libxl driver) and the Xen host, like an old couple, could not agree on who is responsible for selecting the VNC port to use.
Things usually (and a bit surprisingly) did work because, just like that old couple, they had the same idea on what to do by default. However it was possible that this ended up in a big argument.
The problem is that display information exists in two different places:
in the vfbs list and in the build info. And for launching the device model, only the latter is used. But that never gets initialized from libvirt. So Xen allows the device model to select a default port while libvirt thinks it has told Xen that this is done by libvirt (though the vfbs config).While fixing that, I made a stab at actually evaluating the configuration of the video device. So that it is now possible to at least decide between a Cirrus or standard VGA emulation and to modify the VRAM within certain limits using libvirt.
Quoted 5 lines
Signed-off-by Stefan Bader <[email protected]>--- src/libxl/libxl_conf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
Quoted 5 lines
This patch suffers the same issues as the last version. And when commenting on that version, I promised to work on a followup to address my concerns
https://www.redhat.com/archives/libvir-list/2014-July/msg00931.html
Oh my, I have to admit I completely forgot about that.
Quoted 7 lines
Your repost poked me into reworking my first attempt, the result of which is below. I should probably look at a sensible split-up of these patches that would be easier to review, but in the meantime comments on my followup would be appreciated.
With both patches, my tests are passing and my concerns are subdued :-).
There seem to be some parts of code suggesting support for anything beside Xen (assumed to be alias to VGA) and Cirrus. As much as I know Xen handles only the two (not qxl or anything else).
I believe the xen specific qemu variant was the only one called qemu-dm (and the upstream variant always being qemu-system-i386). But checking the help message probably is safer and not called that often so I should not worry about performance).
I tried the variant you proposed and it looks to be ok. Still have to carry a piece which is not going upstream if I wan't to paper over the virt-manager issue. But at least now the failure is clearly showing what is wrong. So I am happy enough. :)
-Stefan
Quoted 5 lines
Regards,
Jim
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel