From: Li Bin <huawei.libin@huawei.com>
To: Sasha Levin <sasha.levin@oracle.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Dave Jones" <davej@redhat.com>, <rui.xiang@huawei.com>,
<wengmeiling.weng@huawei.com>
Subject: Re: sched: spinlock recursion in sched_rr_get_interval
Date: Sat, 27 Dec 2014 17:02:59 +0800 [thread overview]
Message-ID: <549E75C3.80808@huawei.com> (raw)
In-Reply-To: <549D07CD.8000204@oracle.com>
On 2014/12/26 15:01, Sasha Levin wrote:
> On 12/26/2014 01:45 AM, Li Bin wrote:
>> On 2014/7/8 4:05, Peter Zijlstra wrote:
>>>> On Mon, Jul 07, 2014 at 09:55:43AM -0400, Sasha Levin wrote:
>>>>>> I've also had this one, which looks similar:
>>>>>>
>>>>>> [10375.005884] BUG: spinlock recursion on CPU#0, modprobe/10965
>>>>>> [10375.006573] lock: 0xffff8803a0fd7740, .magic: dead4ead, .owner: modprobe/10965, .owner_cpu: 15
>>>>>> [10375.007412] CPU: 0 PID: 10965 Comm: modprobe Tainted: G W 3.16.0-rc3-next-20140704-sasha-00023-g26c0906-dirty #765
>>>>
>>>> Something's fucked; so we have:
>>>>
>>>> debug_spin_lock_before()
>>>> SPIN_BUG_ON(lock->owner == current, "recursion");
>>>>
>> Hello,
>> Does ACCESS_ONCE() can help this issue? I have no evidence that its lack is
>> responsible for the issue, but I think here need it indeed. Is that right?
>>
>> SPIN_BUG_ON(ACCESS_ONCE(lock->owner) == current, "recursion");
>
> Could you explain a bit more why do you think it's needed?
>
Oh, just adding ACCESS_ONCE may be not enough, and i think lacking lock protection
for reading lock->owner is a risk. In short, the reason of the issue is more like
the spinlock debug mechanism, rather than a real spinlock recursion.
...
//under no lock protection
if (lock->owner == current) //access lock->owner
|-spin_dump(lock, "recursion");
|-if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) //access lock->owner again
owner = lock->owner;
...
Right, or am I missing something?
Thanks,
Li Bin
>
> Thanks,
> Sasha
>
>
next prev parent reply other threads:[~2014-12-27 9:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-06 17:27 sched: spinlock recursion in sched_rr_get_interval Sasha Levin
2014-07-07 8:30 ` Peter Zijlstra
2014-07-07 13:55 ` Sasha Levin
2014-07-07 20:05 ` Peter Zijlstra
2014-07-07 22:47 ` Sasha Levin
2014-07-28 23:08 ` Sasha Levin
2014-09-17 9:13 ` Jovi Zhangwei
2014-12-26 6:45 ` Li Bin
2014-12-26 7:01 ` Sasha Levin
2014-12-27 9:02 ` Li Bin [this message]
2014-12-27 9:52 ` Davidlohr Bueso
2014-12-27 15:52 ` Sasha Levin
2014-12-28 20:17 ` Davidlohr Bueso
2014-12-29 14:22 ` Sasha Levin
2014-12-30 1:04 ` Sasha Levin
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=549E75C3.80808@huawei.com \
--to=huawei.libin@huawei.com \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rui.xiang@huawei.com \
--cc=sasha.levin@oracle.com \
--cc=wengmeiling.weng@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).