.. | .. |
---|
8 | 8 | |
---|
9 | 9 | #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES |
---|
10 | 10 | |
---|
| 11 | +/* We use the MSB mostly because its available */ |
---|
| 12 | +#define PREEMPT_NEED_RESCHED 0x80000000 |
---|
11 | 13 | #define PREEMPT_ENABLED (0 + PREEMPT_NEED_RESCHED) |
---|
12 | 14 | |
---|
13 | 15 | static inline int preempt_count(void) |
---|
.. | .. |
---|
27 | 29 | old, new) != old); |
---|
28 | 30 | } |
---|
29 | 31 | |
---|
30 | | -#define init_task_preempt_count(p) do { } while (0) |
---|
31 | | - |
---|
32 | | -#define init_idle_preempt_count(p, cpu) do { \ |
---|
33 | | - S390_lowcore.preempt_count = PREEMPT_ENABLED; \ |
---|
34 | | -} while (0) |
---|
35 | | - |
---|
36 | 32 | static inline void set_preempt_need_resched(void) |
---|
37 | 33 | { |
---|
38 | 34 | __atomic_and(~PREEMPT_NEED_RESCHED, &S390_lowcore.preempt_count); |
---|
.. | .. |
---|
50 | 46 | |
---|
51 | 47 | static inline void __preempt_count_add(int val) |
---|
52 | 48 | { |
---|
53 | | - if (__builtin_constant_p(val) && (val >= -128) && (val <= 127)) |
---|
54 | | - __atomic_add_const(val, &S390_lowcore.preempt_count); |
---|
55 | | - else |
---|
56 | | - __atomic_add(val, &S390_lowcore.preempt_count); |
---|
| 49 | + /* |
---|
| 50 | + * With some obscure config options and CONFIG_PROFILE_ALL_BRANCHES |
---|
| 51 | + * enabled, gcc 12 fails to handle __builtin_constant_p(). |
---|
| 52 | + */ |
---|
| 53 | + if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES)) { |
---|
| 54 | + if (__builtin_constant_p(val) && (val >= -128) && (val <= 127)) { |
---|
| 55 | + __atomic_add_const(val, &S390_lowcore.preempt_count); |
---|
| 56 | + return; |
---|
| 57 | + } |
---|
| 58 | + } |
---|
| 59 | + __atomic_add(val, &S390_lowcore.preempt_count); |
---|
57 | 60 | } |
---|
58 | 61 | |
---|
59 | 62 | static inline void __preempt_count_sub(int val) |
---|
.. | .. |
---|
85 | 88 | { |
---|
86 | 89 | S390_lowcore.preempt_count = pc; |
---|
87 | 90 | } |
---|
88 | | - |
---|
89 | | -#define init_task_preempt_count(p) do { } while (0) |
---|
90 | | - |
---|
91 | | -#define init_idle_preempt_count(p, cpu) do { \ |
---|
92 | | - S390_lowcore.preempt_count = PREEMPT_ENABLED; \ |
---|
93 | | -} while (0) |
---|
94 | 91 | |
---|
95 | 92 | static inline void set_preempt_need_resched(void) |
---|
96 | 93 | { |
---|
.. | .. |
---|
128 | 125 | |
---|
129 | 126 | #endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */ |
---|
130 | 127 | |
---|
131 | | -#ifdef CONFIG_PREEMPT |
---|
| 128 | +#define init_task_preempt_count(p) do { } while (0) |
---|
| 129 | +/* Deferred to CPU bringup time */ |
---|
| 130 | +#define init_idle_preempt_count(p, cpu) do { } while (0) |
---|
| 131 | + |
---|
| 132 | +#ifdef CONFIG_PREEMPTION |
---|
132 | 133 | extern asmlinkage void preempt_schedule(void); |
---|
133 | 134 | #define __preempt_schedule() preempt_schedule() |
---|
134 | 135 | extern asmlinkage void preempt_schedule_notrace(void); |
---|
135 | 136 | #define __preempt_schedule_notrace() preempt_schedule_notrace() |
---|
136 | | -#endif /* CONFIG_PREEMPT */ |
---|
| 137 | +#endif /* CONFIG_PREEMPTION */ |
---|
137 | 138 | |
---|
138 | 139 | #endif /* __ASM_PREEMPT_H */ |
---|