public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm <linux-pm@lists.osdl.org>
Subject: Re: Re: lockdep report in hibernate code
Date: Sun, 28 Oct 2007 11:38:36 +0100	[thread overview]
Message-ID: <1193567916.3966.14.camel@johannes.berg> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0710271827210.2418-100000@netrider.rowland.org>


[-- Attachment #1.1: Type: text/plain, Size: 1429 bytes --]


> The "nested" part of the name is a little misleading.  The function
> helps the lockdep core distinguish between locks belonging to the same
> class.  Normally this is be done so that you can nest the locks in the
> proper order, but that shouldn't stop you from using it here.

Oh good point. I'll test the patch below during the week (my powerbook
doesn't have lockdep and I don't have another machine here right now)
but I'm fairly confident it'll fix the issue. I'll submit it after
testing.

johannes

--- linux-2.6.orig/kernel/power/disk.c	2007-10-28 11:34:32.669337294 +0100
+++ linux-2.6/kernel/power/disk.c	2007-10-28 11:37:29.849294324 +0100
@@ -456,7 +456,17 @@ static int software_resume(void)
 	int error;
 	unsigned int flags;
 
-	mutex_lock(&pm_mutex);
+	/*
+	 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
+	 * is configured into the kernel. Since the regular hibernate
+	 * trigger path is via sysfs which takes a buffer mutex before
+	 * calling hibernate functions (which take pm_mutex) this can
+	 * cause lockdep to complain about a possible ABBA deadlock
+	 * which cannot happen since we're in the boot code here and
+	 * sysfs can't be invoked yet. Therefore, we use a subclass
+	 * here to avoid lockdep complaining.
+	 */
+	mutex_lock_nested(&pm_mutex, 1);
 	if (!swsusp_resume_device) {
 		if (!strlen(resume_file)) {
 			mutex_unlock(&pm_mutex);


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



      reply	other threads:[~2007-10-28 10:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 14:11 lockdep report in hibernate code Johannes Berg
2007-10-22 22:39 ` Rafael J. Wysocki
2007-10-23 10:34   ` Johannes Berg
2007-10-23 21:39     ` Rafael J. Wysocki
2007-10-23 21:56       ` Alan Stern
2007-10-23 22:18         ` Rafael J. Wysocki
2007-10-24  8:40           ` Johannes Berg
2007-10-24 21:57             ` Greg KH
2007-10-25 13:31               ` Johannes Berg
2007-10-25 17:13                 ` Alan Stern
2007-10-26 10:36                   ` Johannes Berg
2007-10-27 22:29                     ` Alan Stern
2007-10-28 10:38                       ` Johannes Berg [this message]

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=1193567916.3966.14.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-pm@lists.osdl.org \
    --cc=stern@rowland.harvard.edu \
    /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