History

completion: Use lockdep_assert_RT_in_threaded_ctx() in complete_all()

The warning was intended to spot complete_all() users from hardirq context on PREEMPT_RT. The warning as-is will also trigger in interrupt handlers, which are threaded on PREEMPT_RT, which was not intended. Use lockdep_assert_RT_in_threaded_ctx() which triggers in non-preemptive context on PREEMPT_RT.

Sebastian Siewior committed 6 years ago

Commit 8bf6c671 parent d53f2b62 files · +16 −1Browse files

Unified · Split

2 files
  1. include/linux/lockdep.h +15 −0
  2. kernel/sched/completion.c +1 −1
include/linux/lockdep.h+15−0
@@ -711,6 +711,21 @@ do { \ · 710 unmodified lines
711# define lockdep_assert_in_irq() do { } while (0)711# define lockdep_assert_in_irq() do { } while (0)
712#endif712#endif
713 713
714#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
715
716# define lockdep_assert_RT_in_threaded_ctx() do { \
717 WARN_ONCE(debug_locks && !current->lockdep_recursion && \
718 current->hardirq_context && \
719 !(current->hardirq_threaded || current->irq_config), \
720 "Not in threaded context on PREEMPT_RT as expected\n"); \
721} while (0)
722
723#else
724
725# define lockdep_assert_RT_in_threaded_ctx() do { } while (0)
726
727#endif
728
714#ifdef CONFIG_LOCKDEP729#ifdef CONFIG_LOCKDEP
715void lockdep_rcu_suspicious(const char *file, const int line, const char *s);730void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
716#else731#else
kernel/sched/completion.c+1−1
@@ -58,7 +58,7 @@ void complete_all(struct completion *x) · 57 unmodified lines
58{58{
59 unsigned long flags;59 unsigned long flags;
60 60
61 WARN_ON(irqs_disabled());61 lockdep_assert_RT_in_threaded_ctx();
62 62
63 raw_spin_lock_irqsave(&x->wait.lock, flags);63 raw_spin_lock_irqsave(&x->wait.lock, flags);
64 x->done = UINT_MAX;64 x->done = UINT_MAX;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t