Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lockdep: Remove lockdep_hardirq{s_enabled,_context}() argument

Now that the macros use per-cpu data, we no longer need the argument.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20200623083721.571835311@infradead.org

+24 -24
+1 -1
arch/x86/entry/common.c
··· 758 758 759 759 noinstr bool idtentry_enter_nmi(struct pt_regs *regs) 760 760 { 761 - bool irq_state = lockdep_hardirqs_enabled(current); 761 + bool irq_state = lockdep_hardirqs_enabled(); 762 762 763 763 __nmi_enter(); 764 764 lockdep_hardirqs_off(CALLER_ADDR0);
+4 -4
include/linux/irqflags.h
··· 40 40 extern void trace_hardirqs_off_finish(void); 41 41 extern void trace_hardirqs_on(void); 42 42 extern void trace_hardirqs_off(void); 43 - # define lockdep_hardirq_context(p) (this_cpu_read(hardirq_context)) 43 + # define lockdep_hardirq_context() (this_cpu_read(hardirq_context)) 44 44 # define lockdep_softirq_context(p) ((p)->softirq_context) 45 - # define lockdep_hardirqs_enabled(p) (this_cpu_read(hardirqs_enabled)) 45 + # define lockdep_hardirqs_enabled() (this_cpu_read(hardirqs_enabled)) 46 46 # define lockdep_softirqs_enabled(p) ((p)->softirqs_enabled) 47 47 # define lockdep_hardirq_enter() \ 48 48 do { \ ··· 109 109 # define trace_hardirqs_off_finish() do { } while (0) 110 110 # define trace_hardirqs_on() do { } while (0) 111 111 # define trace_hardirqs_off() do { } while (0) 112 - # define lockdep_hardirq_context(p) 0 112 + # define lockdep_hardirq_context() 0 113 113 # define lockdep_softirq_context(p) 0 114 - # define lockdep_hardirqs_enabled(p) 0 114 + # define lockdep_hardirqs_enabled() 0 115 115 # define lockdep_softirqs_enabled(p) 0 116 116 # define lockdep_hardirq_enter() do { } while (0) 117 117 # define lockdep_hardirq_threaded() do { } while (0)
+1 -1
include/linux/lockdep.h
··· 562 562 563 563 # define lockdep_assert_RT_in_threaded_ctx() do { \ 564 564 WARN_ONCE(debug_locks && !current->lockdep_recursion && \ 565 - lockdep_hardirq_context(current) && \ 565 + lockdep_hardirq_context() && \ 566 566 !(current->hardirq_threaded || current->irq_config), \ 567 567 "Not in threaded context on PREEMPT_RT as expected\n"); \ 568 568 } while (0)
+15 -15
kernel/locking/lockdep.c
··· 2062 2062 pr_warn("-----------------------------------------------------\n"); 2063 2063 pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", 2064 2064 curr->comm, task_pid_nr(curr), 2065 - lockdep_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT, 2065 + lockdep_hardirq_context(), hardirq_count() >> HARDIRQ_SHIFT, 2066 2066 curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT, 2067 - lockdep_hardirqs_enabled(curr), 2067 + lockdep_hardirqs_enabled(), 2068 2068 curr->softirqs_enabled); 2069 2069 print_lock(next); 2070 2070 ··· 3331 3331 3332 3332 pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n", 3333 3333 curr->comm, task_pid_nr(curr), 3334 - lockdep_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT, 3334 + lockdep_hardirq_context(), hardirq_count() >> HARDIRQ_SHIFT, 3335 3335 lockdep_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT, 3336 - lockdep_hardirqs_enabled(curr), 3336 + lockdep_hardirqs_enabled(), 3337 3337 lockdep_softirqs_enabled(curr)); 3338 3338 print_lock(this); 3339 3339 ··· 3658 3658 if (unlikely(current->lockdep_recursion & LOCKDEP_RECURSION_MASK)) 3659 3659 return; 3660 3660 3661 - if (unlikely(lockdep_hardirqs_enabled(current))) { 3661 + if (unlikely(lockdep_hardirqs_enabled())) { 3662 3662 /* 3663 3663 * Neither irq nor preemption are disabled here 3664 3664 * so this is racy by nature but losing one hit ··· 3686 3686 * Can't allow enabling interrupts while in an interrupt handler, 3687 3687 * that's general bad form and such. Recursion, limited stack etc.. 3688 3688 */ 3689 - if (DEBUG_LOCKS_WARN_ON(lockdep_hardirq_context(current))) 3689 + if (DEBUG_LOCKS_WARN_ON(lockdep_hardirq_context())) 3690 3690 return; 3691 3691 3692 3692 current->hardirq_chain_key = current->curr_chain_key; ··· 3724 3724 if (unlikely(current->lockdep_recursion & LOCKDEP_RECURSION_MASK)) 3725 3725 return; 3726 3726 3727 - if (lockdep_hardirqs_enabled(curr)) { 3727 + if (lockdep_hardirqs_enabled()) { 3728 3728 /* 3729 3729 * Neither irq nor preemption are disabled here 3730 3730 * so this is racy by nature but losing one hit ··· 3783 3783 if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) 3784 3784 return; 3785 3785 3786 - if (lockdep_hardirqs_enabled(curr)) { 3786 + if (lockdep_hardirqs_enabled()) { 3787 3787 /* 3788 3788 * We have done an ON -> OFF transition: 3789 3789 */ ··· 3832 3832 * usage bit for all held locks, if hardirqs are 3833 3833 * enabled too: 3834 3834 */ 3835 - if (lockdep_hardirqs_enabled(curr)) 3835 + if (lockdep_hardirqs_enabled()) 3836 3836 mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ); 3837 3837 lockdep_recursion_finish(); 3838 3838 } ··· 3881 3881 */ 3882 3882 if (!hlock->trylock) { 3883 3883 if (hlock->read) { 3884 - if (lockdep_hardirq_context(curr)) 3884 + if (lockdep_hardirq_context()) 3885 3885 if (!mark_lock(curr, hlock, 3886 3886 LOCK_USED_IN_HARDIRQ_READ)) 3887 3887 return 0; ··· 3890 3890 LOCK_USED_IN_SOFTIRQ_READ)) 3891 3891 return 0; 3892 3892 } else { 3893 - if (lockdep_hardirq_context(curr)) 3893 + if (lockdep_hardirq_context()) 3894 3894 if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ)) 3895 3895 return 0; 3896 3896 if (curr->softirq_context) ··· 3928 3928 3929 3929 static inline unsigned int task_irq_context(struct task_struct *task) 3930 3930 { 3931 - return LOCK_CHAIN_HARDIRQ_CONTEXT * !!lockdep_hardirq_context(task) + 3931 + return LOCK_CHAIN_HARDIRQ_CONTEXT * !!lockdep_hardirq_context() + 3932 3932 LOCK_CHAIN_SOFTIRQ_CONTEXT * !!task->softirq_context; 3933 3933 } 3934 3934 ··· 4021 4021 * Set appropriate wait type for the context; for IRQs we have to take 4022 4022 * into account force_irqthread as that is implied by PREEMPT_RT. 4023 4023 */ 4024 - if (lockdep_hardirq_context(curr)) { 4024 + if (lockdep_hardirq_context()) { 4025 4025 /* 4026 4026 * Check if force_irqthreads will run us threaded. 4027 4027 */ ··· 4864 4864 return; 4865 4865 4866 4866 if (irqs_disabled_flags(flags)) { 4867 - if (DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled(current))) { 4867 + if (DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled())) { 4868 4868 printk("possible reason: unannotated irqs-off.\n"); 4869 4869 } 4870 4870 } else { 4871 - if (DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled(current))) { 4871 + if (DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled())) { 4872 4872 printk("possible reason: unannotated irqs-on.\n"); 4873 4873 } 4874 4874 }
+1 -1
kernel/softirq.c
··· 230 230 { 231 231 bool in_hardirq = false; 232 232 233 - if (lockdep_hardirq_context(current)) { 233 + if (lockdep_hardirq_context()) { 234 234 in_hardirq = true; 235 235 lockdep_hardirq_exit(); 236 236 }
+2 -2
tools/include/linux/irqflags.h
··· 2 2 #ifndef _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 3 3 #define _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 4 4 5 - # define lockdep_hardirq_context(p) 0 5 + # define lockdep_hardirq_context() 0 6 6 # define lockdep_softirq_context(p) 0 7 - # define lockdep_hardirqs_enabled(p) 0 7 + # define lockdep_hardirqs_enabled() 0 8 8 # define lockdep_softirqs_enabled(p) 0 9 9 # define lockdep_hardirq_enter() do { } while (0) 10 10 # define lockdep_hardirq_exit() do { } while (0)