convert LIBXL_DEVICE_MODEL_START_TIMEOUT to env var
v2 cover convert LIBXL_DEVICE_MODEL_START_TIMEOUT to env var
This patch series proposes converting the compile-time define LIBXL_DEVICE_MODEL_START_TIMEOUT value to an optionally overridden by environment variable value, just like the current behavior for LIBXL_BOOTLOADER_TIMEOUT is.
v1 -> v2 changes:
- version 1 had no a/ b/ prefixes in patches due to old git version, no other changes
Manos Pitsidianakis (2):
libs/light: add device model start timeout env var libs/light: expand device model start timeout use
docs/man/xl.1.pod.in | 11 +++++++++++ tools/libs/light/libxl_9pfs.c | 2 +- tools/libs/light/libxl_device.c | 2 +- tools/libs/light/libxl_dm.c | 10 +++++----- tools/libs/light/libxl_dom_suspend.c | 2 +- tools/libs/light/libxl_domain.c | 5 +++-- tools/libs/light/libxl_internal.h | 6 ++++++ tools/libs/light/libxl_pci.c | 10 +++++----- tools/libs/light/libxl_usb.c | 8 ++++---- 9 files changed, 37 insertions(+), 19 deletions(-)
base-commit: f48299cad5c3c69fdc2c101517a6dab9c9827ea5
Signature · 1 line
γαῖα πυρί μιχθήτω
RFC PATCH v2 1/2 libs/light: add device model start timeout env var
When debugging QEMU, the need to run it under Valgrind and asan meant the compile-time define LIBXL_DEVICE_MODEL_START_TIMEOUT must be changed to allow for xl to wait longer while the instrumented QEMU initializes.
This commit adds support for reading the environment variable LIBXL_DEVICE_MODEL_START_TIMEOUT to configure the timeout value and otherwise fall back to the default 60.
--- docs/man/xl.1.pod.in | 11 +++++++++++ tools/libs/light/libxl_9pfs.c | 2 +- tools/libs/light/libxl_device.c | 2 +- tools/libs/light/libxl_dm.c | 6 +++--- tools/libs/light/libxl_dom_suspend.c | 2 +- tools/libs/light/libxl_internal.h | 6 ++++++ tools/libs/light/libxl_pci.c | 6 +++--- 7 files changed, 26 insertions(+), 9 deletions(-)
docs/man/xl.1.pod.in +11 -0
@@ -1993,6 +1993,17 @@ Otherwise the build time default in LIBXL_BOOTLOADER_TIMEOUT will be used. If defined the value must be an unsigned integer between 0 and INT_MAX, otherwise behavior is undefined. Setting to 0 disables the timeout. +=item LIBXL_DEVICE_MODEL_START_TIMEOUT + +Timeout in seconds for starting the device model process. Useful in case the +device model takes an unusual amount of time to start— for example in case of +very slow I/O, in case of slow performance due to memory sanitizer usage, etc. + +If undefined, the default hard-coded value of 60 seconds is used. + +If defined, the value must be an unsigned integer between 0 and INT_MAX, +otherwise behaviour is undefined. Setting the value to 0 disables the timeout. + =back =head1 SEE ALSO
tools/libs/light/libxl_9pfs.c +1 -1
@@ -132,7 +132,7 @@ static int xen9pfsd_spawn(libxl__egc *egc, uint32_t domid, libxl_device_p9 *p9, aop9->spawn.ao = aodev->ao; aop9->spawn.what ="xen-9pfs daemon" ; aop9->spawn.xspath =GCSPRINTF ("%s/state" , path); - aop9->spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + aop9->spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ; aop9->spawn.pidpath =GCSPRINTF ("%s/pid" , path); aop9->spawn.midproc_cb = libxl__spawn_record_pid; aop9->spawn.confirm_cb = xen9pfsd_confirm;
tools/libs/light/libxl_device.c +1 -1
@@ -1436,7 +1436,7 @@ int libxl__wait_for_device_model_deprecated(libxl__gc *gc, path =DEVICE_MODEL_XS_PATH (gc, dm_domid, domid,"/state" );return libxl__xenstore_child_wait_deprecated (gc, domid, -LIBXL_DEVICE_MODEL_START_TIMEOUT , +__libxl_device_model_start_timeout (),"Device Model" , path, state, spawning, check_callback, check_callback_userdata); }
tools/libs/light/libxl_dm.c +3 -3
@@ -2629,7 +2629,7 @@ static void spawn_qmp_proxy(libxl__egc *egc, sdss->qmp_proxy_spawn.pidpath =GCSPRINTF ("%s/image/qmp-proxy-pid" , dom_path); sdss->qmp_proxy_spawn.xspath =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , dm_domid,"/qmp-proxy-state" ); - sdss->qmp_proxy_spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + sdss->qmp_proxy_spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ; sdss->qmp_proxy_spawn.midproc_cb = libxl__spawn_record_pid; sdss->qmp_proxy_spawn.confirm_cb = qmp_proxy_confirm; sdss->qmp_proxy_spawn.failure_cb = qmp_proxy_startup_failed;
@@ -3011,7 +3011,7 @@ retry_transaction: spawn->what =GCSPRINTF ("domain %d device model" , domid); spawn->xspath =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"/state" ); - spawn->timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + spawn->timeout_ms =__libxl_device_model_start_timeout () *1000 ; spawn->pidpath =GCSPRINTF ("%s/image/device-model-pid" , dom_path); spawn->midproc_cb = libxl__spawn_record_pid; spawn->confirm_cb = device_model_confirm;
@@ -3435,7 +3435,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) dmss->spawn.what =GCSPRINTF ("domain %u Qdisk backend" , domid); dmss->spawn.xspath =GCSPRINTF ("device-model/%u/state" , domid); - dmss->spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + dmss->spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ;/* * We cannot save Qemu pid anywhere in the xenstore guest dir, * because we will call this from unprivileged driver domains,
tools/libs/light/libxl_dom_suspend.c +1 -1
@@ -517,7 +517,7 @@ void libxl__dm_resume(libxl__egc *egc, rc =libxl__ev_time_register_rel (dmrs->ao, &dmrs->time, dm_resume_timeout, -LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ); +__libxl_device_model_start_timeout () *1000 );if (rc) goto out;switch (libxl__device_model_version_running (gc, domid)) {
tools/libs/light/libxl_internal.h +6 -0
@@ -97,6 +97,12 @@/* QEMU may be slow to load and start due to a bug in Linux where the I/O * subsystem sometime produce high latency under load. */ #define LIBXL_DEVICE_MODEL_START_TIMEOUT 60 +static inline int __libxl_device_model_start_timeout (void ) +{ +const char *timeout_env =getenv ("LIBXL_DEVICE_MODEL_START_TIMEOUT" ); +return timeout_env ?atoi (timeout_env) + :LIBXL_DEVICE_MODEL_START_TIMEOUT ; +}#define LIBXL_DEVICE_MODEL_SAVE_FILE XEN_LIB_DIR "/qemu-save"/* .$domid */ #define LIBXL_DEVICE_MODEL_RESTORE_FILE XEN_LIB_DIR "/qemu-resume"/* .$domid */ #define LIBXL_QMP_CMD_TIMEOUT 10
tools/libs/light/libxl_pci.c +3 -3
@@ -1157,7 +1157,7 @@ static void do_pci_add(libxl__egc *egc, pas->xswait.what ="Device Model" ; pas->xswait.path =DEVICE_MODEL_XS_PATH (gc,libxl_get_stubdom_id (CTX , domid), domid,"/state" ); - pas->xswait.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + pas->xswait.timeout_ms =__libxl_device_model_start_timeout () *1000 ; pas->xswait.callback = pci_add_qemu_trad_watch_state_cb; rc =libxl__xswait_start (gc, &pas->xswait);if (rc) goto out;
@@ -1719,7 +1719,7 @@ static void device_pci_add_stubdom_wait(libxl__egc *egc, rc =libxl__ev_devstate_wait (ao, &pas->pciback_ds, device_pci_add_stubdom_ready, state_path, XenbusStateConnected, -LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ); +__libxl_device_model_start_timeout () *1000 );if (rc) goto out;return ; out:
@@ -1976,7 +1976,7 @@ static void do_pci_remove(libxl__egc *egc, pci_remove_state *prs) prs->xswait.what ="Device Model" ; prs->xswait.path =DEVICE_MODEL_XS_PATH (gc,libxl_get_stubdom_id (CTX , domid), domid,"/state" ); - prs->xswait.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + prs->xswait.timeout_ms =__libxl_device_model_start_timeout () *1000 ; prs->xswait.callback = pci_remove_qemu_trad_watch_state_cb; rc =libxl__xswait_start (gc, &prs->xswait);if (rc) goto out_fail;
Signature · 1 line
γαῖα πυρί μιχθήτω
Re: [RFC PATCH v2 1/2] libs/light: add device model start timeout env var
docs/man/xl.1.pod.in Otherwise the build time default in LIBXL_BOOTLOADER_TIMEOUT will be used. · line 1994
Quoted 7 lines · Manos Pitsidianakis
docs/man/xl.1.pod.in +0
-0@@ -1993,6 +1993,17 @@ Otherwise the build time default in LIBXL_BOOTLOADER_TIMEOUT will be used. If defined the value must be an unsigned integer between 0 and INT_MAX, otherwise behavior is undefined. Setting to 0 disables the timeout.
I don't think a value of "0" would disable timeouts, did you try? It's more likely that the timeout will fire immediately. I'll had some comment later about this on case-by-case basis.
docs/man/xl.1.pod.in Otherwise the build time default in LIBXL_BOOTLOADER_TIMEOUT will be used. · line 1999
Quoted 5 lines
docs/man/xl.1.pod.in +4
-0+=item LIBXL_DEVICE_MODEL_START_TIMEOUT + +Timeout in seconds for starting the device model process. Useful in case the +device model takes an unusual amount of time to start— for example in case of
Could you use only ASCII characters, here ^
It's looks like it's the first UTF-8 chr in this document, and we can do without it. I just want to avoid find out later that something break because of that chr.
Quoted 15 lines
docs/man/xl.1.pod.in +7
-0+very slow I/O, in case of slow performance due to memory sanitizer usage, etc. + +If undefined, the default hard-coded value of 60 seconds is used. + +If defined, the value must be an unsigned integer between 0 and INT_MAX, +otherwise behaviour is undefined. Setting the value to 0 disables the timeout. + =back =head1 SEE ALSOtools/libs/light/libxl_9pfs.c +0
-0
tools/libs/light/libxl_9pfs.c static int xen9pfsd_spawn(libxl__egc *egc, uint32_t domid, libxl_device_p9 *p9, · line 135
Quoted 5 lines
tools/libs/light/libxl_9pfs.c +1
-1@@ -132,7 +132,7 @@ static int xen9pfsd_spawn(libxl__egc *egc, uint32_t domid, libxl_device_p9 *p9, aop9->spawn.ao = aodev->ao; aop9->spawn.what ="xen-9pfs daemon" ; aop9->spawn.xspath =GCSPRINTF ("%s/state" , path); - aop9->spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + aop9->spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ;
So this value is going to be used by libxl__spawn_spawn() then libxl__xswait_start(), and it's looks like a timeout of "0" will have the timeout fire immediately. Instead, a value of "-1" might disable the timeout, but I don't know how well it would work without a timeout.
Timeout is setup with libxl__ev_time_register_rel().
tools/libs/light/libxl_device.c int libxl__wait_for_device_model_deprecated(libxl__gc *gc, · line 1439
Quoted 13 lines
tools/libs/light/libxl_9pfs.c +0
-0aop9->spawn.pidpath =GCSPRINTF ("%s/pid" , path); aop9->spawn.midproc_cb = libxl__spawn_record_pid; aop9->spawn.confirm_cb = xen9pfsd_confirm;tools/libs/light/libxl_device.c +1
-1@@ -1436,7 +1436,7 @@ int libxl__wait_for_device_model_deprecated(libxl__gc *gc, path =DEVICE_MODEL_XS_PATH (gc, dm_domid, domid,"/state" ); return libxl__xenstore_child_wait_deprecated(gc, domid, - LIBXL_DEVICE_MODEL_START_TIMEOUT, + __libxl_device_model_start_timeout(),
This function will return an error immediately, without trying, with a timeout of "0", and "-1" isn't an option (well I guess it might be INT_MAX because it an unsigned value).
tools/libs/light/libxl_dm.c static void spawn_qmp_proxy(libxl__egc *egc, · line 2632
Quoted 13 lines
tools/libs/light/libxl_device.c +0
-0"Device Model" , path, state, spawning, check_callback, check_callback_userdata); }tools/libs/light/libxl_dm.c +1
-1@@ -2629,7 +2629,7 @@ static void spawn_qmp_proxy(libxl__egc *egc, sdss->qmp_proxy_spawn.pidpath =GCSPRINTF ("%s/image/qmp-proxy-pid" , dom_path); sdss->qmp_proxy_spawn.xspath =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , dm_domid,"/qmp-proxy-state" ); - sdss->qmp_proxy_spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + sdss->qmp_proxy_spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ;
That's used by libxl__spawn_spawn(). Already commented on it.
tools/libs/light/libxl_dm.c retry_transaction: · line 3014
Quoted 9 lines
tools/libs/light/libxl_dm.c +1
-1sdss->qmp_proxy_spawn.midproc_cb = libxl__spawn_record_pid; sdss->qmp_proxy_spawn.confirm_cb = qmp_proxy_confirm; sdss->qmp_proxy_spawn.failure_cb = qmp_proxy_startup_failed;@@ -3011,7 +3011,7 @@ retry_transaction: spawn->what =GCSPRINTF ("domain %d device model" , domid); spawn->xspath =DEVICE_MODEL_XS_PATH (gc,LIBXL_TOOLSTACK_DOMID , domid,"/state" ); - spawn->timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + spawn->timeout_ms =__libxl_device_model_start_timeout () *1000 ;
That's used by libxl__spawn_spawn(). Already commented on it.
tools/libs/light/libxl_dm.c void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) · line 3438
Quoted 9 lines
tools/libs/light/libxl_dm.c +1
-1spawn->pidpath =GCSPRINTF ("%s/image/device-model-pid" , dom_path); spawn->midproc_cb = libxl__spawn_record_pid; spawn->confirm_cb = device_model_confirm;@@ -3435,7 +3435,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) dmss->spawn.what =GCSPRINTF ("domain %u Qdisk backend" , domid); dmss->spawn.xspath =GCSPRINTF ("device-model/%u/state" , domid); - dmss->spawn.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + dmss->spawn.timeout_ms =__libxl_device_model_start_timeout () *1000 ;
That's used by libxl__spawn_spawn(). Already commented on it.
tools/libs/light/libxl_dom_suspend.c void libxl__dm_resume(libxl__egc *egc, · line 520
Quoted 13 lines
tools/libs/light/libxl_dm.c +0
-0/* * We cannot save Qemu pid anywhere in the xenstore guest dir, * because we will call this from unprivileged driver domains, tools/libs/light/libxl_dom_suspend.c +1
-1@@ -517,7 +517,7 @@ void libxl__dm_resume(libxl__egc *egc, rc =libxl__ev_time_register_rel (dmrs->ao, &dmrs->time, dm_resume_timeout, -LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ); +__libxl_device_model_start_timeout () *1000 );
libxl__ev_time_register_rel() just setup a timer, and I think with a timeout of 0, dm_resume_timeout() would be call immediately as soon as the current function returns, resulting in a failure.
tools/libs/light/libxl_internal.h line 100
Quoted 12 lines
tools/libs/light/libxl_dom_suspend.c +0
-0if (rc) goto out;switch (libxl__device_model_version_running (gc, domid)) {tools/libs/light/libxl_internal.h +1
-0@@ -97,6 +97,12 @@/* QEMU may be slow to load and start due to a bug in Linux where the I/O * subsystem sometime produce high latency under load. */ #define LIBXL_DEVICE_MODEL_START_TIMEOUT 60 +static inline int __libxl_device_model_start_timeout (void )
Could you rename that function? Probably:
libxl__device_model_start_timeout()
No leading '_', this is usually reserved, by glibc or C, I forgot the details.
Also, internal libxl function have two '_', so full prefix is "libxl__".
tools/libs/light/libxl_internal.h line 103
Quoted 3 lines
tools/libs/light/libxl_internal.h +3
-0+{ +const char *timeout_env =getenv ("LIBXL_DEVICE_MODEL_START_TIMEOUT" ); + return timeout_env ? atoi(timeout_env)
That usage of atoi() isn't good, because on conversion error, 0 is returned, which disable the timeout. I would rather fallback when we don't have a number.
One case that might be more problematic than other might be:
LIBXL_DEVICE_MODEL_START_TIMEOUT= xl create
I think we would have a timeout of 0, instead of a fallback to the default.
Quoted 10 lines
tools/libs/light/libxl_internal.h +2
-0+ : LIBXL_DEVICE_MODEL_START_TIMEOUT; +}#define LIBXL_DEVICE_MODEL_SAVE_FILE XEN_LIB_DIR "/qemu-save"/* .$domid */ #define LIBXL_DEVICE_MODEL_RESTORE_FILE XEN_LIB_DIR "/qemu-resume"/* .$domid */ #define LIBXL_QMP_CMD_TIMEOUT 10tools/libs/light/libxl_pci.c +0
-0
tools/libs/light/libxl_pci.c static void do_pci_add(libxl__egc *egc, · line 1160
Quoted 5 lines
tools/libs/light/libxl_pci.c +1
-1@@ -1157,7 +1157,7 @@ static void do_pci_add(libxl__egc *egc, pas->xswait.what ="Device Model" ; pas->xswait.path =DEVICE_MODEL_XS_PATH (gc,libxl_get_stubdom_id (CTX , domid), domid,"/state" ); - pas->xswait.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + pas->xswait.timeout_ms =__libxl_device_model_start_timeout () *1000 ;
That used by libxl__xswait_start(), and "0" seems to result in a failure.
tools/libs/light/libxl_pci.c static void device_pci_add_stubdom_wait(libxl__egc *egc, · line 1722
Quoted 9 lines
tools/libs/light/libxl_pci.c +1
-1pas->xswait.callback = pci_add_qemu_trad_watch_state_cb; rc =libxl__xswait_start (gc, &pas->xswait);if (rc) goto out;@@ -1719,7 +1719,7 @@ static void device_pci_add_stubdom_wait(libxl__egc *egc, rc =libxl__ev_devstate_wait (ao, &pas->pciback_ds, device_pci_add_stubdom_ready, state_path, XenbusStateConnected, -LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ); +__libxl_device_model_start_timeout () *1000 );
That value will be use by libxl__xswait_start().
tools/libs/light/libxl_pci.c static void do_pci_remove(libxl__egc *egc, pci_remove_state *prs) · line 1979
Quoted 9 lines
tools/libs/light/libxl_pci.c +1
-1if (rc) goto out;return ; out:@@ -1976,7 +1976,7 @@ static void do_pci_remove(libxl__egc *egc, pci_remove_state *prs) prs->xswait.what ="Device Model" ; prs->xswait.path =DEVICE_MODEL_XS_PATH (gc,libxl_get_stubdom_id (CTX , domid), domid,"/state" ); - prs->xswait.timeout_ms =LIBXL_DEVICE_MODEL_START_TIMEOUT *1000 ; + prs->xswait.timeout_ms =__libxl_device_model_start_timeout () *1000 ;
That value will be use by libxl__xswait_start().
tools/libs/light/libxl_pci.c static void do_pci_remove(libxl__egc *egc, pci_remove_state *prs) · line 1982
Quoted 3 lines
tools/libs/light/libxl_pci.c +0
-0prs->xswait.callback = pci_remove_qemu_trad_watch_state_cb; rc =libxl__xswait_start (gc, &prs->xswait);if (rc) goto out_fail;
So, overall, I'm fine with been able to change the timeout via env var, but disabling the timeout might not be easy or possible, even if "-1" might be an option, or -1000 in most case.
So, you change the man page to only allow value>0 ? And a timeout of 0 might be best to revert to the default.
Thanks,
Signature · 1 line
Anthony PERARD
Re: [RFC PATCH v2 1/2] libs/light: add device model start timeout env var
Hello Anthony, thank you very much for your review comments! They are very thorough and knowledgeable.
I unfortunately only just saw them, I don't know why I missed them back in April but doesn't matter. I am not going to continue work on these patches due to circumstances changing for me, if the community deems them useful with your corrections applied I hope someone else picks them up in the future.
Thanks again,
--
Manos Pitsidianakis, Virtualization Engineer at Linaro
RFC PATCH v2 2/2 libs/light: expand device model start timeout use
In reply to Manos PitsidianakisVarious timeout values that depend on the device model should also respect the device model start timeout setting. This commit adds the __libxl_device_model_start_timeout() value to those time outs without changing their default values.
--- tools/libs/light/libxl_dm.c | 4 ++-- tools/libs/light/libxl_domain.c | 5 +++-- tools/libs/light/libxl_pci.c | 4 ++-- tools/libs/light/libxl_usb.c | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-)
tools/libs/light/libxl_dm.c +2 -2
@@ -2807,7 +2807,7 @@ static void stubdom_pvqemu_unpaused(libxl__egc *egc, dm_domid, sdss->dm.guest_domid); sdss->xswait.path =DEVICE_MODEL_XS_PATH (gc, dm_domid, sdss->dm.guest_domid,"/state" ); - sdss->xswait.timeout_ms =LIBXL_STUBDOM_START_TIMEOUT *1000 ; + sdss->xswait.timeout_ms = (__libxl_device_model_start_timeout () +LIBXL_STUBDOM_START_TIMEOUT ) *1000 ; sdss->xswait.callback = stubdom_xswait_cb; rc =libxl__xswait_start (gc, &sdss->xswait);if (rc) goto out;
@@ -3177,7 +3177,7 @@ static void device_model_spawn_outcome(libxl__egc *egc, == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) { rc =libxl__ev_time_register_rel (ao, &dmss->timeout, devise_model_postconfig_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; dmss->qmp.ao = ao; dmss->qmp.domid = dmss->guest_domid;
tools/libs/light/libxl_domain.c +3 -2
@@ -1882,7 +1882,8 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid,case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : rc =libxl__ev_time_register_rel (ao, &svos->timeout, set_vcpuonline_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () + +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; qmp->callback = set_vcpuonline_qmp_cpus_fast_queried; rc =libxl__ev_qmp_send (egc, qmp,"query-cpus-fast" ,NULL );
@@ -2353,7 +2354,7 @@ static void retrieve_domain_configuration_lock_acquired(*/ rc =libxl__ev_time_register_rel (ao, &rdcs->timeout, retrieve_domain_configuration_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out;libxl_bitmap_alloc (CTX , &rdcs->qemuu_cpus, d_config->b_info.max_vcpus);
tools/libs/light/libxl_pci.c +2 -2
@@ -1165,7 +1165,7 @@ static void do_pci_add(libxl__egc *egc,case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : rc =libxl__ev_time_register_rel (ao, &pas->timeout, pci_add_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out;pci_add_qmp_device_add (egc, pas);/* must be last */
@@ -2030,7 +2030,7 @@ static void pci_remove_qmp_device_del(libxl__egc *egc, rc =libxl__ev_time_register_rel (ao, &prs->timeout, pci_remove_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; QMP_PARAMETERS_SPRINTF(&args, "id", PCI_PT_QDEV_ID,
tools/libs/light/libxl_usb.c +4 -4
@@ -487,7 +487,7 @@ static void libxl__device_usbctrl_add(libxl__egc *egc, uint32_t domid, rc =libxl__ev_time_register_rel (ao, &aodev->timeout, device_usbctrl_add_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto outrm; qmp->ao = ao;
@@ -644,7 +644,7 @@ static void device_usbctrl_usbdevs_removed(libxl__egc *egc, rc =libxl__ev_time_register_rel (ao, &aodev->timeout, device_usbctrl_remove_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; qmp->ao = ao;
@@ -1794,7 +1794,7 @@ static void libxl__device_usbdev_add(libxl__egc *egc, uint32_t domid, rc =libxl__ev_time_register_rel (ao, &aodev->timeout, device_usbdev_add_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; aodev->qmp.ao = ao;
@@ -1976,7 +1976,7 @@ static void libxl__device_usbdev_remove(libxl__egc *egc, uint32_t domid, rc =libxl__ev_time_register_rel (ao, &aodev->timeout, device_usbdev_remove_timeout, -LIBXL_QMP_CMD_TIMEOUT *1000 ); + (__libxl_device_model_start_timeout () +LIBXL_QMP_CMD_TIMEOUT ) *1000 );if (rc) goto out; aodev->qmp.ao = ao;
Signature · 1 line
γαῖα πυρί μιχθήτω
Re: [RFC PATCH v2 2/2] libs/light: expand device model start timeout use
Quoted 4 lines · Manos Pitsidianakis
Various timeout values that depend on the device model should also respect the device model start timeout setting. This commit adds the
__libxl_device_model_start_timeout()value to those time outs without changing their default values.
I don't like much this patch. It multiplies all qmp_cmd timeouts by 7.
First, could you make two separate patches for the changes? One to change LIBXL_QMP_CMD_TIMEOUT, and one to change LIBXL_STUBDOM_START_TIMEOUT.
Second, when the environment variable is unset, the timeout should stay at 10 for the qmp_cmd one. If for some reason that chosen value is to low, we could always have a separate patch to adjust the value.
Cheers,
Signature · 1 line
Anthony PERARD