Skip to content
Open
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
1 change: 1 addition & 0 deletions src/multiprocess/multiprocess_memory_limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ void lock_shrreg() {
struct timespec sem_ts;
get_timespec(SEM_WAIT_TIME, &sem_ts);

SEQ_POINT_MARK(SEQ_BEFORE_ACQUIRE_SEMLOCK);
int status = sem_timedwait(&region->sem, &sem_ts);
SEQ_POINT_MARK(SEQ_ACQUIRE_SEMLOCK_OK);

Expand Down
6 changes: 5 additions & 1 deletion src/multiprocess/multiprocess_memory_limit.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@

#define SEQ_AFTER_INC 8
#define SEQ_AFTER_DEC 9
#define SEQ_BEFORE_ACQUIRE_SEMLOCK 10

#ifndef SEQ_POINT_MARK
#ifdef SHRREG_SEQUENCE_POINT_CALLBACK
void SHRREG_SEQUENCE_POINT_CALLBACK(int sequence);
#define SEQ_POINT_MARK(s) SHRREG_SEQUENCE_POINT_CALLBACK(s)
#elif !defined(SEQ_POINT_MARK)
#define SEQ_POINT_MARK(s)
#endif

Expand Down
22 changes: 20 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ foreach(TEST_SCRIPT ${TEST_SCRIPTS})
get_filename_component(TEST_TARGET_NAME ${RELATIVE_TEST_PATH} NAME_WE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARGET_DIR})

if (TEST_TARGET_NAME STREQUAL "test_postinit_owner_death")
if (TEST_SCRIPT MATCHES "test_shared_region_concurrency.c")
add_executable(${TEST_TARGET_NAME} ${TEST_SCRIPT}
${CMAKE_CURRENT_SOURCE_DIR}/../src/multiprocess/multiprocess_memory_limit.c
${CMAKE_CURRENT_SOURCE_DIR}/../src/log_utils.c)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE
SHRREG_SEQUENCE_POINT_CALLBACK=shrreg_test_sequence_point)
target_compile_options(${TEST_TARGET_NAME} PRIVATE
-D_GNU_SOURCE -ffunction-sections -fdata-sections)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
LINK_FLAGS "-Wl,--no-export-dynamic,--gc-sections")
elseif (TEST_TARGET_NAME STREQUAL "test_postinit_owner_death")
# Build this focused regression test with the production shared-region
# implementation. It does not invoke any CUDA/NVML entry point at
# runtime. Section garbage collection drops unrelated GPU-facing
Expand All @@ -34,7 +44,8 @@ foreach(TEST_SCRIPT ${TEST_SCRIPTS})
endif()

list(APPEND TEST_TARGET_NAMES_LIST ${TEST_TARGET_NAME})
if (TEST_TARGET_NAME STREQUAL "test_postinit_owner_death")
if (TEST_SCRIPT MATCHES "test_shared_region_concurrency.c" OR
TEST_TARGET_NAME STREQUAL "test_postinit_owner_death")
target_link_libraries(${TEST_TARGET_NAME} -lrt -lpthread)
else()
target_link_libraries(${TEST_TARGET_NAME} -lrt -lpthread
Expand All @@ -48,6 +59,13 @@ foreach(TEST_SCRIPT ${TEST_SCRIPTS})
endforeach()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

add_test(NAME shared_region_concurrency
COMMAND test_shared_region_concurrency)
# The test waits on the start barrier and on registration in sequence, each
# bounded by SHRREG_TEST_TIMEOUT_MS (20s default), so it can spend 40s before
# printing which stage stalled. Keep this above that budget or ctest kills it
# first and the diagnostic is lost.
set_tests_properties(shared_region_concurrency PROPERTIES TIMEOUT 90)
add_test(NAME postinit_owner_death
COMMAND test_postinit_owner_death)
set_tests_properties(postinit_owner_death PROPERTIES TIMEOUT 20)
Expand Down
Loading
Loading