Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ANDROID: sched/walt: Fix the potential bad unlock issue
commit bfc5259 ("ANDROID: sched/walt: Fix lockdep assert issue") introduce a potential bad unlock balance in move_queued_task() when this_cpu == new_cpu. Use double_rq_unlock() to avoid the potential bad unlock issue, which can safely unlock two runqueues. The following warning message occurs and lockup triggered afterwards: [ 5862.217255] c1 WARNING: bad unlock balance detected! [ 5862.217259] c1 4.14.78+ #22 Tainted: G S W O [ 5862.217260] c1 ------------------------------------- [ 5862.217263] c1 migration/1/16 is trying to release lock (&rq->lock) at: [ 5862.217278] c1 [<ffffff80080e2f14>] __migrate_task+0xbc/0xc8 [ 5862.217280] c1 but there are no more locks to release! [ 5862.217281] c1 [ 5862.217281] c1 other info that might help us debug this: [ 5862.217284] c1 1 lock held by migration/1/16: [ 5862.217285] c1 #0: (&p->pi_lock){-.-.}, at: [<ffffff80080e38c4>] migration_cpu_stop+0x58/0x12c [ 5862.217296] c1 [ 5862.217296] c1 stack backtrace: [ 5862.217300] c1 CPU: 1 PID: 16 Comm: migration/1 Tainted: G S W O 4.14.78+ #22 ... [ 5862.217304] c1 Call trace: [ 5862.217310] c1 [<ffffff800808b07c>] dump_backtrace+0x0/0x24c [ 5862.217313] c1 [<ffffff800808b2e8>] show_stack+0x20/0x28 [ 5862.217319] c1 [<ffffff8008a931b4>] dump_stack+0xa4/0xdc [ 5862.217324] c1 [<ffffff80081181f8>] print_unlock_imbalance_bug+0xd0/0xe4 [ 5862.217327] c1 [<ffffff800811bae0>] lock_set_class+0xcc/0x1c8 [ 5862.217331] c1 [<ffffff80080e2adc>] move_queued_task+0x1cc/0x2e8 [ 5862.217334] c1 [<ffffff80080e2f14>] __migrate_task+0xbc/0xc8 [ 5862.217337] c1 [<ffffff80080e3924>] migration_cpu_stop+0xb8/0x12c [ 5862.217342] c1 [<ffffff800817e294>] cpu_stopper_thread+0xb0/0x118 [ 5862.217346] c1 [<ffffff80080d9bc8>] smpboot_thread_fn+0x214/0x258 [ 5862.217351] c1 [<ffffff80080d5408>] kthread+0x128/0x130 [ 5862.217354] c1 [<ffffff8008084978>] ret_from_fork+0x10/0x18 ... [ 5880.200679] c0 Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 1 Bug: 120440300 Signed-off-by: Ke Wang <[email protected]>
- Loading branch information