From: Xunlei Pang <xpang@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Juri Lelli <juri.lelli@arm.com>, Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2 1/2] sched/rtmutex/deadline: Fix a PI crash for deadline tasks
Date: Fri, 8 Apr 2016 16:04:07 +0800 [thread overview]
Message-ID: <570765F7.7070406@redhat.com> (raw)
In-Reply-To: <20160406181433.GT3448@twins.programming.kicks-ass.net>
On 2016/04/07 at 02:14, Peter Zijlstra wrote:
> On Wed, Apr 06, 2016 at 08:59:15PM +0800, Xunlei Pang wrote:
>> A crash happened while I'm 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:
>> [<ffffffff810cf8aa>] ? enqueue_task_dl+0x2a/0x320
>> [<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
>> [<ffffffff810cfa15>] ? enqueue_task_dl+0x195/0x320
>> [<ffffffff810d0bac>] ? prio_changed_dl+0x6c/0x90
>> [<ffffffff810ed8b0>] do_futex+0x190/0x5b0
>> [<ffffffff810edd50>] SyS_futex+0x80/0x180
>> [<ffffffff8165a089>] system_call_fastpath+0x16/0x1b
>> RIP [<ffffffff810eeb8f>] rt_mutex_get_top_task+0x1f/0x30
>>
>> 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 a new pointer "pi_top_task"
>> in task_struct, and update it to be the top waiter task(this waiter
>> is updated under pi_lock) in rt_mutex_setprio() which is under
>> both pi_lock and rq lock, then ensure all its accessers be under
>> rq lock (or pi_lock), this can safely fix the crash.
>>
>> This patch is originated from "Peter Zijlstra", with several
>> tweaks and improvements by me.
> I would suggest doing the rt_mutex_postunlock() thing as a separate
> patch, it has some merit outside of these changes and reduces the total
> amount of complexity in this patch.
I think the code change is necessary , as it avoids the invalid task_struct
access issue introduced by PATCH1.
Do you mean just making the code refactor using rt_mutex_postunlock()
as a separate patch? or do I miss something?
>
> Also, I would very much like Thomas to ack this patch before I take it,
> but since its conference season this might take a little while. Esp. the
> change marked with XXX is something that I'm not sure about.
I'm ok with this change, waiting for Thomas.
Regards,
Xunlei
next prev parent reply other threads:[~2016-04-08 8:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 12:59 [PATCH v2 1/2] sched/rtmutex/deadline: Fix a PI crash for deadline tasks Xunlei Pang
2016-04-06 12:59 ` [PATCH v2 2/2] rtmutex: Kill pi_waiters_leftmost from task_struct Xunlei Pang
2016-04-06 18:15 ` Peter Zijlstra
2016-04-06 18:14 ` [PATCH v2 1/2] sched/rtmutex/deadline: Fix a PI crash for deadline tasks Peter Zijlstra
2016-04-08 8:04 ` Xunlei Pang [this message]
2016-04-08 8:31 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=570765F7.7070406@redhat.com \
--to=xpang@redhat.com \
--cc=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=xlpang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.