Commit d7921a5d authored by Wanpeng Li's avatar Wanpeng Li Committed by Ingo Molnar

sched/core: Fix rq lock pinning warning after call balance callbacks

This can be reproduced by running rt-migrate-test:

 WARNING: CPU: 2 PID: 2195 at kernel/locking/lockdep.c:3670 lock_unpin_lock()
 unpinning an unpinned lock
 ...
 Call Trace:
  dump_stack()
  __warn()
  warn_slowpath_fmt()
  lock_unpin_lock()
  __balance_callback()
  __schedule()
  schedule()
  futex_wait_queue_me()
  futex_wait()
  do_futex()
  SyS_futex()
  do_syscall_64()
  entry_SYSCALL64_slow_path()

Revert the rq_lock_irqsave() usage here, the whole point of the
balance_callback() was to allow dropping rq->lock.
Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 8a8c69c3 ("sched/core: Add rq->lock wrappers")
Link: http://lkml.kernel.org/r/1489718719-3951-1-git-send-email-wanpeng.li@hotmail.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 15ff991e
...@@ -2776,9 +2776,9 @@ static void __balance_callback(struct rq *rq) ...@@ -2776,9 +2776,9 @@ static void __balance_callback(struct rq *rq)
{ {
struct callback_head *head, *next; struct callback_head *head, *next;
void (*func)(struct rq *rq); void (*func)(struct rq *rq);
struct rq_flags rf; unsigned long flags;
rq_lock_irqsave(rq, &rf); raw_spin_lock_irqsave(&rq->lock, flags);
head = rq->balance_callback; head = rq->balance_callback;
rq->balance_callback = NULL; rq->balance_callback = NULL;
while (head) { while (head) {
...@@ -2789,7 +2789,7 @@ static void __balance_callback(struct rq *rq) ...@@ -2789,7 +2789,7 @@ static void __balance_callback(struct rq *rq)
func(rq); func(rq);
} }
rq_unlock_irqrestore(rq, &rf); raw_spin_unlock_irqrestore(&rq->lock, flags);
} }
static inline void balance_callback(struct rq *rq) static inline void balance_callback(struct rq *rq)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment