Repository navigation
UCS/TOPO: Simplify system device access under topo lock - #12045
Conversation
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: Azure Pipelines job "Static_check Static checks" failed at the Root cause: The build itself succeeded ( #define UCS_TOPO_SYS_DEVICE_GET_FIELD(_sys_dev, _field, _default) \
({ \
ucs_topo_sys_device_info_t *_get_device; /* <-- uninitialized */ \
ucs_typeof(_get_device->_field) _get_value = (_default); \
...
The six reported lines are exactly the six call sites of the macro, each expanding the same flaw:
Each appears twice because the file is analyzed under two configurations/passes. This is a true-positive-shaped false positive: not a runtime bug, but it does block the gate. Implicated commit: File: Suggested fix: Avoid the uninitialized-pointer dereference in the typeof. Cleanest option — take the type from the struct type directly, so no pointer variable is involved in #define UCS_TOPO_SYS_DEVICE_GET_FIELD(_sys_dev, _field, _default) \
({ \
ucs_topo_sys_device_info_t *_get_device = NULL; \
ucs_typeof(((ucs_topo_sys_device_info_t*)0)->_field) _get_value = \
(_default); \
\
ucs_spin_lock(&ucs_topo_global_ctx.lock); \
_get_device = ucs_topo_get_sys_device_nolock(_sys_dev); \
if (_get_device != NULL) { \
_get_value = _get_device->_field; \
} \
ucs_spin_unlock(&ucs_topo_global_ctx.lock); \
_get_value; \
})Simply adding Two secondary cleanup notes, not the cause of this failure:
Related: PR #12045 (the PR under test). Prior commits in the same topo refactor series by the same author:
|
35a2f19 to
f281b45
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 CI Triage Agent — TL;DR: The rhel82 x86_64 build failed to compile Full analysisSummary: Root cause: Compile error, not a test/flake. Implicated commit: File: Suggested fix: Two complementary changes, either of which silences the warning; doing both is safest:
static ucs_status_t
ucs_topo_sys_dev_to_sysfs_path(ucs_sys_device_t sys_dev, char *path, size_t max)
{
ucs_topo_sys_device_info_t *device = NULL; /* was uninitialized */
ucs_status_t status;
static ucs_status_t
ucs_topo_get_sys_device_checked_nolock(ucs_sys_device_t sys_dev,
ucs_topo_sys_device_info_t **device_p)
{
*device_p = NULL; /* add this first line */
if (sys_dev == UCS_SYS_DEVICE_ID_UNKNOWN) {
ucs_error("system device is unknown");
return UCS_ERR_INVALID_PARAM;
}
...
}Also audit the other callers of Related: PR #12045 (the failing PR); prior topo work #11869, #11990 |
eba0ae9 to
f6c54ac
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
Residual coverage gap: No test exercises |
Signed-off-by: Guy Ealey Morag <gealeymorag@nvidia.com>
Signed-off-by: Guy Ealey Morag <gealeymorag@nvidia.com>
Rename the lock-held sysfs path helpers to _nolock, and add gtests for the debug-log deadlock and for an unregistered device in get_distance. Signed-off-by: Guy Ealey Morag <gealeymorag@nvidia.com>
a587800 to
54d772f
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
Residual coverage gap: no test covers the deadlock path through Residual coverage gap: |
Signed-off-by: Guy Ealey Morag <gealeymorag@nvidia.com>
|
🤖 Starting review — findings will be posted here when done. |
Signed-off-by: Guy Ealey Morag <gealeymorag@nvidia.com>
|
🤖 Starting review — findings will be posted here when done. |
|
minor: using
pls add a short comment that debug level is what reaches the failing sysfs-path log; otherwise this |
|
🤖 CI Triage Agent — TL;DR: The gtest job failed on exactly one test — Full analysisSummary: Root cause: Evidence from the log: this is a genuine assertion failure, not a timeout/hang — the suite ran to completion (
Caveat: the exact gtest assertion line is outside the retained log tail (only the last ~500 lines of a 50-minute run are available), so the data-mismatch message itself could not be read; the above is the only PR-owned code on the failing path. Implicated commit: PR #12045 head File: src/ucs/sys/topo/base/topo.c:710 ( Suggested fix:
Related: #12045 (this PR); topology/lane-selection neighbours: #12126, #11985, #12206
|
What?
Look up and validate system devices through one helper under the topology lock, and fix two bugs this exposed:
ucs_topo_sys_device_get_name(), which re-took the non-recursive topology spinlock.devices[]inucs_topo_get_distance_sysfs()for a device ID that was never registered. Such a device now gets the default distance, as an unknown device does.Why?
Each getter and setter repeated the same unknown and out-of-range checks, with different error messages and exit paths, and some paths skipped the range check entirely.
How?
Helpers that expect the lock to be held have a
_nolocksuffix and assert it in debug builds. New gtests cover the deadlock (it hangs without the fix) and the fallback for an unregistered device.