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.
Showing the changes to include/linux (2 of 2 files). Show all
Unified · Split
| @@ -32,10 +32,54 @@ · 31 unmodified lines | ||
| 32 | 32 | */ |
| 33 | 33 | void __kcsan_check_access(const volatile void *ptr, size_t size, int type); |
| 34 | 34 | |
| 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 | + | |
| 36 | 73 | static inline void __kcsan_check_access(const volatile void *ptr, size_t size, |
| 37 | 74 | 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 */ | |
| 39 | 83 | |
| 40 | 84 | /* |
| 41 | 85 | * kcsan_*: Only calls into the runtime when the particular compilation unit has |
| @@ -56,52 +56,11 @@ void kcsan_disable_current(void); · 55 unmodified lines | ||
| 56 | 56 | */ |
| 57 | 57 | void kcsan_enable_current(void); |
| 58 | 58 | |
| 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 | − | |
| 95 | 59 | #else /* CONFIG_KCSAN */ |
| 96 | 60 | |
| 97 | 61 | static inline void kcsan_init(void) { } |
| 98 | 62 | static inline void kcsan_disable_current(void) { } |
| 99 | 63 | 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) { } | |
| 105 | 64 | |
| 106 | 65 | #endif /* CONFIG_KCSAN */ |
| 107 | 66 | |