Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ucm/api/ucm.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ typedef struct ucm_global_config {
int dlopen_process_rpath; /* Process RPATH section in dlopen hook */
int module_unload_prevent_mode; /* Module unload prevention mode */
int bistro_force_far_jump; /* Force far jump with bistro patching */
double bistro_grace_duration; /* Grace duration for bistro patching
* in seconds */
} ucm_global_config_t;


Expand Down
5 changes: 2 additions & 3 deletions src/ucm/bistro/bistro.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ void ucm_bistro_modify_code(void *dst, const ucm_bistro_lock_t *bytes)
ucs_status_t
ucm_bistro_apply_patch_atomic(void *dst, const void *patch, size_t len)
{
size_t skip = sizeof(ucm_bistro_lock_t);
double grace_duration = 5e-3;
size_t skip = sizeof(ucm_bistro_lock_t);
double deadline;
ucs_status_t status;

Expand All @@ -84,7 +83,7 @@ ucm_bistro_apply_patch_atomic(void *dst, const void *patch, size_t len)
ucm_bistro_patch_lock(dst);
ucs_clear_cache(dst, UCS_PTR_BYTE_OFFSET(dst, len));

deadline = ucm_get_time() + grace_duration;
deadline = ucm_get_time() + ucm_global_opts.bistro_grace_duration;
while (ucm_get_time() < deadline) {
sched_yield();
}
Expand Down
7 changes: 7 additions & 0 deletions src/ucs/config/ucm_opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ static ucs_config_field_t ucm_global_config_table[] = {
ucs_offsetof(ucm_global_config_t, bistro_force_far_jump),
UCS_CONFIG_TYPE_BOOL},

{"BISTRO_GRACE_DURATION", "50ms",
"Grace period duration to wait for existing code flows to complete when\n"
"applying bistro patches. This allows threads currently executing patched\n"
"code to finish before the patch is applied.",
ucs_offsetof(ucm_global_config_t, bistro_grace_duration),
UCS_CONFIG_TYPE_TIME},

{NULL}
};

Expand Down
Loading