| .. | .. |
|---|
| 56 | 56 | struct thread_info { |
|---|
| 57 | 57 | unsigned long flags; /* low level flags */ |
|---|
| 58 | 58 | u32 status; /* thread synchronous flags */ |
|---|
| 59 | + int preempt_lazy_count; /* 0 => lazy preemptable |
|---|
| 60 | + <0 => BUG */ |
|---|
| 59 | 61 | }; |
|---|
| 60 | 62 | |
|---|
| 61 | 63 | #define INIT_THREAD_INFO(tsk) \ |
|---|
| 62 | 64 | { \ |
|---|
| 63 | 65 | .flags = 0, \ |
|---|
| 66 | + .preempt_lazy_count = 0, \ |
|---|
| 64 | 67 | } |
|---|
| 65 | 68 | |
|---|
| 66 | 69 | #else /* !__ASSEMBLY__ */ |
|---|
| 67 | 70 | |
|---|
| 68 | 71 | #include <asm/asm-offsets.h> |
|---|
| 72 | + |
|---|
| 73 | +#define GET_THREAD_INFO(reg) \ |
|---|
| 74 | + _ASM_MOV PER_CPU_VAR(cpu_current_top_of_stack),reg ; \ |
|---|
| 75 | + _ASM_SUB $(THREAD_SIZE),reg ; |
|---|
| 69 | 76 | |
|---|
| 70 | 77 | #endif |
|---|
| 71 | 78 | |
|---|
| .. | .. |
|---|
| 88 | 95 | #define TIF_USER_RETURN_NOTIFY 11 /* notify kernel of userspace return */ |
|---|
| 89 | 96 | #define TIF_UPROBE 12 /* breakpointed or singlestepping */ |
|---|
| 90 | 97 | #define TIF_PATCH_PENDING 13 /* pending live patching update */ |
|---|
| 98 | +#define TIF_NEED_FPU_LOAD 14 /* load FPU on return to userspace */ |
|---|
| 91 | 99 | #define TIF_NOCPUID 15 /* CPUID is not accessible in userland */ |
|---|
| 92 | 100 | #define TIF_NOTSC 16 /* TSC is not accessible in userland */ |
|---|
| 93 | 101 | #define TIF_IA32 17 /* IA32 compatibility process */ |
|---|
| 94 | | -#define TIF_NOHZ 19 /* in adaptive nohz mode */ |
|---|
| 102 | +#define TIF_SLD 18 /* Restore split lock detection on context switch */ |
|---|
| 103 | +#define TIF_NOTIFY_SIGNAL 19 /* signal notifications exist */ |
|---|
| 95 | 104 | #define TIF_MEMDIE 20 /* is terminating due to OOM killer */ |
|---|
| 96 | 105 | #define TIF_POLLING_NRFLAG 21 /* idle is polling for TIF_NEED_RESCHED */ |
|---|
| 97 | 106 | #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ |
|---|
| .. | .. |
|---|
| 101 | 110 | #define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */ |
|---|
| 102 | 111 | #define TIF_ADDR32 29 /* 32-bit address space on 64 bits */ |
|---|
| 103 | 112 | #define TIF_X32 30 /* 32-bit native x86-64 binary */ |
|---|
| 104 | | -#define TIF_FSCHECK 31 /* Check FS is USER_DS on return */ |
|---|
| 113 | +#define TIF_NEED_RESCHED_LAZY 31 /* lazy rescheduling necessary */ |
|---|
| 105 | 114 | |
|---|
| 106 | 115 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
|---|
| 107 | 116 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
|---|
| .. | .. |
|---|
| 117 | 126 | #define _TIF_USER_RETURN_NOTIFY (1 << TIF_USER_RETURN_NOTIFY) |
|---|
| 118 | 127 | #define _TIF_UPROBE (1 << TIF_UPROBE) |
|---|
| 119 | 128 | #define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING) |
|---|
| 129 | +#define _TIF_NEED_FPU_LOAD (1 << TIF_NEED_FPU_LOAD) |
|---|
| 120 | 130 | #define _TIF_NOCPUID (1 << TIF_NOCPUID) |
|---|
| 121 | 131 | #define _TIF_NOTSC (1 << TIF_NOTSC) |
|---|
| 122 | 132 | #define _TIF_IA32 (1 << TIF_IA32) |
|---|
| 123 | | -#define _TIF_NOHZ (1 << TIF_NOHZ) |
|---|
| 133 | +#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) |
|---|
| 134 | +#define _TIF_SLD (1 << TIF_SLD) |
|---|
| 135 | +#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) |
|---|
| 124 | 136 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
|---|
| 125 | 137 | #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) |
|---|
| 126 | 138 | #define _TIF_FORCED_TF (1 << TIF_FORCED_TF) |
|---|
| .. | .. |
|---|
| 129 | 141 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) |
|---|
| 130 | 142 | #define _TIF_ADDR32 (1 << TIF_ADDR32) |
|---|
| 131 | 143 | #define _TIF_X32 (1 << TIF_X32) |
|---|
| 132 | | -#define _TIF_FSCHECK (1 << TIF_FSCHECK) |
|---|
| 133 | | - |
|---|
| 134 | | -/* |
|---|
| 135 | | - * work to do in syscall_trace_enter(). Also includes TIF_NOHZ for |
|---|
| 136 | | - * enter_from_user_mode() |
|---|
| 137 | | - */ |
|---|
| 138 | | -#define _TIF_WORK_SYSCALL_ENTRY \ |
|---|
| 139 | | - (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT | \ |
|---|
| 140 | | - _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \ |
|---|
| 141 | | - _TIF_NOHZ) |
|---|
| 142 | | - |
|---|
| 143 | | -/* work to do on any return to user space */ |
|---|
| 144 | | -#define _TIF_ALLWORK_MASK \ |
|---|
| 145 | | - (_TIF_SYSCALL_TRACE | _TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ |
|---|
| 146 | | - _TIF_NEED_RESCHED | _TIF_SINGLESTEP | _TIF_SYSCALL_EMU | \ |
|---|
| 147 | | - _TIF_SYSCALL_AUDIT | _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE | \ |
|---|
| 148 | | - _TIF_PATCH_PENDING | _TIF_NOHZ | _TIF_SYSCALL_TRACEPOINT | \ |
|---|
| 149 | | - _TIF_FSCHECK) |
|---|
| 150 | 144 | |
|---|
| 151 | 145 | /* flags to check in __switch_to() */ |
|---|
| 152 | | -#define _TIF_WORK_CTXSW_BASE \ |
|---|
| 153 | | - (_TIF_IO_BITMAP|_TIF_NOCPUID|_TIF_NOTSC|_TIF_BLOCKSTEP| \ |
|---|
| 154 | | - _TIF_SSBD | _TIF_SPEC_FORCE_UPDATE) |
|---|
| 146 | +#define _TIF_WORK_CTXSW_BASE \ |
|---|
| 147 | + (_TIF_NOCPUID | _TIF_NOTSC | _TIF_BLOCKSTEP | \ |
|---|
| 148 | + _TIF_SSBD | _TIF_SPEC_FORCE_UPDATE | _TIF_SLD) |
|---|
| 155 | 149 | |
|---|
| 156 | 150 | /* |
|---|
| 157 | 151 | * Avoid calls to __switch_to_xtra() on UP as STIBP is not evaluated. |
|---|
| .. | .. |
|---|
| 162 | 156 | # define _TIF_WORK_CTXSW (_TIF_WORK_CTXSW_BASE) |
|---|
| 163 | 157 | #endif |
|---|
| 164 | 158 | |
|---|
| 165 | | -#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) |
|---|
| 166 | | -#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) |
|---|
| 159 | +#ifdef CONFIG_X86_IOPL_IOPERM |
|---|
| 160 | +# define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW| _TIF_USER_RETURN_NOTIFY | \ |
|---|
| 161 | + _TIF_IO_BITMAP) |
|---|
| 162 | +#else |
|---|
| 163 | +# define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW| _TIF_USER_RETURN_NOTIFY) |
|---|
| 164 | +#endif |
|---|
| 165 | + |
|---|
| 166 | +#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) |
|---|
| 167 | + |
|---|
| 168 | +#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) |
|---|
| 167 | 169 | |
|---|
| 168 | 170 | #define STACK_WARN (THREAD_SIZE/8) |
|---|
| 169 | 171 | |
|---|
| .. | .. |
|---|
| 259 | 261 | #define in_ia32_syscall() (IS_ENABLED(CONFIG_IA32_EMULATION) && \ |
|---|
| 260 | 262 | current_thread_info()->status & TS_COMPAT) |
|---|
| 261 | 263 | #endif |
|---|
| 262 | | - |
|---|
| 263 | | -/* |
|---|
| 264 | | - * Force syscall return via IRET by making it look as if there was |
|---|
| 265 | | - * some work pending. IRET is our most capable (but slowest) syscall |
|---|
| 266 | | - * return path, which is able to restore modified SS, CS and certain |
|---|
| 267 | | - * EFLAGS values that other (fast) syscall return instructions |
|---|
| 268 | | - * are not able to restore properly. |
|---|
| 269 | | - */ |
|---|
| 270 | | -#define force_iret() set_thread_flag(TIF_NOTIFY_RESUME) |
|---|
| 271 | 264 | |
|---|
| 272 | 265 | extern void arch_task_cache_init(void); |
|---|
| 273 | 266 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); |
|---|