Thread (33 messages) 33 messages, 4 authors, 2021-07-22
STALE1784d
Revisions (2)
  1. rfc current
  2. v3 [diff vs current]

[RFC PATCH 05/10] perf workqueue: add sparse annotation header

From: Riccardo Mancini <hidden>
Date: 2021-07-13 12:11:47
Also in: lkml
Subsystem: performance events subsystem, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds

This patch adds a simple header containing sparse annotations.

TODO: what is the best place to put this?

Signed-off-by: Riccardo Mancini <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help