linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mandeep Singh Baines <msb@chromium.org>
To: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org
Cc: Mandeep Singh Baines <msb@chromium.org>,
	Tejun Heo <tj@kernel.org>, Jeff Layton <jlayton@redhat.com>,
	"Myklebust, Trond" <Trond.Myklebust@netapp.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Ming Lei <ming.lei@canonical.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] lockdep: make lock held while freezing check optional
Date: Tue,  5 Mar 2013 16:30:19 -0800	[thread overview]
Message-ID: <1362529819-19076-1-git-send-email-msb@chromium.org> (raw)
In-Reply-To: <20130305231110.GK15816@fieldses.org>

This check is turning up a lot of code paths which need to be
fixed so while those paths are fixed, let's make this check
optional so that folks can still use lockdep.

CC: Tejun Heo <tj@kernel.org>
CC: Jeff Layton <jlayton@redhat.com>
CC: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Ming Lei <ming.lei@canonical.com>
CC: "Rafael J. Wysocki" <rjw@sisk.pl>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Ingo Molnar <mingo@redhat.com>
---
 include/linux/freezer.h |  2 ++
 lib/Kconfig.debug       | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 043a5cf..03bdc54 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -49,8 +49,10 @@ extern void thaw_kernel_threads(void);
 
 static inline bool try_to_freeze(void)
 {
+#ifdef CONFIG_DEBUG_LOCK_HELD_FREEZING
 	if (!(current->flags & PF_NOFREEZE))
 		debug_check_no_locks_held();
+#endif
 	might_sleep();
 	if (likely(!freezing(current)))
 		return false;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 28be08c..bddda5f 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -547,6 +547,18 @@ config DEBUG_MUTEXES
 	 This feature allows mutex semantics violations to be detected and
 	 reported.
 
+config DEBUG_LOCK_HELD_FREEZING
+	bool "Lock debugging: detect when locks are held during freeze"
+	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
+	select DEBUG_SPINLOCK
+	select DEBUG_MUTEXES
+	select LOCKDEP
+	help
+	 This feature will check whether any lock is incorrectly held
+	 while freezing. If a task freezes with a lock held it will
+	 block any other task that is waiting on that lock from freezing.
+	 In the case of cgroup_freezer, this can cause a deadlock.
+
 config DEBUG_LOCK_ALLOC
 	bool "Lock debugging: detect incorrect freeing of live locks"
 	depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
-- 
1.7.12.4


  parent reply	other threads:[~2013-03-06  0:30 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                   ` Mandeep Singh Baines [this message]
2013-03-07 12:03                     ` [PATCH] lockdep: make lock held while freezing check optional 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
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=1362529819-19076-1-git-send-email-msb@chromium.org \
    --to=msb@chromium.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rjw@sisk.pl \
    --cc=tj@kernel.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).