Skip to content

Commit 2958934

Browse files
committed
asm-generic: Provide generic TIF infrastructure
Common TIF bits do not have to be defined by every architecture. They can be defined in a generic header. That allows adding generic TIF bits without chasing a gazillion of architecture headers, which is again a unjustified burden on anyone who works on generic infrastructure as it always needs a boat load of work to keep existing architecture code working when adding new stuff. While it is not as horrible as the ignorance of the generic entry infrastructure, it is a welcome mechanism to make architecture people rethink their approach of just leaching generic improvements into architecture code and thereby making it accumulatingly harder to maintain and improve generic code. It's about time that this changes. Provide the infrastructure and split the TIF space in half, 16 generic and 16 architecture specific bits. This could probably be extended by TIF_SINGLESTEP and BLOCKSTEP, but those are only used in architecture specific code. So leave them alone for now. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
1 parent f83ec76 commit 2958934

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

arch/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,10 @@ config ARCH_VMLINUX_NEEDS_RELOCS
17301730
relocations preserved. This is used by some architectures to
17311731
construct bespoke relocation tables for KASLR.
17321732

1733+
# Select if architecture uses the common generic TIF bits
1734+
config HAVE_GENERIC_TIF_BITS
1735+
bool
1736+
17331737
source "kernel/gcov/Kconfig"
17341738

17351739
source "scripts/gcc-plugins/Kconfig"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_GENERIC_THREAD_INFO_TIF_H_
3+
#define _ASM_GENERIC_THREAD_INFO_TIF_H_
4+
5+
#include <vdso/bits.h>
6+
7+
/* Bits 16-31 are reserved for architecture specific purposes */
8+
9+
#define TIF_NOTIFY_RESUME 0 // callback before returning to user
10+
#define _TIF_NOTIFY_RESUME BIT(TIF_NOTIFY_RESUME)
11+
12+
#define TIF_SIGPENDING 1 // signal pending
13+
#define _TIF_SIGPENDING BIT(TIF_SIGPENDING)
14+
15+
#define TIF_NOTIFY_SIGNAL 2 // signal notifications exist
16+
#define _TIF_NOTIFY_SIGNAL BIT(TIF_NOTIFY_SIGNAL)
17+
18+
#define TIF_MEMDIE 3 // is terminating due to OOM killer
19+
#define _TIF_MEMDIE BIT(TIF_MEMDIE)
20+
21+
#define TIF_NEED_RESCHED 4 // rescheduling necessary
22+
#define _TIF_NEED_RESCHED BIT(TIF_NEED_RESCHED)
23+
24+
#ifdef HAVE_TIF_NEED_RESCHED_LAZY
25+
# define TIF_NEED_RESCHED_LAZY 5 // Lazy rescheduling needed
26+
# define _TIF_NEED_RESCHED_LAZY BIT(TIF_NEED_RESCHED_LAZY)
27+
#endif
28+
29+
#ifdef HAVE_TIF_POLLING_NRFLAG
30+
# define TIF_POLLING_NRFLAG 6 // idle is polling for TIF_NEED_RESCHED
31+
# define _TIF_POLLING_NRFLAG BIT(TIF_POLLING_NRFLAG)
32+
#endif
33+
34+
#define TIF_USER_RETURN_NOTIFY 7 // notify kernel of userspace return
35+
#define _TIF_USER_RETURN_NOTIFY BIT(TIF_USER_RETURN_NOTIFY)
36+
37+
#define TIF_UPROBE 8 // breakpointed or singlestepping
38+
#define _TIF_UPROBE BIT(TIF_UPROBE)
39+
40+
#define TIF_PATCH_PENDING 9 // pending live patching update
41+
#define _TIF_PATCH_PENDING BIT(TIF_PATCH_PENDING)
42+
43+
#ifdef HAVE_TIF_RESTORE_SIGMASK
44+
# define TIF_RESTORE_SIGMASK 10 // Restore signal mask in do_signal() */
45+
# define _TIF_RESTORE_SIGMASK BIT(TIF_RESTORE_SIGMASK)
46+
#endif
47+
48+
#endif /* _ASM_GENERIC_THREAD_INFO_TIF_H_ */

0 commit comments

Comments
 (0)