Skip to content

Commit f9ad4a5

Browse files
author
Peter Zijlstra
committed
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) <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a21ee60 commit f9ad4a5

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

arch/x86/entry/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ noinstr void idtentry_exit_user(struct pt_regs *regs)
758758

759759
noinstr bool idtentry_enter_nmi(struct pt_regs *regs)
760760
{
761-
bool irq_state = lockdep_hardirqs_enabled(current);
761+
bool irq_state = lockdep_hardirqs_enabled();
762762

763763
__nmi_enter();
764764
lockdep_hardirqs_off(CALLER_ADDR0);

include/linux/irqflags.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ DECLARE_PER_CPU(int, hardirq_context);
4040
extern void trace_hardirqs_off_finish(void);
4141
extern void trace_hardirqs_on(void);
4242
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))
4444
# 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))
4646
# define lockdep_softirqs_enabled(p) ((p)->softirqs_enabled)
4747
# define lockdep_hardirq_enter() \
4848
do { \
@@ -109,9 +109,9 @@ do { \
109109
# define trace_hardirqs_off_finish() do { } while (0)
110110
# define trace_hardirqs_on() do { } while (0)
111111
# define trace_hardirqs_off() do { } while (0)
112-
# define lockdep_hardirq_context(p) 0
112+
# define lockdep_hardirq_context() 0
113113
# define lockdep_softirq_context(p) 0
114-
# define lockdep_hardirqs_enabled(p) 0
114+
# define lockdep_hardirqs_enabled() 0
115115
# define lockdep_softirqs_enabled(p) 0
116116
# define lockdep_hardirq_enter() do { } while (0)
117117
# define lockdep_hardirq_threaded() do { } while (0)

include/linux/lockdep.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ do { \
562562

563563
# define lockdep_assert_RT_in_threaded_ctx() do { \
564564
WARN_ONCE(debug_locks && !current->lockdep_recursion && \
565-
lockdep_hardirq_context(current) && \
565+
lockdep_hardirq_context() && \
566566
!(current->hardirq_threaded || current->irq_config), \
567567
"Not in threaded context on PREEMPT_RT as expected\n"); \
568568
} while (0)

kernel/locking/lockdep.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,9 +2062,9 @@ print_bad_irq_dependency(struct task_struct *curr,
20622062
pr_warn("-----------------------------------------------------\n");
20632063
pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
20642064
curr->comm, task_pid_nr(curr),
2065-
lockdep_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,
2065+
lockdep_hardirq_context(), hardirq_count() >> HARDIRQ_SHIFT,
20662066
curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT,
2067-
lockdep_hardirqs_enabled(curr),
2067+
lockdep_hardirqs_enabled(),
20682068
curr->softirqs_enabled);
20692069
print_lock(next);
20702070

@@ -3331,9 +3331,9 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
33313331

33323332
pr_warn("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n",
33333333
curr->comm, task_pid_nr(curr),
3334-
lockdep_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,
3334+
lockdep_hardirq_context(), hardirq_count() >> HARDIRQ_SHIFT,
33353335
lockdep_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT,
3336-
lockdep_hardirqs_enabled(curr),
3336+
lockdep_hardirqs_enabled(),
33373337
lockdep_softirqs_enabled(curr));
33383338
print_lock(this);
33393339

@@ -3658,7 +3658,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
36583658
if (unlikely(current->lockdep_recursion & LOCKDEP_RECURSION_MASK))
36593659
return;
36603660

3661-
if (unlikely(lockdep_hardirqs_enabled(current))) {
3661+
if (unlikely(lockdep_hardirqs_enabled())) {
36623662
/*
36633663
* Neither irq nor preemption are disabled here
36643664
* so this is racy by nature but losing one hit
@@ -3686,7 +3686,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
36863686
* Can't allow enabling interrupts while in an interrupt handler,
36873687
* that's general bad form and such. Recursion, limited stack etc..
36883688
*/
3689-
if (DEBUG_LOCKS_WARN_ON(lockdep_hardirq_context(current)))
3689+
if (DEBUG_LOCKS_WARN_ON(lockdep_hardirq_context()))
36903690
return;
36913691

36923692
current->hardirq_chain_key = current->curr_chain_key;
@@ -3724,7 +3724,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
37243724
if (unlikely(current->lockdep_recursion & LOCKDEP_RECURSION_MASK))
37253725
return;
37263726

3727-
if (lockdep_hardirqs_enabled(curr)) {
3727+
if (lockdep_hardirqs_enabled()) {
37283728
/*
37293729
* Neither irq nor preemption are disabled here
37303730
* so this is racy by nature but losing one hit
@@ -3783,7 +3783,7 @@ void noinstr lockdep_hardirqs_off(unsigned long ip)
37833783
if (DEBUG_LOCKS_WARN_ON(!irqs_disabled()))
37843784
return;
37853785

3786-
if (lockdep_hardirqs_enabled(curr)) {
3786+
if (lockdep_hardirqs_enabled()) {
37873787
/*
37883788
* We have done an ON -> OFF transition:
37893789
*/
@@ -3832,7 +3832,7 @@ void lockdep_softirqs_on(unsigned long ip)
38323832
* usage bit for all held locks, if hardirqs are
38333833
* enabled too:
38343834
*/
3835-
if (lockdep_hardirqs_enabled(curr))
3835+
if (lockdep_hardirqs_enabled())
38363836
mark_held_locks(curr, LOCK_ENABLED_SOFTIRQ);
38373837
lockdep_recursion_finish();
38383838
}
@@ -3881,7 +3881,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
38813881
*/
38823882
if (!hlock->trylock) {
38833883
if (hlock->read) {
3884-
if (lockdep_hardirq_context(curr))
3884+
if (lockdep_hardirq_context())
38853885
if (!mark_lock(curr, hlock,
38863886
LOCK_USED_IN_HARDIRQ_READ))
38873887
return 0;
@@ -3890,7 +3890,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
38903890
LOCK_USED_IN_SOFTIRQ_READ))
38913891
return 0;
38923892
} else {
3893-
if (lockdep_hardirq_context(curr))
3893+
if (lockdep_hardirq_context())
38943894
if (!mark_lock(curr, hlock, LOCK_USED_IN_HARDIRQ))
38953895
return 0;
38963896
if (curr->softirq_context)
@@ -3928,7 +3928,7 @@ mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
39283928

39293929
static inline unsigned int task_irq_context(struct task_struct *task)
39303930
{
3931-
return LOCK_CHAIN_HARDIRQ_CONTEXT * !!lockdep_hardirq_context(task) +
3931+
return LOCK_CHAIN_HARDIRQ_CONTEXT * !!lockdep_hardirq_context() +
39323932
LOCK_CHAIN_SOFTIRQ_CONTEXT * !!task->softirq_context;
39333933
}
39343934

@@ -4021,7 +4021,7 @@ static inline short task_wait_context(struct task_struct *curr)
40214021
* Set appropriate wait type for the context; for IRQs we have to take
40224022
* into account force_irqthread as that is implied by PREEMPT_RT.
40234023
*/
4024-
if (lockdep_hardirq_context(curr)) {
4024+
if (lockdep_hardirq_context()) {
40254025
/*
40264026
* Check if force_irqthreads will run us threaded.
40274027
*/
@@ -4864,11 +4864,11 @@ static void check_flags(unsigned long flags)
48644864
return;
48654865

48664866
if (irqs_disabled_flags(flags)) {
4867-
if (DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled(current))) {
4867+
if (DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled())) {
48684868
printk("possible reason: unannotated irqs-off.\n");
48694869
}
48704870
} else {
4871-
if (DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled(current))) {
4871+
if (DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled())) {
48724872
printk("possible reason: unannotated irqs-on.\n");
48734873
}
48744874
}

kernel/softirq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static inline bool lockdep_softirq_start(void)
230230
{
231231
bool in_hardirq = false;
232232

233-
if (lockdep_hardirq_context(current)) {
233+
if (lockdep_hardirq_context()) {
234234
in_hardirq = true;
235235
lockdep_hardirq_exit();
236236
}

tools/include/linux/irqflags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#ifndef _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_
33
#define _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_
44

5-
# define lockdep_hardirq_context(p) 0
5+
# define lockdep_hardirq_context() 0
66
# define lockdep_softirq_context(p) 0
7-
# define lockdep_hardirqs_enabled(p) 0
7+
# define lockdep_hardirqs_enabled() 0
88
# define lockdep_softirqs_enabled(p) 0
99
# define lockdep_hardirq_enter() do { } while (0)
1010
# define lockdep_hardirq_exit() do { } while (0)

0 commit comments

Comments
 (0)