From: Peter Zijlstra <peterz@infradead.org>
To: Dave Jones <davej@redhat.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
rostedt <rostedt@goodmis.org>, dhowells <dhowells@redhat.com>,
Oleg Nesterov <oleg@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: lockdep trace from posix timers
Date: Thu, 16 Aug 2012 20:07:58 +0200 [thread overview]
Message-ID: <1345140478.29668.54.camel@twins> (raw)
In-Reply-To: <20120724203613.GA9637@redhat.com>
On Tue, 2012-07-24 at 16:36 -0400, Dave Jones wrote:
> ======================================================
> [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
> 3.5.0+ #122 Not tainted
> ------------------------------------------------------
> trinity-child2/5327 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
> blocked: (tasklist_lock){.+.+..}, instance: ffffffff81c05098, at: [<ffffffff8109762b>] posix_cpu_timer_del+0x2b/0xe0
>
> and this task is already holding:
> blocked: (&(&new_timer->it_lock)->rlock){-.-...}, instance: ffff880143bce170, at: [<ffffffff81093d49>] __lock_timer+0x89/0x1f0
> which would create a new lock dependency:
> (&(&new_timer->it_lock)->rlock){-.-...} -> (tasklist_lock){.+.+..}
>
> but this new dependency connects a HARDIRQ-irq-safe lock:
> to a HARDIRQ-irq-unsafe lock:
> (&(&p->alloc_lock)->rlock){+.+...}
> other info that might help us debug this:
>
> Chain exists of:
> &(&new_timer->it_lock)->rlock --> tasklist_lock --> &(&p->alloc_lock)->rlock
>
> Possible interrupt unsafe locking scenario:
>
> CPU0 CPU1
> ---- ----
> lock(&(&p->alloc_lock)->rlock);
> local_irq_disable();
> lock(&(&new_timer->it_lock)->rlock);
> lock(tasklist_lock);
> <Interrupt>
> lock(&(&new_timer->it_lock)->rlock);
>
> *** DEADLOCK ***
>
> 1 lock on stack by trinity-child2/5327:
> #0: blocked: (&(&new_timer->it_lock)->rlock){-.-...}, instance: ffff880143bce170, at: [<ffffffff81093d49>] __lock_timer+0x89/0x1f0
> the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock:
> [<ffffffff810da83d>] lock_acquire+0xad/0x220
> [<ffffffff816895f6>] _raw_spin_lock+0x46/0x80
> [<ffffffff812d5f2e>] keyctl_session_to_parent+0xde/0x490
> [<ffffffff812d634d>] sys_keyctl+0x6d/0x1a0
> [<ffffffff8169336d>] system_call_fastpath+0x1a/0x1f
> stack backtrace:
> Pid: 5327, comm: trinity-child2 Not tainted 3.5.0+ #122
> Call Trace:
> [<ffffffff810d8194>] check_usage+0x4e4/0x500
> [<ffffffff81023729>] ? native_sched_clock+0x19/0x80
> [<ffffffff810d59a8>] ? trace_hardirqs_off_caller+0x28/0xd0
> [<ffffffff81023729>] ? native_sched_clock+0x19/0x80
> [<ffffffff810d820b>] check_irq_usage+0x5b/0xe0
> [<ffffffff810d93da>] __lock_acquire+0xd8a/0x1ae0
> [<ffffffff810d8956>] ? __lock_acquire+0x306/0x1ae0
> [<ffffffff810d59a8>] ? trace_hardirqs_off_caller+0x28/0xd0
> [<ffffffff810da2a5>] ? lock_release_non_nested+0x175/0x320
> [<ffffffff810da83d>] lock_acquire+0xad/0x220
> [<ffffffff8109762b>] ? posix_cpu_timer_del+0x2b/0xe0
> [<ffffffff81689b59>] _raw_read_lock+0x49/0x80
> [<ffffffff8109762b>] ? posix_cpu_timer_del+0x2b/0xe0
> [<ffffffff81093d95>] ? __lock_timer+0xd5/0x1f0
> [<ffffffff8109762b>] posix_cpu_timer_del+0x2b/0xe0
> [<ffffffff81094786>] sys_timer_delete+0x26/0x100
> [<ffffffff8169336d>] system_call_fastpath+0x1a/0x1f
So we have:
sys_keyctl()
keyctl_session_to_parent()
write_lock_irq(&tasklist_lock)
task_lock(parent) parent->alloc_lock
VS
sys_timer_delete()
lock_timer() timer->it_lock
posix_cpu_timer_del()
read_lock(&tasklist_lock)
Creating:
timer->it_lock -> tasklist_lock -> task->alloc_lock
And since it_lock is IRQ-safe and alloc_lock isn't, you've got the IRQ
inversion deadlock reported.
The task_lock() in keyctl_session_to_parent() comes from Al who didn't
think it necessary to write a changelog in d35abdb2.
David, Al, anybody want to have a go at fixing this?
next prev parent reply other threads:[~2012-08-16 18:08 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 20:36 lockdep trace from posix timers Dave Jones
2012-07-27 16:20 ` Dave Jones
2012-08-16 12:54 ` Ming Lei
2012-08-16 14:03 ` Dave Jones
2012-08-16 18:07 ` Peter Zijlstra [this message]
2012-08-17 15:14 ` Oleg Nesterov
2012-08-17 15:17 ` Oleg Nesterov
2012-08-17 16:40 ` task_work_add() should not succeed unconditionally (Was: lockdep trace from posix timers) Oleg Nesterov
2012-08-20 7:15 ` lockdep trace from posix timers Peter Zijlstra
2012-08-20 11:44 ` Peter Zijlstra
2012-08-20 11:46 ` Peter Zijlstra
2012-08-20 11:50 ` Peter Zijlstra
2012-08-20 12:19 ` Steven Rostedt
2012-08-20 12:20 ` Peter Zijlstra
2012-08-20 14:59 ` Oleg Nesterov
2012-08-20 15:10 ` Peter Zijlstra
2012-08-20 15:27 ` Peter Zijlstra
2012-08-20 15:32 ` Oleg Nesterov
2012-08-20 15:46 ` Peter Zijlstra
2012-08-20 15:58 ` Oleg Nesterov
2012-08-20 16:03 ` Peter Zijlstra
2012-08-20 15:05 ` Oleg Nesterov
2012-08-20 15:12 ` Peter Zijlstra
2012-08-20 15:41 ` Oleg Nesterov
2012-08-20 15:56 ` Peter Zijlstra
2012-08-20 16:10 ` Oleg Nesterov
2012-08-20 16:19 ` Peter Zijlstra
2012-08-20 16:23 ` Oleg Nesterov
2012-08-21 18:27 ` Oleg Nesterov
2012-08-21 18:34 ` Oleg Nesterov
2012-08-24 18:56 ` Oleg Nesterov
2012-08-26 19:11 ` [PATCH 0/4] (Was: lockdep trace from posix timers) Oleg Nesterov
2012-08-26 19:12 ` [PATCH 1/4] task_work: make task_work_add() lockless Oleg Nesterov
2012-09-14 6:08 ` [tip:core/urgent] task_work: Make " tip-bot for Oleg Nesterov
2012-09-24 19:27 ` [PATCH 1/4] task_work: make " Geert Uytterhoeven
2012-09-24 20:37 ` Oleg Nesterov
2012-08-26 19:12 ` [PATCH 2/4] task_work: task_work_add() should not succeed after exit_task_work() Oleg Nesterov
2012-09-14 6:09 ` [tip:core/urgent] " tip-bot for Oleg Nesterov
2012-08-26 19:12 ` [PATCH 3/4] task_work: revert d35abdb2 "hold task_lock around checks in keyctl" Oleg Nesterov
2012-09-14 6:10 ` [tip:core/urgent] task_work: Revert " hold " tip-bot for Oleg Nesterov
2012-08-26 19:12 ` [PATCH 4/4] task_work: simplify the usage in ptrace_notify() and get_signal_to_deliver() Oleg Nesterov
2012-09-14 6:11 ` [tip:core/urgent] task_work: Simplify " tip-bot for Oleg Nesterov
2012-09-06 18:01 ` [PATCH 0/4] (Was: lockdep trace from posix timers) Oleg Nesterov
2012-09-06 18:35 ` Peter Zijlstra
2012-09-07 13:13 ` Oleg Nesterov
2012-08-28 16:29 ` lockdep trace from posix timers Peter Zijlstra
2012-08-28 17:01 ` Oleg Nesterov
2012-08-28 17:12 ` Oleg Nesterov
2012-08-28 17:28 ` Peter Zijlstra
2012-08-29 15:25 ` Oleg Nesterov
2012-08-20 14:55 ` Oleg Nesterov
2012-08-20 15:43 ` Oleg Nesterov
2012-08-20 15:48 ` Peter Zijlstra
2012-08-20 15:58 ` Oleg Nesterov
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=1345140478.29668.54.camel@twins \
--to=peterz@infradead.org \
--cc=davej@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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