[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1d27bcf0ee7ba61850b4297318241bc07ba06e07.1626177381.git.rickyman7@gmail.com>
Date: Tue, 13 Jul 2021 14:11:16 +0200
From: Riccardo Mancini <rickyman7@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Riccardo Mancini <rickyman7@...il.com>
Subject: [RFC PATCH 05/10] perf workqueue: add sparse annotation header
This patch adds a simple header containing sparse annotations.
TODO: what is the best place to put this?
Signed-off-by: Riccardo Mancini <rickyman7@...il.com>
---
tools/perf/util/workqueue/sparse.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 tools/perf/util/workqueue/sparse.h
diff --git a/tools/perf/util/workqueue/sparse.h b/tools/perf/util/workqueue/sparse.h
new file mode 100644
index 0000000000000000..644f6db8f050ab50
--- /dev/null
+++ b/tools/perf/util/workqueue/sparse.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __WORKQUEUE_SPARSE_H
+#define __WORKQUEUE_SPARSE_H
+
+#ifdef __CHECKER__
+# define __must_hold(x) __attribute__((context(x, 1, 1)))
+# define __acquires(x) __attribute__((context(x, 0, 1)))
+# define __releases(x) __attribute__((context(x, 1, 0)))
+# define __acquire(x) __context__(x, 1)
+# define __release(x) __context__(x, -1)
+# define __cond_lock(x, c) ((c) ? ({ __acquire(x); 1; }) : 0)
+#else
+# define __must_hold(x)
+# define __acquires(x)
+# define __releases(x)
+# define __acquire(x) ((void)0)
+# define __release(x) ((void)0)
+# define __cond_lock(x, c) (c)
+#endif
+
+#endif /* __WORKQUEUE_SPARSE_H */
--
2.31.1
Powered by blists - more mailing lists