libxl: set stub domain size based on VRAM size
cover libxl: set stub domain size based on VRAM size
I ran into crashes with qemu-traditional stub domain when 16 MB was assigned to the stdvga virtual video adapter. These were occurring due to an out of memory condition arising from stub domains having a fixed size of 32 MB, with half of that being demanded for video. Assuming the the original value of 32 MB was based on having a 4 MB video adapter, this increases the stub domain size by however much the VRAM exceeds 4 MB.
Eric Shelton (1):
libxl: set stub domain size based on VRAM size
tools/libxl/libxl_dm.c | 2 ++ 1 file changed, 2 insertions(+)
Signature · 1 line
2.1.0
PATCH 1/1 libxl: set stub domain size based on VRAM size
Allocate additional memory to the stub domain for qemu-traditional if more than 4 MB is assigned to the video adapter to avoid out of memory condition for QEMU.
--- tools/libxl/libxl_dm.c | 2 ++ 1 file changed, 2 insertions(+)
tools/libxl/libxl_dm.c +2 -0
@@ -1087,6 +1087,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) dm_config->b_info.max_vcpus =1 ; dm_config->b_info.max_memkb =32 *1024 ; +if (guest_config->b_info.video_memkb >4096 ) + dm_config->b_info.max_memkb += guest_config->b_info.video_memkb -4096 ; dm_config->b_info.target_memkb = dm_config->b_info.max_memkb; dm_config->b_info.u.pv.features ="" ;
Signature · 1 line
2.1.0
Eric Shelton writes ("[PATCH 1/1] libxl: set stub domain size based on VRAM size"):
tools/libxl/libxl_dm.c void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) · line 1091
Quoted 8 lines
Allocate additional memory to the stub domain for qemu-traditional if more than 4 MB is assigned to the video adapter to avoid out of memory condition for QEMU.
dm_config->b_info.max_vcpus = 1; dm_config->b_info.max_memkb = 32 * 1024;tools/libxl/libxl_dm.c +2
-0+if (guest_config->b_info.video_memkb >4096 ) + dm_config->b_info.max_memkb += guest_config->b_info.video_memkb -4096 ;
Thanks for diagnosing this. This seems a reasonable approach to me. I have only one small stylistic comment: please use max() as found in libxl_internal.h.
Eg,
dm_config->b_info.max_memkb = 28 * 1024 +
max(guest_config->b_info.video_memkb, 4096);Ian.
Quoted 5 lines · Eric Shelton, le Fri 10 Jul 2015 11:36:02 -0400, a écrit :
Allocate additional memory to the stub domain for qemu-traditional if more than 4 MB is assigned to the video adapter to avoid out of memory condition for QEMU.
Signed-off-by Eric Shelton <[email protected]>
Quoted 20 lines
--- tools/libxl/libxl_dm.c | 2 ++ 1 file changed, 2 insertions(+)tools/libxl/libxl_dm.c +2
-0@@ -1087,6 +1087,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) dm_config->b_info.max_vcpus =1 ; dm_config->b_info.max_memkb =32 *1024 ; +if (guest_config->b_info.video_memkb >4096 ) + dm_config->b_info.max_memkb += guest_config->b_info.video_memkb -4096 ; dm_config->b_info.target_memkb = dm_config->b_info.max_memkb; dm_config->b_info.u.pv.features ="" ;Signature · 1 line
2.1.0
Signature · 4 lines
Samuel Client: "This program has been successfully installed." Vendeur (surpris): "Et où voyez-vous une erreur ?" Client: "C'est << HAS BEEN >> !"
Quoted 2 lines · Eric Shelton, le Fri 10 Jul 2015 11:36:01 -0400, a écrit :
Assuming the the original value of 32 MB was based on having a 4 MB video adapter,
In my memory that was the case, yes.
Samuel