sched: EAS: Initialize push_task as NULL to avoid direct reference on out_unlock path
After applying up-migrate patches(
dc626b2 sched: avoid pushing
tasks to an offline CPU,
2da014c sched: Extend active balance
to accept 'push_task' argument), leaving EAS disabled and doing
a stability test which includes some random cpu plugin/plugout.
There are two types crashes happened as below:
TYPE 1:
[ 2072.653091] c1 ------------[ cut here ]------------
[ 2072.653133] c1 WARNING: CPU: 1 PID: 13 at kernel/fork.c:252 __put_task_struct+0x30/0x124()
[ 2072.653173] c1 CPU: 1 PID: 13 Comm: migration/1 Tainted: G W O
4.4.83-01066-g04c5403-dirty #17
[ 2072.653215] c1 [<
c011141c>] (unwind_backtrace) from [<
c010ced8>] (show_stack+0x20/0x24)
[ 2072.653235] c1 [<
c010ced8>] (show_stack) from [<
c043d7f8>] (dump_stack+0xa8/0xe0)
[ 2072.653255] c1 [<
c043d7f8>] (dump_stack) from [<
c012be04>] (warn_slowpath_common+0x98/0xc4)
[ 2072.653273] c1 [<
c012be04>] (warn_slowpath_common) from [<
c012beec>] (warn_slowpath_null+0x2c/0x34)
[ 2072.653291] c1 [<
c012beec>] (warn_slowpath_null) from [<
c01293b4>] (__put_task_struct+0x30/0x124)
[ 2072.653310] c1 [<
c01293b4>] (__put_task_struct) from [<
c0166964>] (active_load_balance_cpu_stop+0x22c/0x314)
[ 2072.653331] c1 [<
c0166964>] (active_load_balance_cpu_stop) from [<
c01c2604>] (cpu_stopper_thread+0x90/0x144)
[ 2072.653352] c1 [<
c01c2604>] (cpu_stopper_thread) from [<
c014d80c>] (smpboot_thread_fn+0x258/0x270)
[ 2072.653370] c1 [<
c014d80c>] (smpboot_thread_fn) from [<
c0149ee4>] (kthread+0x118/0x12c)
[ 2072.653388] c1 [<
c0149ee4>] (kthread) from [<
c0108310>] (ret_from_fork+0x14/0x24)
[ 2072.653400] c1 ---[ end trace
49c3d154890763fc ]---
[ 2072.653418] c1 Unable to handle kernel NULL pointer dereference at virtual address
00000000
...
[ 2072.832804] c1 [<
c01ba00c>] (put_css_set) from [<
c01be870>] (cgroup_free+0x6c/0x78)
[ 2072.832823] c1 [<
c01be870>] (cgroup_free) from [<
c01293f8>] (__put_task_struct+0x74/0x124)
[ 2072.832844] c1 [<
c01293f8>] (__put_task_struct) from [<
c0166964>] (active_load_balance_cpu_stop+0x22c/0x314)
[ 2072.832860] c1 [<
c0166964>] (active_load_balance_cpu_stop) from [<
c01c2604>] (cpu_stopper_thread+0x90/0x144)
[ 2072.832879] c1 [<
c01c2604>] (cpu_stopper_thread) from [<
c014d80c>] (smpboot_thread_fn+0x258/0x270)
[ 2072.832896] c1 [<
c014d80c>] (smpboot_thread_fn) from [<
c0149ee4>] (kthread+0x118/0x12c)
[ 2072.832914] c1 [<
c0149ee4>] (kthread) from [<
c0108310>] (ret_from_fork+0x14/0x24)
[ 2072.832930] c1 Code:
f57ff05b f590f000 e3e02000 e3a03001 (
e1941f9f)
[ 2072.839208] c1 ---[ end trace
49c3d154890763fd ]---
TYPE 2:
[ 214.742695] c1 ------------[ cut here ]------------
[ 214.742709] c1 kernel BUG at kernel/smpboot.c:136!
[ 214.742718] c1 Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[ 214.748785] c1 CPU: 1 PID: 18 Comm: migration/2 Tainted: G W O
4.4.83-00912-g370f62c #1
[ 214.748805] c1 task:
ef2d9680 task.stack:
ee862000
[ 214.748821] c1 PC is at smpboot_thread_fn+0x168/0x270
[ 214.748832] c1 LR is at smpboot_thread_fn+0xe4/0x270
...
[ 214.821339] c1 [<
c014d71c>] (smpboot_thread_fn) from [<
c0149ee4>] (kthread+0x118/0x12c)
[ 214.821363] c1 [<
c0149ee4>] (kthread) from [<
c0108310>] (ret_from_fork+0x14/0x24)
[ 214.821378] c1 Code:
e5950000 e5943010 e1500003 0a000000 (
e7f001f2)
[ 214.827676] c1 ---[ end trace
da87539f59bab8de ]---
For the first type crash, the root cause is the push_task pointer will be
used without initialization on the out_lock path. And maybe cpu hotplug in/out
make this happen more easily.
For the second type crash, it hits 'BUG_ON(td->cpu != smp_processor_id());' in
smpboot_thread_fn(). It seems that OOPS was caused by migration/2 which actually
running on cpu1. And I haven't found what actually happened.
However, after this fix, the second type crash seems gone too.
Signed-off-by: Ke Wang <ke.wang@spreadtrum.com>