Re: Re: lockdep report in hibernate code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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: signature.asc
Description: This is a digitally signed message part

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux