Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing configuration options for spinlock-deadlock detection #2497

Merged
merged 2 commits into from Feb 13, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -464,6 +464,14 @@ hpx_option(HPX_WITH_SWAP_CONTEXT_EMULATION BOOL
"Emulate SwapContext API for coroutines (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)

hpx_option(HPX_WITH_SPINLOCK_DEADLOCK_DETECTION BOOL
"Enable spinlock deadlock detection (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)

if(HPX_WITH_SPINLOCK_DEADLOCK_DETECTION)
hpx_add_config_define(HPX_HAVE_SPINLOCK_DEADLOCK_DETECTION)
endif()

## Profiling related build options
hpx_option(HPX_WITH_APEX BOOL
"Enable APEX instrumentation support." OFF CATEGORY "Profiling")
Expand Down
2 changes: 2 additions & 0 deletions docs/manual/build_system/cmake_variables.qbk
Expand Up @@ -140,6 +140,7 @@ The options are split into these categories:
* [link build_system.cmake_variables.HPX_WITH_MAX_CPU_COUNT HPX_WITH_MAX_CPU_COUNT]
* [link build_system.cmake_variables.HPX_WITH_MORE_THAN_64_THREADS HPX_WITH_MORE_THAN_64_THREADS]
* [link build_system.cmake_variables.HPX_WITH_SCHEDULER_LOCAL_STORAGE HPX_WITH_SCHEDULER_LOCAL_STORAGE]
* [link build_system.cmake_variables.HPX_WITH_SPINLOCK_DEADLOCK_DETECTION HPX_WITH_SPINLOCK_DEADLOCK_DETECTION]
* [link build_system.cmake_variables.HPX_WITH_STACKTRACES HPX_WITH_STACKTRACES]
* [link build_system.cmake_variables.HPX_WITH_SWAP_CONTEXT_EMULATION HPX_WITH_SWAP_CONTEXT_EMULATION]
* [link build_system.cmake_variables.HPX_WITH_THREAD_BACKTRACE_DEPTH HPX_WITH_THREAD_BACKTRACE_DEPTH]
Expand All @@ -159,6 +160,7 @@ The options are split into these categories:
[[[#build_system.cmake_variables.HPX_WITH_MAX_CPU_COUNT] `HPX_WITH_MAX_CPU_COUNT:STRING`][HPX applications will not use more that this number of OS-Threads (default: 64)]]
[[[#build_system.cmake_variables.HPX_WITH_MORE_THAN_64_THREADS] `HPX_WITH_MORE_THAN_64_THREADS:BOOL`][HPX applications will be able to run on more than 64 cores]]
[[[#build_system.cmake_variables.HPX_WITH_SCHEDULER_LOCAL_STORAGE] `HPX_WITH_SCHEDULER_LOCAL_STORAGE:BOOL`][Enable scheduler local storage for all HPX schedulers (default: OFF)]]
[[[#build_system.cmake_variables.HPX_WITH_SPINLOCK_DEADLOCK_DETECTION] `HPX_WITH_SPINLOCK_DEADLOCK_DETECTION:BOOL`][Enable spinlock deadlock detection (default: OFF)]]
[[[#build_system.cmake_variables.HPX_WITH_STACKTRACES] `HPX_WITH_STACKTRACES:BOOL`][Attach backtraces to HPX exceptions (default: ON)]]
[[[#build_system.cmake_variables.HPX_WITH_SWAP_CONTEXT_EMULATION] `HPX_WITH_SWAP_CONTEXT_EMULATION:BOOL`][Emulate SwapContext API for coroutines (default: OFF)]]
[[[#build_system.cmake_variables.HPX_WITH_THREAD_BACKTRACE_DEPTH] `HPX_WITH_THREAD_BACKTRACE_DEPTH:STRING`][Thread stack back trace depth being captured (default: 5)]]
Expand Down
13 changes: 13 additions & 0 deletions docs/manual/config_defaults.qbk
Expand Up @@ -60,6 +60,8 @@ by section basis below.
lock_detection = ${HPX_LOCK_DETECTION:0}
throw_on_held_lock = ${HPX_THROW_ON_HELD_LOCK:1}
minimal_deadlock_detection = <debug>
spinlock_deadlock_detection = <debug>
spinlock_deadlock_detection_limit = ${HPX_SPINLOCK_DEADLOCK_DETECTION_LIMIT:1000000}
max_background_threads = ${HPX_MAX_BACKGROUND_THREADS:$[hpx.os_threads]}
max_idle_loop_count = ${HPX_MAX_IDLE_LOOP_COUNT:<hpx_idle_loop_count_max>}
max_busy_loop_count = ${HPX_MAX_BUSY_LOOP_COUNT:<hpx_busy_loop_count_max>}
Expand Down Expand Up @@ -118,6 +120,17 @@ by section basis below.
RelWithDebInfo, RelMinSize builds), this setting is effective only if
`HPX_WITH_THREAD_DEADLOCK_DETECTION` is set during configuration in
CMake.]]
[[`hpx.spinlock_deadlock_detection`]
[This setting verifies that spinlocks don't spin longer than specified using
the `hpx.spinlock_deadlock_detection_limit`. This setting is applicable only
if `HPX_WITH_SPINLOCK_DEADLOCK_DETECTION` is set during configuration in
CMake. By default this is set to `1` (for Debug builds) or to `0` (for Release,
RelWithDebInfo, RelMinSize builds).]]
[[`hpx.spinlock_deadlock_detection_limit`]
[This setting specifies the upper limit of allowed number of spins that
spinlocks are allowed to perform. This setting is applicable only
if `HPX_WITH_SPINLOCK_DEADLOCK_DETECTION` is set during configuration in
CMake. By default this is set to `1000000`.]]
[[`hpx.max_background_threads`]
[This setting defines the number of threads in the scheduler which are used
to execute background work. By default this is the same as the number of
Expand Down
8 changes: 4 additions & 4 deletions src/util/runtime_configuration.cpp
Expand Up @@ -166,11 +166,11 @@ namespace hpx { namespace util
#endif
#ifdef HPX_HAVE_SPINLOCK_DEADLOCK_DETECTION
#ifdef HPX_DEBUG
"spinlick_deadlock_detection = ${HPX_SPINLOCK_DEADLOCK_DETECTION:1}",
"spinlock_deadlock_detection = ${HPX_SPINLOCK_DEADLOCK_DETECTION:1}",
#else
"spinlick_deadlock_detection = ${HPX_SPINLOCK_DEADLOCK_DETECTION:0}",
"spinlock_deadlock_detection = ${HPX_SPINLOCK_DEADLOCK_DETECTION:0}",
#endif
"spinlick_deadlock_detection_limit = "
"spinlock_deadlock_detection_limit = "
"${HPX_SPINLOCK_DEADLOCK_DETECTION_LIMIT:1000000}",
#endif
"expect_connecting_localities = ${HPX_EXPECT_CONNECTING_LOCALITIES:0}",
Expand Down Expand Up @@ -841,7 +841,7 @@ namespace hpx { namespace util
util::section const* sec = get_section("hpx");
if (nullptr != sec) {
return hpx::util::get_entry_as<std::size_t>(
*sec, "spinlick_deadlock_detection_limit", "1000000");
*sec, "spinlock_deadlock_detection_limit", "1000000");
}
}
return HPX_SPINLOCK_DEADLOCK_DETECTION_LIMIT;
Expand Down