fix for dmesg crash dump from TOI on resume...

Woody Suwalski <[email protected]> Fri, 29 Nov 2013 08:42:03 -0500
Newsgroups gmane.linux.swsusp.devel
Message-ID <[email protected]>
Nigel, if there is no TOI hibernation image, currently TOI will produce 
a stack trace:
/...
[101058.105322] PM: Starting manual resume from disk
[101058.118616] Restarting tasks ...
[101058.118736] ------------[ cut here ]------------
[101058.118770] WARNING: CPU: 0 PID: 15027 at kernel/power/process.c:199 
thaw_processes+0xff/0x110()
[101058.118780] Modules linked in: isofs nls_iso8859_1 nls_cp850 vfat 
fat sg usb_storage snd_pcm_oss snd_mixer_oss cpufreq_conservative 
cpufreq_powersave cpufreq_ondemand cpufreq_stats coretemp speedstep_lib 
uvcvideo hid_generic videobuf2_vmalloc videobuf2_memops videobuf2_core 
videodev media usbhid snd_hda_codec_realtek arc4 ath5k snd_hda_intel ath 
mac80211 snd_hda_codec cfg80211 snd_hwdep rfkill ehci_pci snd_pcm 
uhci_hcd snd_page_alloc snd_timer snd lpc_ich mfd_core ehci_hcd 
acpi_cpufreq soundcore usbcore usb_common atl1e rng_core thermal processor
[101058.118922] CPU: 0 PID: 15027 Comm: cat Tainted: G        W 
3.12-pingu #1
[101058.118927] Hardware name: ASUSTeK Computer INC. 900HA/900HA, BIOS 
0001    09/09/2008
[101058.118931]  00000009 c1666b1a 00000000 c1038f05 c18b19a8 00000000 
00003ab3 c18b0544
[101058.118942]  000000c7 c1079c2f c1079c2f f6689b90 c1964880 f668b720 
c169052c c1038f4b
[101058.118953]  00000009 00000000 c1079c2f c18b052e c1964990 00000000 
00000000 00000000
[101058.118964] Call Trace:
[101058.118976]  [<c1666b1a>] ? dump_stack+0x48/0x6f
[101058.118985]  [<c1038f05>] ? warn_slowpath_common+0x85/0xb0
[101058.118993]  [<c1079c2f>] ? thaw_processes+0xff/0x110
[101058.119000]  [<c1079c2f>] ? thaw_processes+0xff/0x110
[101058.119007]  [<c1038f4b>] ? warn_slowpath_null+0x1b/0x20
[101058.119014]  [<c1079c2f>] ? thaw_processes+0xff/0x110
[101058.119022]  [<c106a273>] ? do_cleanup+0xc3/0x2b0
[101058.119029]  [<c106ce6e>] ? toi_stop_other_threads+0x5e/0x70
[101058.119037]  [<c106b1ce>] ? toi_try_resume+0x3e/0x80
[101058.119044]  [<c106b235>] ? toi_sys_power_disk_try_resume+0x25/0x40
[101058.119051]  [<c1068d99>] ? try_tuxonice_resume+0x19/0x60
[101058.119059]  [<c107b095>] ? software_resume+0x15/0x260
[101058.119066]  [<c107b382>] ? resume_store+0xa2/0xb0
[101058.119074]  [<c107b2e0>] ? software_resume+0x260/0x260
[101058.119082]  [<c12a10ab>] ? kobj_attr_store+0x1b/0x30
[101058.119090]  [<c114279b>] ? sysfs_write_file+0x9b/0x100
[101058.119097]  [<c1142700>] ? sysfs_open_file+0x1d0/0x1d0
[101058.119104]  [<c10ef66d>] ? vfs_write+0x9d/0x1a0
[101058.119112]  [<c10efab7>] ? SyS_write+0x57/0xa0
[101058.119119]  [<c166c74c>] ? syscall_call+0x7/0xb
[101058.119125] ---[ end trace f8c80e7bc70a06e7 ]---
[101058.119132] done.
[101058.137404] PM: Syncing filesystems ... done.

There seems to be no big side effects, just the dmesg log...

The problem is in the toi_bio_core code, where it knows to avoid resume 
attempt if check for hibernation image returns -1 == no signature, 
however still tries when it is 0 == no image found.

Here is a simple patch to fix that logic (also attached to prevent 
format mangling):
--- a/kernel/power/tuxonice_bio_core.c    2013-11-28 22:33:39.000000000 
-0500
+++ b/kernel/power/tuxonice_bio_core.c    2013-11-28 23:03:32.000000000 
-0500
@@ -1706,7 +1706,7 @@ static int toi_bio_parse_sig_location(ch

      signature_found = toi_bio_image_exists(quiet);

-    if (signature_found != -1) {
+    if ( signature_found > 0 ) {
          result = 0;
          /*
           * TODO: If only file storage, CAN_HIBERNATE should only be
@@ -1714,11 +1714,11 @@ static int toi_bio_parse_sig_location(ch
           */
          set_toi_state(TOI_CAN_HIBERNATE);
          set_toi_state(TOI_CAN_RESUME);
-    } else
+    } else if (signature_found < 0 ) {
          if (!quiet)
              printk(KERN_ERR "TuxOnIce: Block I/O: No "
                  "signature found at %s.\n", devstart);
-
+    }
      return result;
  }

Thanks for your time in this project and wish you more job satisfaction 
in the next year 8-)

Woody Suwalski
Ottawa

_______________________________________________
TuxOnIce-devel mailing list
[email protected]
http://lists.tuxonice.net/listinfo/tuxonice-devel
toi_image.patch (text/x-diff, 735 B)
--- a/kernel/power/tuxonice_bio_core.c	2013-11-28 22:33:39.000000000 -0500
+++ b/kernel/power/tuxonice_bio_core.c	2013-11-28 23:03:32.000000000 -0500
@@ -1706,7 +1706,7 @@ static int toi_bio_parse_sig_location(ch
 
 	signature_found = toi_bio_image_exists(quiet);
 
-	if (signature_found != -1) {
+	if ( signature_found > 0 ) {
 		result = 0;
 		/*
 		 * TODO: If only file storage, CAN_HIBERNATE should only be
@@ -1714,11 +1714,11 @@ static int toi_bio_parse_sig_location(ch
 		 */
 		set_toi_state(TOI_CAN_HIBERNATE);
 		set_toi_state(TOI_CAN_RESUME);
-	} else
+	} else if (signature_found < 0 ) {
 		if (!quiet)
 			printk(KERN_ERR "TuxOnIce: Block I/O: No "
 				"signature found at %s.\n", devstart);
-
+	}
 	return result;
 }