kcsan: Move interfaces that affects checks to kcsan-checks.h
authorMarco Elver <elver@google.com>
Tue, 11 Feb 2020 16:04:19 +0000 (17:04 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 21 Mar 2020 08:43:47 +0000 (09:43 +0100)
This moves functions that affect state changing the behaviour of
kcsan_check_access() to kcsan-checks.h. Since these are likely used with
kcsan_check_access() it makes more sense to have them in kcsan-checks.h,
to avoid including all of 'include/linux/kcsan.h'.

No functional change intended.

Acked-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/kcsan-checks.h
include/linux/kcsan.h

index cf6961794e9a10d9d836a1e1d11d8846ff1dd99f..8675411c8dbcde023de68e0dfd28d17c11d03033 100644 (file)
  */
 void __kcsan_check_access(const volatile void *ptr, size_t size, int type);
 
-#else
+/**
+ * kcsan_nestable_atomic_begin - begin nestable atomic region
+ *
+ * Accesses within the atomic region may appear to race with other accesses but
+ * should be considered atomic.
+ */
+void kcsan_nestable_atomic_begin(void);
+
+/**
+ * kcsan_nestable_atomic_end - end nestable atomic region
+ */
+void kcsan_nestable_atomic_end(void);
+
+/**
+ * kcsan_flat_atomic_begin - begin flat atomic region
+ *
+ * Accesses within the atomic region may appear to race with other accesses but
+ * should be considered atomic.
+ */
+void kcsan_flat_atomic_begin(void);
+
+/**
+ * kcsan_flat_atomic_end - end flat atomic region
+ */
+void kcsan_flat_atomic_end(void);
+
+/**
+ * kcsan_atomic_next - consider following accesses as atomic
+ *
+ * Force treating the next n memory accesses for the current context as atomic
+ * operations.
+ *
+ * @n number of following memory accesses to treat as atomic.
+ */
+void kcsan_atomic_next(int n);
+
+#else /* CONFIG_KCSAN */
+
 static inline void __kcsan_check_access(const volatile void *ptr, size_t size,
                                        int type) { }
-#endif
+
+static inline void kcsan_nestable_atomic_begin(void)   { }
+static inline void kcsan_nestable_atomic_end(void)     { }
+static inline void kcsan_flat_atomic_begin(void)       { }
+static inline void kcsan_flat_atomic_end(void)         { }
+static inline void kcsan_atomic_next(int n)            { }
+
+#endif /* CONFIG_KCSAN */
 
 /*
  * kcsan_*: Only calls into the runtime when the particular compilation unit has
index 1019e3a2c6897dd2fdda752d93a7a60407ee639c..7a614ca558f65fe380c7316e63157098c551ef1b 100644 (file)
@@ -56,52 +56,11 @@ void kcsan_disable_current(void);
  */
 void kcsan_enable_current(void);
 
-/**
- * kcsan_nestable_atomic_begin - begin nestable atomic region
- *
- * Accesses within the atomic region may appear to race with other accesses but
- * should be considered atomic.
- */
-void kcsan_nestable_atomic_begin(void);
-
-/**
- * kcsan_nestable_atomic_end - end nestable atomic region
- */
-void kcsan_nestable_atomic_end(void);
-
-/**
- * kcsan_flat_atomic_begin - begin flat atomic region
- *
- * Accesses within the atomic region may appear to race with other accesses but
- * should be considered atomic.
- */
-void kcsan_flat_atomic_begin(void);
-
-/**
- * kcsan_flat_atomic_end - end flat atomic region
- */
-void kcsan_flat_atomic_end(void);
-
-/**
- * kcsan_atomic_next - consider following accesses as atomic
- *
- * Force treating the next n memory accesses for the current context as atomic
- * operations.
- *
- * @n number of following memory accesses to treat as atomic.
- */
-void kcsan_atomic_next(int n);
-
 #else /* CONFIG_KCSAN */
 
 static inline void kcsan_init(void)                    { }
 static inline void kcsan_disable_current(void)         { }
 static inline void kcsan_enable_current(void)          { }
-static inline void kcsan_nestable_atomic_begin(void)   { }
-static inline void kcsan_nestable_atomic_end(void)     { }
-static inline void kcsan_flat_atomic_begin(void)       { }
-static inline void kcsan_flat_atomic_end(void)         { }
-static inline void kcsan_atomic_next(int n)            { }
 
 #endif /* CONFIG_KCSAN */