Files
android_kernel_xiaomi_sm8450/include/linux
Xunlei Pang e96a7705e7 sched/rtmutex/deadline: Fix a PI crash for deadline tasks
A crash happened while I was playing with deadline PI rtmutex.

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
    IP: [<ffffffff810eeb8f>] rt_mutex_get_top_task+0x1f/0x30
    PGD 232a75067 PUD 230947067 PMD 0
    Oops: 0000 [#1] SMP
    CPU: 1 PID: 10994 Comm: a.out Not tainted

    Call Trace:
    [<ffffffff810b658c>] enqueue_task+0x2c/0x80
    [<ffffffff810ba763>] activate_task+0x23/0x30
    [<ffffffff810d0ab5>] pull_dl_task+0x1d5/0x260
    [<ffffffff810d0be6>] pre_schedule_dl+0x16/0x20
    [<ffffffff8164e783>] __schedule+0xd3/0x900
    [<ffffffff8164efd9>] schedule+0x29/0x70
    [<ffffffff8165035b>] __rt_mutex_slowlock+0x4b/0xc0
    [<ffffffff81650501>] rt_mutex_slowlock+0xd1/0x190
    [<ffffffff810eeb33>] rt_mutex_timed_lock+0x53/0x60
    [<ffffffff810ecbfc>] futex_lock_pi.isra.18+0x28c/0x390
    [<ffffffff810ed8b0>] do_futex+0x190/0x5b0
    [<ffffffff810edd50>] SyS_futex+0x80/0x180

This is because rt_mutex_enqueue_pi() and rt_mutex_dequeue_pi()
are only protected by pi_lock when operating pi waiters, while
rt_mutex_get_top_task(), will access them with rq lock held but
not holding pi_lock.

In order to tackle it, we introduce new "pi_top_task" pointer
cached in task_struct, and add new rt_mutex_update_top_task()
to update its value, it can be called by rt_mutex_setprio()
which held both owner's pi_lock and rq lock. Thus "pi_top_task"
can be safely accessed by enqueue_task_dl() under rq lock.

Originally-From: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: juri.lelli@arm.com
Cc: bigeasy@linutronix.de
Cc: mathieu.desnoyers@efficios.com
Cc: jdesfossez@efficios.com
Cc: bristot@redhat.com
Link: http://lkml.kernel.org/r/20170323150216.157682758@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-04-04 11:44:05 +02:00
..
2017-03-07 14:30:38 +01:00
2017-01-24 12:37:43 -08:00
2017-03-01 09:50:58 -08:00
2016-12-22 22:58:37 -05:00
2016-10-19 14:34:36 -04:00
2017-02-10 15:52:24 -05:00
2017-03-02 08:56:04 -07:00
2017-01-25 13:17:47 -05:00
2016-12-08 13:31:11 -05:00
2016-10-25 11:08:28 +08:00
2016-12-27 14:52:47 -05:00
2016-12-08 16:37:33 -08:00
2017-02-24 17:46:55 -08:00
2017-02-04 00:47:59 +01:00
2016-12-05 19:01:16 -05:00
2016-10-28 08:48:16 -06:00
2017-02-27 10:07:47 -08:00
2016-12-05 19:01:16 -05:00
2017-03-12 23:51:34 -07:00
2016-12-25 17:21:22 +01:00
2017-02-11 20:59:41 -05:00
2016-09-14 09:18:09 -06:00
2017-01-05 15:01:55 -06:00
2017-02-01 09:13:45 +01:00
2016-12-12 18:55:06 -08:00
2016-12-25 17:21:23 +01:00
2017-02-24 17:46:57 -08:00
2016-09-27 12:33:47 +02:00
2016-12-06 11:05:46 +01:00
2017-01-12 16:48:26 -05:00
2017-03-01 09:50:58 -08:00
2016-11-16 18:32:02 -05:00
2016-12-12 18:55:07 -08:00
2016-12-06 10:17:03 +02:00
2017-03-02 08:56:04 -07:00
2016-10-31 16:18:30 -04:00
2016-10-14 11:36:59 -07:00
2016-09-27 21:52:00 -04:00
2016-11-15 16:34:27 -08:00
2017-02-13 21:44:09 -05:00
2017-02-27 18:43:46 -08:00
2017-03-26 15:09:45 +02:00
2017-01-09 16:07:38 -05:00
2016-10-05 18:23:36 -04:00
2017-02-03 11:19:34 -05:00
2016-12-25 17:21:22 +01:00
2017-01-10 18:31:55 -08:00
2017-02-03 10:17:02 +01:00
2016-12-09 22:12:21 -05:00
2017-02-10 16:34:17 +00:00
2016-12-12 18:55:08 -08:00
2017-01-11 09:21:41 +01:00
2017-02-02 15:22:18 -05:00