From: Jeff Layton <jlayton@redhat.com>
To: Mandeep Singh Baines <msb@chromium.org>
Cc: Ingo Molnar <mingo@kernel.org>, Tejun Heo <tj@kernel.org>,
"J. Bruce Fields" <bfields@fieldses.org>,
"Myklebust, Trond" <Trond.Myklebust@netapp.com>,
Oleg Nesterov <oleg@redhat.com>,
Ming Lei <ming.lei@canonical.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: LOCKDEP: 3.9-rc1: mount.nfs/4272 still has locks held!
Date: Wed, 6 Mar 2013 13:23:22 -0500 [thread overview]
Message-ID: <20130306132322.52f47d7b@tlielax.poochiereds.net> (raw)
In-Reply-To: <CACBanvo77MrvcWgVJqFjjj-7wL6BHxaoQcQ5YRfjeCtjaOeqAw@mail.gmail.com>
On Wed, 6 Mar 2013 07:59:01 -0800
Mandeep Singh Baines <msb@chromium.org> wrote:
> On Wed, Mar 6, 2013 at 4:06 AM, Jeff Layton <jlayton@redhat.com> wrote:
> > On Wed, 6 Mar 2013 10:09:14 +0100
> > Ingo Molnar <mingo@kernel.org> wrote:
> >
> >>
> >> * Mandeep Singh Baines <msb@chromium.org> wrote:
> >>
> >> > On Tue, Mar 5, 2013 at 5:16 PM, Tejun Heo <tj@kernel.org> wrote:
> >> > > On Tue, Mar 05, 2013 at 08:05:07PM -0500, J. Bruce Fields wrote:
> >> > >> If it's really just a 2-line patch to try_to_freeze(), could it just be
> >> > >> carried out-of-tree by people that are specifically working on tracking
> >> > >> down these problems?
> >> > >>
> >> > >> But I don't have strong feelings about it--as long as it doesn't result
> >> > >> in the same known issues getting reported again and again....
> >> > >
> >> > > Agreed, I don't think a Kconfig option is justified for this. If this
> >> > > is really important, annotate broken paths so that it doesn't trigger
> >> > > spuriously; otherwise, please just remove it.
> >> > >
> >> >
> >> > Fair enough. Let's revert then. I'll rework to use a lockdep annotation.
> >> >
> >> > Maybe, add a new lockdep API:
> >> >
> >> > lockdep_set_held_during_freeze(lock);
> >> >
> >> > Then when we do the check, ignore any locks that set this bit.
> >> >
> >> > Ingo, does this seem like a reasonable design to you?
> >>
> >> Am I reading the discussion correctly that the new warnings show REAL potential
> >> deadlock scenarios, which can hit real users and can lock their box up in entirely
> >> real usage scenarios?
> >>
> >> If yes then guys we _really_ don't want to use lockdep annotation to _HIDE_ bugs.
> >> We typically use them to teach lockdep about things it does not know about.
> >>
> >> How about fixing the deadlocks instead?
> >>
> >
> > I do see how the freezer might fail to suspend certain tasks, but I
> > don't see the deadlock scenario here in the NFS/RPC case. Can someone
> > outline a situation where this might end up deadlocking? If not, then
> > I'd be inclined to say that while this may be a problem, the warning is
> > excessive...
> >
>
> In general, holding a lock and freezing can cause a deadlock if:
>
> 1) you froze via the cgroup_freezer subsystem and a task in another
> cgroup tried to acquire the same lock
> 2) the lock was needed later is suspend/hibernate. For example, if the
> lock was needed in dpm_suspend by one of the device callbacks. For
> hibernate, you also need to worry about any locks that need to be
> acquired in order to write to the swap device.
> 3) another freezing task blocked on this lock and held other locks
> needed later in suspend. If that task were skipped by the freezer, you
> would deadlock
>
> You will block/prevent suspend if:
>
> 4) another freezing task blocked on this lock and was unable to freeze
>
> I think 1) and 4) can happen for the NFS/RPC case. Case 1) requires
> cgroup freezer. Case 4) while not causing a deadlock could prevent
> your laptop/phone from sleeping and end up burning all your battery.
> If suspend is initiated via lid close you won't even know about the
> failure.
>
We're aware of #4. That was the intent of adding try_to_freeze() into
this codepath in the first place. It's not a great solution for obvious
reasons, but we don't have another at the moment.
For #1 I'm not sure what to do. I'm that familiar with cgroups or how
the freezer works.
The bottom line is that we have a choice -- we can either rip out this
new lockdep warning, or rip out the code that causes it to fire.
If we rip out the warning we may miss some legit cases where we might
possibly have hit a deadlock.
If we rip out the code that causes it to fire, then we exacerbate the
#4 problem above. That will effectively make it so that you can't
suspend the host whenever NFS is doing anything moderately active.
Ripping out the warning seems like the best course of action in the
near term, but it's not my call...
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2013-03-06 18:23 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 13:57 LOCKDEP: 3.9-rc1: mount.nfs/4272 still has locks held! Ming Lei
2013-03-04 14:14 ` Myklebust, Trond
2013-03-04 14:23 ` Jeff Layton
2013-03-04 19:55 ` Mandeep Singh Baines
2013-03-04 20:53 ` Oleg Nesterov
2013-03-04 22:08 ` Myklebust, Trond
2013-03-05 13:23 ` Jeff Layton
2013-03-05 17:46 ` Tejun Heo
2013-03-05 17:49 ` Tejun Heo
2013-03-05 19:03 ` Jeff Layton
2013-03-05 19:09 ` Tejun Heo
2013-03-05 23:39 ` Jeff Layton
2013-03-05 23:47 ` Tejun Heo
2013-03-06 18:16 ` Oleg Nesterov
2013-03-06 18:53 ` Tejun Heo
2013-03-06 21:00 ` Linus Torvalds
2013-03-06 21:24 ` Tejun Heo
2013-03-06 21:31 ` Linus Torvalds
2013-03-06 21:36 ` Tejun Heo
2013-03-06 21:40 ` Tejun Heo
2013-03-13 15:17 ` Jeff Layton
2013-03-31 0:07 ` Paul Walmsley
2013-03-07 11:41 ` Jeff Layton
2013-03-07 15:25 ` Tejun Heo
2013-03-07 15:55 ` Linus Torvalds
2013-03-07 15:59 ` Myklebust, Trond
2013-03-07 16:25 ` Linus Torvalds
2013-03-07 16:45 ` Myklebust, Trond
2013-03-07 17:03 ` Linus Torvalds
2013-03-07 17:16 ` Myklebust, Trond
2013-03-07 21:43 ` Jeff Layton
2013-03-08 14:01 ` Ingo Molnar
2013-03-07 20:55 ` Rafael J. Wysocki
2013-03-07 16:00 ` Tejun Heo
2013-03-06 18:17 ` Oleg Nesterov
2013-03-06 18:40 ` Jeff Layton
2013-03-06 18:45 ` Tejun Heo
2013-03-06 1:10 ` Myklebust, Trond
2013-03-06 1:14 ` Tejun Heo
2013-03-06 1:28 ` Tejun Heo
2013-03-06 12:00 ` Jeff Layton
2013-03-05 23:11 ` J. Bruce Fields
2013-03-06 0:02 ` Rafael J. Wysocki
2013-03-06 0:30 ` [PATCH] lockdep: make lock held while freezing check optional Mandeep Singh Baines
2013-03-07 12:03 ` Maarten Lankhorst
2013-03-06 0:59 ` LOCKDEP: 3.9-rc1: mount.nfs/4272 still has locks held! Mandeep Singh Baines
2013-03-06 1:05 ` J. Bruce Fields
2013-03-06 1:16 ` Tejun Heo
2013-03-06 3:11 ` Mandeep Singh Baines
2013-03-06 9:09 ` Ingo Molnar
2013-03-06 12:06 ` Jeff Layton
2013-03-06 15:59 ` Mandeep Singh Baines
2013-03-06 18:23 ` Jeff Layton [this message]
2013-03-06 18:37 ` Myklebust, Trond
2013-03-06 20:15 ` Mandeep Singh Baines
2013-03-04 14:40 ` Ming Lei
2013-03-04 15:04 ` Jeff Layton
2013-03-04 15:33 ` Ming Lei
2013-03-04 15:53 ` Myklebust, Trond
2013-03-04 20:09 ` Mandeep Singh Baines
2013-03-04 20:10 ` Mandeep Singh Baines
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=20130306132322.52f47d7b@tlielax.poochiereds.net \
--to=jlayton@redhat.com \
--cc=Trond.Myklebust@netapp.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=bfields@fieldses.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=mingo@kernel.org \
--cc=msb@chromium.org \
--cc=oleg@redhat.com \
--cc=rjw@sisk.pl \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/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).