Skip to content

Commit d53f2b6

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
lockdep: Add posixtimer context tracing bits
Splitting run_posix_cpu_timers() into two parts is work in progress which is stuck on other entry code related problems. The heavy lifting which involves locking of sighand lock will be moved into task context so the necessary execution time is burdened on the task and not on interrupt context. Until this work completes lockdep with the spinlock nesting rules enabled would emit warnings for this known context. Prevent it by setting "->irq_config = 1" for the invocation of run_posix_cpu_timers() so lockdep does not complain when sighand lock is acquried. This will be removed once the split is completed. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 49915ac commit d53f2b6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

include/linux/irqflags.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ do { \
6969
current->irq_config = 0; \
7070
} while (0)
7171

72+
# define lockdep_posixtimer_enter() \
73+
do { \
74+
current->irq_config = 1; \
75+
} while (0)
76+
77+
# define lockdep_posixtimer_exit() \
78+
do { \
79+
current->irq_config = 0; \
80+
} while (0)
81+
7282
# define lockdep_irq_work_enter(__work) \
7383
do { \
7484
if (!(atomic_read(&__work->flags) & IRQ_WORK_HARD_IRQ))\
@@ -94,6 +104,8 @@ do { \
94104
# define lockdep_softirq_exit() do { } while (0)
95105
# define lockdep_hrtimer_enter(__hrtimer) do { } while (0)
96106
# define lockdep_hrtimer_exit(__hrtimer) do { } while (0)
107+
# define lockdep_posixtimer_enter() do { } while (0)
108+
# define lockdep_posixtimer_exit() do { } while (0)
97109
# define lockdep_irq_work_enter(__work) do { } while (0)
98110
# define lockdep_irq_work_exit(__work) do { } while (0)
99111
#endif

kernel/time/posix-cpu-timers.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,11 @@ void run_posix_cpu_timers(void)
11261126
if (!fastpath_timer_check(tsk))
11271127
return;
11281128

1129-
if (!lock_task_sighand(tsk, &flags))
1129+
lockdep_posixtimer_enter();
1130+
if (!lock_task_sighand(tsk, &flags)) {
1131+
lockdep_posixtimer_exit();
11301132
return;
1133+
}
11311134
/*
11321135
* Here we take off tsk->signal->cpu_timers[N] and
11331136
* tsk->cpu_timers[N] all the timers that are firing, and
@@ -1169,6 +1172,7 @@ void run_posix_cpu_timers(void)
11691172
cpu_timer_fire(timer);
11701173
spin_unlock(&timer->it_lock);
11711174
}
1175+
lockdep_posixtimer_exit();
11721176
}
11731177

11741178
/*

0 commit comments

Comments
 (0)