Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf mutex: Add annotations for LOCKS_EXCLUDED and LOCKS_RETURNED

Used to annotate when locks shouldn't be held for a function or if a
function returns a lock that's used by later mutex lock unlock
operations.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250318043151.137973-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
c5ebf3a2 658b34cc

+8
+8
tools/perf/util/mutex.h
··· 33 33 /* Documents if a type is a lockable type. */ 34 34 #define LOCKABLE __attribute__((lockable)) 35 35 36 + /* Documents a function that expects a lock not to be held prior to entry. */ 37 + #define LOCKS_EXCLUDED(...) __attribute__((locks_excluded(__VA_ARGS__))) 38 + 39 + /* Documents a function that returns a lock. */ 40 + #define LOCK_RETURNED(x) __attribute__((lock_returned(x))) 41 + 36 42 /* Documents functions that acquire a lock in the body of a function, and do not release it. */ 37 43 #define EXCLUSIVE_LOCK_FUNCTION(...) __attribute__((exclusive_lock_function(__VA_ARGS__))) 38 44 ··· 63 57 #define GUARDED_BY(x) 64 58 #define PT_GUARDED_BY(x) 65 59 #define LOCKABLE 60 + #define LOCKS_EXCLUDED(...) 61 + #define LOCK_RETURNED(x) 66 62 #define EXCLUSIVE_LOCK_FUNCTION(...) 67 63 #define UNLOCK_FUNCTION(...) 68 64 #define EXCLUSIVE_TRYLOCK_FUNCTION(...)