|
35 | 35 | #include <linux/task_io_accounting.h> |
36 | 36 | #include <linux/posix-timers_types.h> |
37 | 37 | #include <linux/restart_block.h> |
38 | | -#include <linux/rseq.h> |
| 38 | +#include <uapi/linux/rseq.h> |
39 | 39 | #include <linux/seqlock_types.h> |
40 | 40 | #include <linux/kcsan.h> |
41 | 41 | #include <linux/rv.h> |
@@ -2181,129 +2181,6 @@ static inline bool owner_on_cpu(struct task_struct *owner) |
2181 | 2181 | unsigned long sched_cpu_util(int cpu); |
2182 | 2182 | #endif /* CONFIG_SMP */ |
2183 | 2183 |
|
2184 | | -#ifdef CONFIG_RSEQ |
2185 | | - |
2186 | | -/* |
2187 | | - * Map the event mask on the user-space ABI enum rseq_cs_flags |
2188 | | - * for direct mask checks. |
2189 | | - */ |
2190 | | -enum rseq_event_mask_bits { |
2191 | | - RSEQ_EVENT_PREEMPT_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT, |
2192 | | - RSEQ_EVENT_SIGNAL_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT, |
2193 | | - RSEQ_EVENT_MIGRATE_BIT = RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT, |
2194 | | -}; |
2195 | | - |
2196 | | -enum rseq_event_mask { |
2197 | | - RSEQ_EVENT_PREEMPT = (1U << RSEQ_EVENT_PREEMPT_BIT), |
2198 | | - RSEQ_EVENT_SIGNAL = (1U << RSEQ_EVENT_SIGNAL_BIT), |
2199 | | - RSEQ_EVENT_MIGRATE = (1U << RSEQ_EVENT_MIGRATE_BIT), |
2200 | | -}; |
2201 | | - |
2202 | | -static inline void rseq_set_notify_resume(struct task_struct *t) |
2203 | | -{ |
2204 | | - if (t->rseq) |
2205 | | - set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); |
2206 | | -} |
2207 | | - |
2208 | | -void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs); |
2209 | | - |
2210 | | -static inline void rseq_handle_notify_resume(struct ksignal *ksig, |
2211 | | - struct pt_regs *regs) |
2212 | | -{ |
2213 | | - if (current->rseq) |
2214 | | - __rseq_handle_notify_resume(ksig, regs); |
2215 | | -} |
2216 | | - |
2217 | | -static inline void rseq_signal_deliver(struct ksignal *ksig, |
2218 | | - struct pt_regs *regs) |
2219 | | -{ |
2220 | | - preempt_disable(); |
2221 | | - __set_bit(RSEQ_EVENT_SIGNAL_BIT, ¤t->rseq_event_mask); |
2222 | | - preempt_enable(); |
2223 | | - rseq_handle_notify_resume(ksig, regs); |
2224 | | -} |
2225 | | - |
2226 | | -/* rseq_preempt() requires preemption to be disabled. */ |
2227 | | -static inline void rseq_preempt(struct task_struct *t) |
2228 | | -{ |
2229 | | - __set_bit(RSEQ_EVENT_PREEMPT_BIT, &t->rseq_event_mask); |
2230 | | - rseq_set_notify_resume(t); |
2231 | | -} |
2232 | | - |
2233 | | -/* rseq_migrate() requires preemption to be disabled. */ |
2234 | | -static inline void rseq_migrate(struct task_struct *t) |
2235 | | -{ |
2236 | | - __set_bit(RSEQ_EVENT_MIGRATE_BIT, &t->rseq_event_mask); |
2237 | | - rseq_set_notify_resume(t); |
2238 | | -} |
2239 | | - |
2240 | | -/* |
2241 | | - * If parent process has a registered restartable sequences area, the |
2242 | | - * child inherits. Unregister rseq for a clone with CLONE_VM set. |
2243 | | - */ |
2244 | | -static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) |
2245 | | -{ |
2246 | | - if (clone_flags & CLONE_VM) { |
2247 | | - t->rseq = NULL; |
2248 | | - t->rseq_len = 0; |
2249 | | - t->rseq_sig = 0; |
2250 | | - t->rseq_event_mask = 0; |
2251 | | - } else { |
2252 | | - t->rseq = current->rseq; |
2253 | | - t->rseq_len = current->rseq_len; |
2254 | | - t->rseq_sig = current->rseq_sig; |
2255 | | - t->rseq_event_mask = current->rseq_event_mask; |
2256 | | - } |
2257 | | -} |
2258 | | - |
2259 | | -static inline void rseq_execve(struct task_struct *t) |
2260 | | -{ |
2261 | | - t->rseq = NULL; |
2262 | | - t->rseq_len = 0; |
2263 | | - t->rseq_sig = 0; |
2264 | | - t->rseq_event_mask = 0; |
2265 | | -} |
2266 | | - |
2267 | | -#else |
2268 | | - |
2269 | | -static inline void rseq_set_notify_resume(struct task_struct *t) |
2270 | | -{ |
2271 | | -} |
2272 | | -static inline void rseq_handle_notify_resume(struct ksignal *ksig, |
2273 | | - struct pt_regs *regs) |
2274 | | -{ |
2275 | | -} |
2276 | | -static inline void rseq_signal_deliver(struct ksignal *ksig, |
2277 | | - struct pt_regs *regs) |
2278 | | -{ |
2279 | | -} |
2280 | | -static inline void rseq_preempt(struct task_struct *t) |
2281 | | -{ |
2282 | | -} |
2283 | | -static inline void rseq_migrate(struct task_struct *t) |
2284 | | -{ |
2285 | | -} |
2286 | | -static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) |
2287 | | -{ |
2288 | | -} |
2289 | | -static inline void rseq_execve(struct task_struct *t) |
2290 | | -{ |
2291 | | -} |
2292 | | - |
2293 | | -#endif |
2294 | | - |
2295 | | -#ifdef CONFIG_DEBUG_RSEQ |
2296 | | - |
2297 | | -void rseq_syscall(struct pt_regs *regs); |
2298 | | - |
2299 | | -#else |
2300 | | - |
2301 | | -static inline void rseq_syscall(struct pt_regs *regs) |
2302 | | -{ |
2303 | | -} |
2304 | | - |
2305 | | -#endif |
2306 | | - |
2307 | 2184 | #ifdef CONFIG_SCHED_CORE |
2308 | 2185 | extern void sched_core_free(struct task_struct *tsk); |
2309 | 2186 | extern void sched_core_fork(struct task_struct *p); |
|
0 commit comments