tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume()
authorJens Axboe <axboe@kernel.dk>
Sat, 3 Oct 2020 16:49:22 +0000 (10:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 17 Oct 2020 21:04:36 +0000 (15:04 -0600)
All the callers currently do this, clean it up and move the clearing
into tracehook_notify_resume() instead.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
27 files changed:
arch/alpha/kernel/signal.c
arch/arc/kernel/signal.c
arch/arm/kernel/signal.c
arch/arm64/kernel/signal.c
arch/c6x/kernel/signal.c
arch/csky/kernel/signal.c
arch/h8300/kernel/signal.c
arch/hexagon/kernel/process.c
arch/ia64/kernel/process.c
arch/m68k/kernel/signal.c
arch/microblaze/kernel/signal.c
arch/mips/kernel/signal.c
arch/nds32/kernel/signal.c
arch/nios2/kernel/signal.c
arch/openrisc/kernel/signal.c
arch/parisc/kernel/signal.c
arch/powerpc/kernel/signal.c
arch/riscv/kernel/signal.c
arch/s390/kernel/signal.c
arch/sh/kernel/signal_32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/um/kernel/process.c
arch/xtensa/kernel/signal.c
include/linux/tracehook.h
kernel/entry/common.c
kernel/entry/kvm.c

index 15bc9d1..3739efc 100644 (file)
@@ -531,7 +531,6 @@ do_work_pending(struct pt_regs *regs, unsigned long thread_flags,
                                do_signal(regs, r0, r19);
                                r0 = 0;
                        } else {
-                               clear_thread_flag(TIF_NOTIFY_RESUME);
                                tracehook_notify_resume(regs);
                        }
                }
index 8222f8c..2be55fb 100644 (file)
@@ -394,6 +394,6 @@ void do_notify_resume(struct pt_regs *regs)
         * ASM glue gaurantees that this is only called when returning to
         * user mode
         */
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 }
index c1892f7..585edbf 100644 (file)
@@ -669,7 +669,6 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
                        } else if (thread_flags & _TIF_UPROBE) {
                                uprobe_notify_resume(regs);
                        } else {
-                               clear_thread_flag(TIF_NOTIFY_RESUME);
                                tracehook_notify_resume(regs);
                                rseq_handle_notify_resume(NULL, regs);
                        }
index bdcaaf0..a8184ca 100644 (file)
@@ -946,7 +946,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
                                do_signal(regs);
 
                        if (thread_flags & _TIF_NOTIFY_RESUME) {
-                               clear_thread_flag(TIF_NOTIFY_RESUME);
                                tracehook_notify_resume(regs);
                                rseq_handle_notify_resume(NULL, regs);
                        }
index d05c78e..a3f15b9 100644 (file)
@@ -316,8 +316,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags,
        if (thread_info_flags & (1 << TIF_SIGPENDING))
                do_signal(regs, syscall);
 
-       if (thread_info_flags & (1 << TIF_NOTIFY_RESUME)) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & (1 << TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
-       }
 }
index 970895d..8b068cf 100644 (file)
@@ -261,7 +261,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
                do_signal(regs);
 
        if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
                tracehook_notify_resume(regs);
                rseq_handle_notify_resume(NULL, regs);
        }
index 69e6894..75d9b7e 100644 (file)
@@ -282,8 +282,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs);
 
-       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
 }
index dfd322c..5a0a95d 100644 (file)
@@ -180,7 +180,6 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
        }
 
        if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
                tracehook_notify_resume(regs);
                return 1;
        }
index f25f2f7..6b61a70 100644 (file)
@@ -176,7 +176,7 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
                ia64_do_signal(scr, in_syscall);
        }
 
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) {
+       if (test_thread_flag(TIF_NOTIFY_RESUME)) {
                local_irq_enable();     /* force interrupt enable */
                tracehook_notify_resume(&scr->pt);
        }
index a98fca9..29e174a 100644 (file)
@@ -1134,6 +1134,6 @@ void do_notify_resume(struct pt_regs *regs)
        if (test_thread_flag(TIF_SIGPENDING))
                do_signal(regs);
 
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 }
index 4a96b59..f11a0cc 100644 (file)
@@ -316,6 +316,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall)
        if (test_thread_flag(TIF_SIGPENDING))
                do_signal(regs, in_syscall);
 
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 }
index f442650..50d0515 100644 (file)
@@ -907,7 +907,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
                do_signal(regs);
 
        if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
                tracehook_notify_resume(regs);
                rseq_handle_notify_resume(NULL, regs);
        }
index 36e25a4..2acb948 100644 (file)
@@ -379,8 +379,6 @@ do_notify_resume(struct pt_regs *regs, unsigned int thread_flags)
        if (thread_flags & _TIF_SIGPENDING)
                do_signal(regs);
 
-       if (thread_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
 }
index d8a087c..cf2dca2 100644 (file)
@@ -317,7 +317,7 @@ asmlinkage int do_notify_resume(struct pt_regs *regs)
                         */
                        return restart;
                }
-       } else if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       } else if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 
        return 0;
index c779364..af66f96 100644 (file)
@@ -311,7 +311,6 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
                                }
                                syscall = 0;
                        } else {
-                               clear_thread_flag(TIF_NOTIFY_RESUME);
                                tracehook_notify_resume(regs);
                        }
                }
index 3c037fc..9f43eae 100644 (file)
@@ -606,8 +606,6 @@ void do_notify_resume(struct pt_regs *regs, long in_syscall)
        if (test_thread_flag(TIF_SIGPENDING))
                do_signal(regs, in_syscall);
 
-       if (test_thread_flag(TIF_NOTIFY_RESUME)) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
-       }
 }
index d15a98c..74a94a1 100644 (file)
@@ -327,7 +327,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
        }
 
        if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
                tracehook_notify_resume(regs);
                rseq_handle_notify_resume(NULL, regs);
        }
index e996e08..bc68418 100644 (file)
@@ -313,8 +313,6 @@ asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs);
 
-       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
 }
index b295090..9e900a8 100644 (file)
@@ -535,7 +535,6 @@ void do_signal(struct pt_regs *regs)
 
 void do_notify_resume(struct pt_regs *regs)
 {
-       clear_thread_flag(TIF_NOTIFY_RESUME);
        tracehook_notify_resume(regs);
        rseq_handle_notify_resume(NULL, regs);
 }
index 4fe3f00..1add47f 100644 (file)
@@ -502,8 +502,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs, save_r0);
 
-       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
 }
index d0e0025..741d070 100644 (file)
@@ -523,10 +523,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
 {
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs, orig_i0);
-       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
 }
 
 asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
index 255264b..f7ef7ed 100644 (file)
@@ -551,10 +551,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long
                uprobe_notify_resume(regs);
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs, orig_i0);
-       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
+       if (thread_info_flags & _TIF_NOTIFY_RESUME)
                tracehook_notify_resume(regs);
-       }
        user_enter();
 }
 
index 26b5e24..3bed095 100644 (file)
@@ -101,7 +101,7 @@ void interrupt_end(void)
                schedule();
        if (test_thread_flag(TIF_SIGPENDING))
                do_signal(regs);
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 }
 
index b3b17d6..1fb1047 100644 (file)
@@ -501,6 +501,6 @@ void do_notify_resume(struct pt_regs *regs)
        if (test_thread_flag(TIF_SIGPENDING))
                do_signal(regs);
 
-       if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
+       if (test_thread_flag(TIF_NOTIFY_RESUME))
                tracehook_notify_resume(regs);
 }
index 36fb3bb..b480e1a 100644 (file)
@@ -178,9 +178,9 @@ static inline void set_notify_resume(struct task_struct *task)
  */
 static inline void tracehook_notify_resume(struct pt_regs *regs)
 {
+       clear_thread_flag(TIF_NOTIFY_RESUME);
        /*
-        * The caller just cleared TIF_NOTIFY_RESUME. This barrier
-        * pairs with task_work_add()->set_notify_resume() after
+        * This barrier pairs with task_work_add()->set_notify_resume() after
         * hlist_add_head(task->task_works);
         */
        smp_mb__after_atomic();
index 145ab11..971ef78 100644 (file)
@@ -161,7 +161,6 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
                        arch_do_signal(regs);
 
                if (ti_work & _TIF_NOTIFY_RESUME) {
-                       clear_thread_flag(TIF_NOTIFY_RESUME);
                        tracehook_notify_resume(regs);
                        rseq_handle_notify_resume(NULL, regs);
                }
index eb1a8a4..b6678a5 100644 (file)
@@ -16,10 +16,8 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work)
                if (ti_work & _TIF_NEED_RESCHED)
                        schedule();
 
-               if (ti_work & _TIF_NOTIFY_RESUME) {
-                       clear_thread_flag(TIF_NOTIFY_RESUME);
+               if (ti_work & _TIF_NOTIFY_RESUME)
                        tracehook_notify_resume(NULL);
-               }
 
                ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work);
                if (ret)