From 0e4682cb4ba022efd12006c68675d10e3a9b3d61 Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Thu, 11 May 2023 16:05:23 +0200 Subject: [PATCH 1/2] DAOS-8781 client: allow polling timeout to be modified via env Introduce a new env variable called D_POLL_TIMEOUT in libdaos to tune how aggressive the polling on network progress is for synchronous operation. For asynchronous operations, the caller already passes a timeout to eq_poll or event_test. The default value (0) is not changed and means busy polling. This can be modified to a value in micro-seconds. Signed-off-by: Johann Lombardi --- src/client/api/event.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/api/event.c b/src/client/api/event.c index b5d61dcff12..b411b14ad3d 100644 --- a/src/client/api/event.c +++ b/src/client/api/event.c @@ -20,6 +20,12 @@ static __thread daos_event_t ev_thpriv; static __thread bool ev_thpriv_is_init; +/** + * Global progress timeout for synchronous operation + * busy-polling by default (0), timeout in us otherwise + */ +static uint32_t ev_prog_timeout = 0; + #define EQ_WITH_CRT #if !defined(EQ_WITH_CRT) @@ -91,6 +97,8 @@ daos_eq_lib_init() eq_ref = 1; + d_getenv_int("D_POLL_TIMEOUT", &ev_prog_timeout); + unlock: D_MUTEX_UNLOCK(&daos_eq_lock); return rc; @@ -1262,7 +1270,7 @@ daos_event_priv_wait() /* Wait on the event to complete */ while (evx->evx_status != DAOS_EVS_READY) { - rc = crt_progress_cond(evx->evx_ctx, 0, ev_progress_cb, &epa); + rc = crt_progress_cond(evx->evx_ctx, ev_prog_timeout, ev_progress_cb, &epa); /** progress succeeded, loop can exit if event completed */ if (rc == 0) { From 4da5cf5816476d0482d4574822d710a6b2d19fcc Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Thu, 11 May 2023 19:00:28 +0200 Subject: [PATCH 2/2] Address review feedback Signed-off-by: Johann Lombardi --- docs/admin/env_variables.md | 1 + src/cart/crt_init.c | 3 ++- src/client/api/event.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/admin/env_variables.md b/docs/admin/env_variables.md index 3fca2f1db1e..daac2c8e6a6 100644 --- a/docs/admin/env_variables.md +++ b/docs/admin/env_variables.md @@ -68,6 +68,7 @@ Environment variables in this section only apply to the client side. |Variable |Description| |-------------------------|-----------| |FI\_MR\_CACHE\_MAX\_COUNT|Enable MR (Memory Registration) caching in OFI layer. Recommended to be set to 0 (disable) when CRT\_DISABLE\_MEM\_PIN is NOT set to 1. INTEGER. Default to unset.| +|D\_POLL\_TIMEOUT|Polling timeout passed to network progress for synchronous operations. Default to 0 (busy polling), value in micro-seconds otherwise.| ## Debug System (Client & Server) diff --git a/src/cart/crt_init.c b/src/cart/crt_init.c index 884a2ac233d..11638bb25fb 100644 --- a/src/cart/crt_init.c +++ b/src/cart/crt_init.c @@ -71,7 +71,8 @@ dump_envariables(void) "CRT_CTX_SHARE_ADDR", "CRT_CTX_NUM", "D_FI_CONFIG", "FI_UNIVERSE_SIZE", "CRT_ENABLE_MEM_PIN", "FI_OFI_RXM_USE_SRX", "D_LOG_FLUSH", "CRT_MRC_ENABLE", - "CRT_SECONDARY_PROVIDER", "D_PROVIDER_AUTH_KEY", "D_PORT_AUTO_ADJUST"}; + "CRT_SECONDARY_PROVIDER", "D_PROVIDER_AUTH_KEY", "D_PORT_AUTO_ADJUST", + "D_POOL_TIMEOUT"}; D_INFO("-- ENVARS: --\n"); for (i = 0; i < ARRAY_SIZE(envars); i++) { diff --git a/src/client/api/event.c b/src/client/api/event.c index b411b14ad3d..49a361c2e8b 100644 --- a/src/client/api/event.c +++ b/src/client/api/event.c @@ -24,7 +24,7 @@ static __thread bool ev_thpriv_is_init; * Global progress timeout for synchronous operation * busy-polling by default (0), timeout in us otherwise */ -static uint32_t ev_prog_timeout = 0; +static uint32_t ev_prog_timeout; #define EQ_WITH_CRT