summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-report
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2026-09-03 10:16:38 +0000
committerNathan Chancellor <nathan@kernel.org>2026-09-08 16:54:02 -0700
commit0bb666d5f5a2339a5692afb312c2161df9620503 (patch)
tree692356afa0958e6a7a1c98b997e9985bb207101d /tools/perf/scripts/python/bin/stackcollapse-report
parentcee9395acd8043be0644b25c34bfa86623f2b935 (diff)
downloadlinux-0bb666d5f5a2339a5692afb312c2161df9620503.tar.gz
linux-0bb666d5f5a2339a5692afb312c2161df9620503.zip
once_lite: Simplify condition handling and fix context analysis
When WARN_ON_ONCE() wraps a conditional lock acquisition (such as down_write_trylock()) on architectures relying on DO_ONCE_LITE_IF() (e.g. arm), Clang's context analysis (Thread Safety Analysis) failed with a false positive: fs/ext2/xattr.c:825:6: error: rw_semaphore 'EXT2_I().xattr_sem' is not held on every path through here [-Werror,-Wthread-safety-analysis] 825 | if (WARN_ON_ONCE(!down_write_trylock(&EXT2_I(inode)->xattr_sem))) | ^ This happens because DO_ONCE_LITE_IF() branches on __ONCE_LITE_IF()'s return value (__ret_once), creating an intermediate branch merge point where the lock may or may not be held depending on whether the once-flag (__already_done) was already set. Because the merge branch condition is __ret_once rather than the trylock predicate (__ret_do_once), Clang cannot reconcile the lockset at the branch merge points. Fix it by refactoring __ONCE_LITE_IF() into an unconditional __ONCE_LITE() primitive and redefining __ONCE_LITE_IF(condition) as: (unlikely(condition) && __ONCE_LITE()) This simplifies the implementation, short-circuits evaluation so that __ONCE_LITE() is not called when the condition is false, and ensures that DO_ONCE_LITE_IF() only enters __ONCE_LITE() when __ret_do_once is true. Reported-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/all/20260903072759.GA1750084@ax162/ Signed-off-by: Marco Elver <elver@google.com> Tested-by: Nathan Chancellor <nathan@kernel.org> # build Link: https://patch.msgid.link/20260903101843.3462767-1-elver@google.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions