Skip to content

Commit

Permalink
issue: 3884801 Add XLIO_QUICK_START parameter
Browse files Browse the repository at this point in the history
The parameter disables the check for resident hugepages. The check can
be expensive and, on the other hand, can be irrelevant based on the
system configuration. Therefore, disabling it reduces the initialization
time which can be crucial in some scenarios.

The name for the parameter is chosen to extend the idea of reducing
initialization time in the future.

Signed-off-by: Dmytro Podgornyi <[email protected]>
  • Loading branch information
pasis committed Nov 11, 2024
1 parent b80bf4a commit eedc045
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Example:
XLIO DETAILS: SigIntr Ctrl-C Handle Enabled [XLIO_HANDLE_SIGINTR]
XLIO DETAILS: SegFault Backtrace Disabled [XLIO_HANDLE_SIGSEGV]
XLIO DETAILS: Print a report Disabled [XLIO_PRINT_REPORT]
XLIO DETAILS: Quick start Disabled [XLIO_QUICK_START]
XLIO DETAILS: Ring allocation logic TX 0 (Ring per interface) [XLIO_RING_ALLOCATION_LOGIC_TX]
XLIO DETAILS: Ring allocation logic RX 0 (Ring per interface) [XLIO_RING_ALLOCATION_LOGIC_RX]
XLIO INFO : Ring migration ratio TX -1 [XLIO_RING_MIGRATION_RATIO_TX]
Expand Down Expand Up @@ -308,6 +309,13 @@ When Enabled, print backtrace if segmentation fault happens.
Value range is 0 to 1
Default value is 0 (Disabled)

XLIO_QUICK_START
Avoid expensive extra checks to reduce the initialization time. This may result
in failures in case of a system misconfiguration.
For example, if the parameter is enabled and hugepages are requested beyond the
cgroup limit, XLIO crashes due to an access to an unmapped page.
Default value is 0 (Disabled)

XLIO_ZC_BUFS
Number of global zerocopy data buffer elements allocation.
Default value is 200000
Expand Down
2 changes: 2 additions & 0 deletions src/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ void print_xlio_global_settings()
safe_mce_sys().handle_segfault ? "Enabled " : "Disabled");
VLOG_PARAM_STRING("Print a report", safe_mce_sys().print_report, MCE_DEFAULT_PRINT_REPORT,
SYS_VAR_PRINT_REPORT, safe_mce_sys().print_report ? "Enabled " : "Disabled");
VLOG_PARAM_STRING("Quick start", safe_mce_sys().quick_start, MCE_DEFAULT_QUICK_START,
SYS_VAR_QUICK_START, safe_mce_sys().quick_start ? "Enabled " : "Disabled");

VLOG_PARAM_NUMSTR("Ring allocation logic TX", safe_mce_sys().ring_allocation_logic_tx,
MCE_DEFAULT_RING_ALLOCATION_LOGIC_TX, SYS_VAR_RING_ALLOCATION_LOGIC_TX,
Expand Down
9 changes: 5 additions & 4 deletions src/core/util/hugepage_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void *hugepage_mgr::alloc_hugepages_helper(size_t &size, size_t hugepage)
if (ptr == MAP_FAILED) {
ptr = nullptr;
__log_info_dbg("mmap failed (errno=%d), skipping hugepage %zu kB", errno, hugepage / 1024U);
} else {
} else if (!safe_mce_sys().quick_start) {
/* Check whether all the pages are resident. In a container, allocation beyond the limit can
* be successful and lead to SIGBUS on an access.
*/
Expand Down Expand Up @@ -148,11 +148,12 @@ void *hugepage_mgr::alloc_hugepages_helper(size_t &size, size_t hugepage)
__log_info_dbg("Cannot use hugepages, skipping hugepage %zu kB", hugepage / 1024U);

ptr = nullptr;
} else {
// Success.
size = actual_size;
}
}
if (ptr) {
// Success.
size = actual_size;
}
return ptr;
}

Expand Down
5 changes: 5 additions & 0 deletions src/core/util/sys_vars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ void mce_sys_var::get_env_params()
service_enable = MCE_DEFAULT_SERVICE_ENABLE;

print_report = MCE_DEFAULT_PRINT_REPORT;
quick_start = MCE_DEFAULT_QUICK_START;
log_level = VLOG_DEFAULT;
log_details = MCE_DEFAULT_LOG_DETAILS;
log_colors = MCE_DEFAULT_LOG_COLORS;
Expand Down Expand Up @@ -1084,6 +1085,10 @@ void mce_sys_var::get_env_params()
print_report = atoi(env_ptr) ? true : false;
}

if ((env_ptr = getenv(SYS_VAR_QUICK_START))) {
quick_start = atoi(env_ptr) ? true : false;
}

if ((env_ptr = getenv(SYS_VAR_LOG_FILENAME))) {
read_env_variable_with_pid(log_filename, sizeof(log_filename), env_ptr);
}
Expand Down
5 changes: 4 additions & 1 deletion src/core/util/sys_vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ struct mce_sys_var {
uint32_t mce_spec;

bool print_report;
bool quick_start;
vlog_levels_t log_level;
uint32_t log_details;
char log_filename[PATH_MAX];
Expand Down Expand Up @@ -558,6 +559,7 @@ extern mce_sys_var &safe_mce_sys();
#define SYS_VAR_HANDLE_SIGINTR "XLIO_HANDLE_SIGINTR"
#define SYS_VAR_HANDLE_SIGSEGV "XLIO_HANDLE_SIGSEGV"
#define SYS_VAR_STATS_FD_NUM "XLIO_STATS_FD_NUM"
#define SYS_VAR_QUICK_START "XLIO_QUICK_START"

#define SYS_VAR_RING_ALLOCATION_LOGIC_TX "XLIO_RING_ALLOCATION_LOGIC_TX"
#define SYS_VAR_RING_ALLOCATION_LOGIC_RX "XLIO_RING_ALLOCATION_LOGIC_RX"
Expand Down Expand Up @@ -710,7 +712,8 @@ extern mce_sys_var &safe_mce_sys();
#define MCE_DEFAULT_APP_ID ("XLIO_DEFAULT_APPLICATION_ID")
#define MCE_DEFAULT_HANDLE_SIGINTR (true)
#define MCE_DEFAULT_HANDLE_SIGFAULT (false)
#define MCE_DEFAULT_STATS_FD_NUM 0
#define MCE_DEFAULT_STATS_FD_NUM (0)
#define MCE_DEFAULT_QUICK_START (false)
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_TX (RING_LOGIC_PER_THREAD)
#define MCE_DEFAULT_RING_ALLOCATION_LOGIC_RX (RING_LOGIC_PER_THREAD)
#define MCE_DEFAULT_RING_MIGRATION_RATIO_TX (-1)
Expand Down

0 comments on commit eedc045

Please sign in to comment.