libxl: fix libxl_domain_need_memory after 899433f149d
PATCH 1/1 libxl: fix libxl_domain_need_memory after 899433f149d
After 899433f149d libxl needs to know the content of d_config to determine which QEMU is used. The code is changed such that libxl__domain_set_device_model needs to be called before libxl__domain_build_info_setdefault.
This is fine for libxl code, but it is problematic for libxl_domain_need_memory, which is the only public API that takes a build_info. To avoid break its users, provide a compatibility setting inside that function.
---
Cc: Ian Jackson <[email protected]>
Cc: Olaf Hering <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Juergen Gross <[email protected]>
Please test.
--- tools/libxl/libxl_mem.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/libxl/libxl_mem.c +18 -0
@@ -457,6 +457,24 @@ int libxl_domain_need_memory(libxl_ctx *ctx,libxl_domain_build_info_init (b_info);libxl_domain_build_info_copy (ctx, b_info, b_info_in); +/* +* It has become a requirement that to figure out which QEMU to +* use, libxl will need to peek d_config's content. The code has +* been changed such that one will need to call +* libxl__domain_set_device_model before calling +* libxl__domain_build_info_setdefault inside libxl. +* +* This (problematic) public API is the only one which takes a +* b_info, imposing the same requirement on the users of this +* public API will break them. +* +* Provide a compatibility setting for this function. The +* calculation doesn't really care which QEMU is set here, so we +* go with the upstream default. +*/ +if (!b_info->device_model_version) + b_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ; + rc =libxl__domain_build_info_setdefault (gc, b_info);if (rc) goto out;
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Wei Liu
After
899433f149dlibxl needs to know the content ofd_configto determine which QEMU is used. The code is changed such thatlibxl__domain_set_device_modelneeds to be called beforelibxl__domain_build_info_setdefault.This is fine for libxl code, but it is problematic for
libxl_domain_need_memory, which is the only public API that takes abuild_info. To avoid break its users, provide a compatibility setting inside that function.Signed-off-by Wei Liu <[email protected]>
With one nit below.
Quoted 26 lines
---
Cc: Ian Jackson <[email protected]>
Cc: Olaf Hering <[email protected]>
Cc: Roger Pau Monné <[email protected]>
Cc: Juergen Gross <[email protected]>Please test.
--- tools/libxl/libxl_mem.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)tools/libxl/libxl_mem.c +7
-0@@ -457,6 +457,24 @@ int libxl_domain_need_memory(libxl_ctx *ctx,libxl_domain_build_info_init (b_info);libxl_domain_build_info_copy (ctx, b_info, b_info_in); +/* +* It has become a requirement that to figure out which QEMU to +* use, libxl will need to peek d_config's content. The code has +* been changed such that one will need to call +* libxl__domain_set_device_model before calling +* libxl__domain_build_info_setdefault inside libxl. +*
tools/libxl/libxl_mem.c int libxl_domain_need_memory(libxl_ctx *ctx, · line 476
Quoted 10 lines
tools/libxl/libxl_mem.c +10
-0+* This (problematic) public API is the only one which takes a +* b_info, imposing the same requirement on the users of this +* public API will break them. +* +* Provide a compatibility setting for this function. The +* calculation doesn't really care which QEMU is set here, so we +* go with the upstream default. +*/ +if (!b_info->device_model_version) + b_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ;
There's a hard tab in the line above.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Roger Pau Monné
Quoted 9 lines
tools/libxl/libxl_mem.c +0
-0@@ -457,6 +457,24 @@ int libxl_domain_need_memory(libxl_ctx *ctx,libxl_domain_build_info_init (b_info);libxl_domain_build_info_copy (ctx, b_info, b_info_in);
Quoted 10 lines
tools/libxl/libxl_mem.c int libxl_domain_need_memory(libxl_ctx *ctx, · line 469
Quoted 10 lines
tools/libxl/libxl_mem.c +10
-0+/* +* It has become a requirement that to figure out which QEMU to +* use, libxl will need to peek d_config's content. The code has +* been changed such that one will need to call +* libxl__domain_set_device_model before calling +* libxl__domain_build_info_setdefault inside libxl. +* +* This (problematic) public API is the only one which takes a +* b_info, imposing the same requirement on the users of this +* public API will break them.
This sentence doesn't quite parse. You either want "b_info. Imposing", or something like "b_info, and imposing".
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Roger Pau Monné
Quoted 9 lines
tools/libxl/libxl_mem.c +0
-0@@ -457,6 +457,24 @@ int libxl_domain_need_memory(libxl_ctx *ctx,libxl_domain_build_info_init (b_info);libxl_domain_build_info_copy (ctx, b_info, b_info_in);
Quoted 13 lines
Quoted 10 lines
tools/libxl/libxl_mem.c int libxl_domain_need_memory(libxl_ctx *ctx, · line 469
Quoted 10 lines
tools/libxl/libxl_mem.c +10
-0+/* +* It has become a requirement that to figure out which QEMU to +* use, libxl will need to peek d_config's content. The code has +* been changed such that one will need to call +* libxl__domain_set_device_model before calling +* libxl__domain_build_info_setdefault inside libxl. +* +* This (problematic) public API is the only one which takes a +* b_info, imposing the same requirement on the users of this +* public API will break them. This sentence doesn't quite parse. You either want "b_info. Imposing", or something like "
b_info, and imposing".
Yep. Already fixed in my local copy.
I sent an email via xen.org address to that effect but it didn't come through.
Wei.
Quoted 2 lines
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Wei Liu writes ("[PATCH] libxl: fix libxl_domain_need_memory after 899433f149d"):
Quoted 9 lines
After
899433f149dlibxl needs to know the content ofd_configto determine which QEMU is used. The code is changed such thatlibxl__domain_set_device_modelneeds to be called beforelibxl__domain_build_info_setdefault.This is fine for libxl code, but it is problematic for
libxl_domain_need_memory, which is the only public API that takes abuild_info. To avoid break its users, provide a compatibility setting inside that function.
This looks plausible to me. I see that this function already makes a copy of the b_info, so we do not end up accidentally leaking this new default setting to the caller.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Ian Jackson
Wei Liu writes ("[PATCH] libxl: fix
libxl_domain_need_memoryafter899433f149d"):Quoted 9 lines
After
899433f149dlibxl needs to know the content ofd_configto determine which QEMU is used. The code is changed such thatlibxl__domain_set_device_modelneeds to be called beforelibxl__domain_build_info_setdefault.This is fine for libxl code, but it is problematic for
libxl_domain_need_memory, which is the only public API that takes abuild_info. To avoid break its users, provide a compatibility setting inside that function.
Quoted 6 lines
This looks plausible to me. I see that this function already makes a copy of the
b_info, so we do not end up accidentally leaking this new default setting to the caller.Acked-by Ian Jackson <[email protected]>
Thanks.
I have fixed up the issues Roger and Andy found and pushed this patch.
Wei.
Quoted 8 lines
Thanks,
Ian._______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel