Skip to content

Commit f0f6928

Browse files
melverIngo Molnar
authored andcommitted
kcsan: Move interfaces that affects checks to kcsan-checks.h
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 <[email protected]> Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 3a5b45e commit f0f6928

File tree

2 files changed

+46
-43
lines changed

2 files changed

+46
-43
lines changed

include/linux/kcsan-checks.h

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,54 @@
3232
*/
3333
void __kcsan_check_access(const volatile void *ptr, size_t size, int type);
3434

35-
#else
35+
/**
36+
* kcsan_nestable_atomic_begin - begin nestable atomic region
37+
*
38+
* Accesses within the atomic region may appear to race with other accesses but
39+
* should be considered atomic.
40+
*/
41+
void kcsan_nestable_atomic_begin(void);
42+
43+
/**
44+
* kcsan_nestable_atomic_end - end nestable atomic region
45+
*/
46+
void kcsan_nestable_atomic_end(void);
47+
48+
/**
49+
* kcsan_flat_atomic_begin - begin flat atomic region
50+
*
51+
* Accesses within the atomic region may appear to race with other accesses but
52+
* should be considered atomic.
53+
*/
54+
void kcsan_flat_atomic_begin(void);
55+
56+
/**
57+
* kcsan_flat_atomic_end - end flat atomic region
58+
*/
59+
void kcsan_flat_atomic_end(void);
60+
61+
/**
62+
* kcsan_atomic_next - consider following accesses as atomic
63+
*
64+
* Force treating the next n memory accesses for the current context as atomic
65+
* operations.
66+
*
67+
* @n number of following memory accesses to treat as atomic.
68+
*/
69+
void kcsan_atomic_next(int n);
70+
71+
#else /* CONFIG_KCSAN */
72+
3673
static inline void __kcsan_check_access(const volatile void *ptr, size_t size,
3774
int type) { }
38-
#endif
75+
76+
static inline void kcsan_nestable_atomic_begin(void) { }
77+
static inline void kcsan_nestable_atomic_end(void) { }
78+
static inline void kcsan_flat_atomic_begin(void) { }
79+
static inline void kcsan_flat_atomic_end(void) { }
80+
static inline void kcsan_atomic_next(int n) { }
81+
82+
#endif /* CONFIG_KCSAN */
3983

4084
/*
4185
* kcsan_*: Only calls into the runtime when the particular compilation unit has

include/linux/kcsan.h

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,52 +56,11 @@ void kcsan_disable_current(void);
5656
*/
5757
void kcsan_enable_current(void);
5858

59-
/**
60-
* kcsan_nestable_atomic_begin - begin nestable atomic region
61-
*
62-
* Accesses within the atomic region may appear to race with other accesses but
63-
* should be considered atomic.
64-
*/
65-
void kcsan_nestable_atomic_begin(void);
66-
67-
/**
68-
* kcsan_nestable_atomic_end - end nestable atomic region
69-
*/
70-
void kcsan_nestable_atomic_end(void);
71-
72-
/**
73-
* kcsan_flat_atomic_begin - begin flat atomic region
74-
*
75-
* Accesses within the atomic region may appear to race with other accesses but
76-
* should be considered atomic.
77-
*/
78-
void kcsan_flat_atomic_begin(void);
79-
80-
/**
81-
* kcsan_flat_atomic_end - end flat atomic region
82-
*/
83-
void kcsan_flat_atomic_end(void);
84-
85-
/**
86-
* kcsan_atomic_next - consider following accesses as atomic
87-
*
88-
* Force treating the next n memory accesses for the current context as atomic
89-
* operations.
90-
*
91-
* @n number of following memory accesses to treat as atomic.
92-
*/
93-
void kcsan_atomic_next(int n);
94-
9559
#else /* CONFIG_KCSAN */
9660

9761
static inline void kcsan_init(void) { }
9862
static inline void kcsan_disable_current(void) { }
9963
static inline void kcsan_enable_current(void) { }
100-
static inline void kcsan_nestable_atomic_begin(void) { }
101-
static inline void kcsan_nestable_atomic_end(void) { }
102-
static inline void kcsan_flat_atomic_begin(void) { }
103-
static inline void kcsan_flat_atomic_end(void) { }
104-
static inline void kcsan_atomic_next(int n) { }
10564

10665
#endif /* CONFIG_KCSAN */
10766

0 commit comments

Comments
 (0)