mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Add annotations used by clang's -Wthread-safety. Fix dsos compilation errors caused by a lock of annotations. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Bill Wendling <morbo@google.com> Cc: Chaitanya S Prakash <chaitanyas.prakash@arm.com> Cc: Fei Lang <langfei@huawei.com> Cc: Howard Chu <howardchu95@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Justin Stitt <justinstitt@google.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Link: https://lore.kernel.org/r/20250519224645.1810891-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
30 lines
706 B
C
30 lines
706 B
C
#ifndef _PERF_RWSEM_H
|
|
#define _PERF_RWSEM_H
|
|
|
|
#include <pthread.h>
|
|
#include "mutex.h"
|
|
|
|
/*
|
|
* Mutexes have additional error checking. Enable to use a mutex rather than a
|
|
* rwlock for debugging.
|
|
*/
|
|
#define RWS_ERRORCHECK 0
|
|
|
|
struct LOCKABLE rw_semaphore {
|
|
#if RWS_ERRORCHECK
|
|
struct mutex mtx;
|
|
#else
|
|
pthread_rwlock_t lock;
|
|
#endif
|
|
};
|
|
|
|
int init_rwsem(struct rw_semaphore *sem);
|
|
int exit_rwsem(struct rw_semaphore *sem);
|
|
|
|
int down_read(struct rw_semaphore *sem) SHARED_LOCK_FUNCTION(sem);
|
|
int up_read(struct rw_semaphore *sem) UNLOCK_FUNCTION(sem);
|
|
|
|
int down_write(struct rw_semaphore *sem) EXCLUSIVE_LOCK_FUNCTION(sem);
|
|
int up_write(struct rw_semaphore *sem) UNLOCK_FUNCTION(sem);
|
|
|
|
#endif /* _PERF_RWSEM_H */
|