Merge tag 'timers-nohz-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 31 Mar 2020 01:29:05 +0000 (18:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 31 Mar 2020 01:29:05 +0000 (18:29 -0700)
Pull NOHZ update from Thomas Gleixner:
 "Remove TIF_NOHZ from three architectures

  These architectures use a static key to decide whether context
  tracking needs to be invoked and the TIF_NOHZ flag just causes a
  pointless slowpath execution for nothing"

* tag 'timers-nohz-2020-03-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  arm64: Remove TIF_NOHZ
  arm: Remove TIF_NOHZ
  x86: Remove TIF_NOHZ
  context-tracking: Introduce CONFIG_HAVE_TIF_NOHZ
  x86/entry: Remove _TIF_NOHZ from _TIF_WORK_SYSCALL_ENTRY

arch/Kconfig
arch/arm/include/asm/thread_info.h
arch/arm64/include/asm/thread_info.h
arch/mips/Kconfig
arch/powerpc/Kconfig
arch/sparc/Kconfig
arch/x86/include/asm/thread_info.h
kernel/context_tracking.c

index 17fe351..516f2b0 100644 (file)
@@ -540,11 +540,17 @@ config HAVE_CONTEXT_TRACKING
        help
          Provide kernel/user boundaries probes necessary for subsystems
          that need it, such as userspace RCU extended quiescent state.
-         Syscalls need to be wrapped inside user_exit()-user_enter() through
-         the slow path using TIF_NOHZ flag. Exceptions handlers must be
-         wrapped as well. Irqs are already protected inside
-         rcu_irq_enter/rcu_irq_exit() but preemption or signal handling on
-         irq exit still need to be protected.
+         Syscalls need to be wrapped inside user_exit()-user_enter(), either
+         optimized behind static key or through the slow path using TIF_NOHZ
+         flag. Exceptions handlers must be wrapped as well. Irqs are already
+         protected inside rcu_irq_enter/rcu_irq_exit() but preemption or signal
+         handling on irq exit still need to be protected.
+
+config HAVE_TIF_NOHZ
+       bool
+       help
+         Arch relies on TIF_NOHZ and syscall slow path to implement context
+         tracking calls to user_enter()/user_exit().
 
 config HAVE_VIRT_CPU_ACCOUNTING
        bool
index 0d0d517..3609a69 100644 (file)
@@ -141,7 +141,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
 #define TIF_SYSCALL_TRACEPOINT 6       /* syscall tracepoint instrumentation */
 #define TIF_SECCOMP            7       /* seccomp syscall filtering active */
 
-#define TIF_NOHZ               12      /* in adaptive nohz mode */
 #define TIF_USING_IWMMXT       17
 #define TIF_MEMDIE             18      /* is terminating due to OOM killer */
 #define TIF_RESTORE_SIGMASK    20
index f0cec41..512174a 100644 (file)
@@ -63,7 +63,6 @@ void arch_release_task_struct(struct task_struct *tsk);
 #define TIF_FOREIGN_FPSTATE    3       /* CPU's FP state is not current's */
 #define TIF_UPROBE             4       /* uprobe breakpoint or singlestep */
 #define TIF_FSCHECK            5       /* Check FS is USER_DS on return */
-#define TIF_NOHZ               7
 #define TIF_SYSCALL_TRACE      8       /* syscall trace active */
 #define TIF_SYSCALL_AUDIT      9       /* syscall auditing */
 #define TIF_SYSCALL_TRACEPOINT 10      /* syscall tracepoint for ftrace */
@@ -83,7 +82,6 @@ void arch_release_task_struct(struct task_struct *tsk);
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_FOREIGN_FPSTATE   (1 << TIF_FOREIGN_FPSTATE)
-#define _TIF_NOHZ              (1 << TIF_NOHZ)
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
 #define _TIF_SYSCALL_AUDIT     (1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SYSCALL_TRACEPOINT        (1 << TIF_SYSCALL_TRACEPOINT)
@@ -100,7 +98,7 @@ void arch_release_task_struct(struct task_struct *tsk);
 
 #define _TIF_SYSCALL_WORK      (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
                                 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
-                                _TIF_NOHZ | _TIF_SYSCALL_EMU)
+                                _TIF_SYSCALL_EMU)
 
 #define INIT_THREAD_INFO(tsk)                                          \
 {                                                                      \
index 797d7f1..2589d47 100644 (file)
@@ -51,6 +51,7 @@ config MIPS
        select HAVE_ASM_MODVERSIONS
        select HAVE_CBPF_JIT if !64BIT && !CPU_MICROMIPS
        select HAVE_CONTEXT_TRACKING
+       select HAVE_TIF_NOHZ
        select HAVE_COPY_THREAD_TLS
        select HAVE_C_RECORDMCOUNT
        select HAVE_DEBUG_KMEMLEAK
index 497b7d0..6f40af2 100644 (file)
@@ -182,6 +182,7 @@ config PPC
        select HAVE_STACKPROTECTOR              if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
        select HAVE_STACKPROTECTOR              if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
        select HAVE_CONTEXT_TRACKING            if PPC64
+       select HAVE_TIF_NOHZ                    if PPC64
        select HAVE_COPY_THREAD_TLS
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DEBUG_STACKOVERFLOW
index c1dd6dd..9cc9ab0 100644 (file)
@@ -71,6 +71,7 @@ config SPARC64
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_SYSCALL_TRACEPOINTS
        select HAVE_CONTEXT_TRACKING
+       select HAVE_TIF_NOHZ
        select HAVE_DEBUG_KMEMLEAK
        select IOMMU_HELPER
        select SPARSE_IRQ
index cf43279..384cdde 100644 (file)
@@ -92,7 +92,6 @@ struct thread_info {
 #define TIF_NOCPUID            15      /* CPUID is not accessible in userland */
 #define TIF_NOTSC              16      /* TSC is not accessible in userland */
 #define TIF_IA32               17      /* IA32 compatibility process */
-#define TIF_NOHZ               19      /* in adaptive nohz mode */
 #define TIF_MEMDIE             20      /* is terminating due to OOM killer */
 #define TIF_POLLING_NRFLAG     21      /* idle is polling for TIF_NEED_RESCHED */
 #define TIF_IO_BITMAP          22      /* uses I/O bitmap */
@@ -122,7 +121,6 @@ struct thread_info {
 #define _TIF_NOCPUID           (1 << TIF_NOCPUID)
 #define _TIF_NOTSC             (1 << TIF_NOTSC)
 #define _TIF_IA32              (1 << TIF_IA32)
-#define _TIF_NOHZ              (1 << TIF_NOHZ)
 #define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
 #define _TIF_IO_BITMAP         (1 << TIF_IO_BITMAP)
 #define _TIF_FORCED_TF         (1 << TIF_FORCED_TF)
@@ -133,14 +131,10 @@ struct thread_info {
 #define _TIF_X32               (1 << TIF_X32)
 #define _TIF_FSCHECK           (1 << TIF_FSCHECK)
 
-/*
- * work to do in syscall_trace_enter().  Also includes TIF_NOHZ for
- * enter_from_user_mode()
- */
+/* Work to do before invoking the actual syscall. */
 #define _TIF_WORK_SYSCALL_ENTRY        \
        (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT |   \
-        _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT |       \
-        _TIF_NOHZ)
+        _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
 
 /* flags to check in __switch_to() */
 #define _TIF_WORK_CTXSW_BASE                                   \
index 0296b4b..ce43088 100644 (file)
@@ -198,11 +198,13 @@ void __init context_tracking_cpu_set(int cpu)
        if (initialized)
                return;
 
+#ifdef CONFIG_HAVE_TIF_NOHZ
        /*
         * Set TIF_NOHZ to init/0 and let it propagate to all tasks through fork
         * This assumes that init is the only task at this early boot stage.
         */
        set_tsk_thread_flag(&init_task, TIF_NOHZ);
+#endif
        WARN_ON_ONCE(!tasklist_empty());
 
        initialized = true;