Re: userspace ui doesn't work with latest tuxonice-head

François Valenduc <[email protected]> Tue, 17 Apr 2012 13:16:55 +0200
Newsgroups gmane.linux.swsusp.devel
Message-ID <[email protected]>
Le 16/04/12 15:35, Andrey Rahmatullin a écrit :
> On Sun, Apr 08, 2012 at 12:05:40PM +0200, François Valenduc wrote:
>> I have tried the latest tuxonice-head git tree and I notice that the
>> userspace interface doesn't work. I get this message in the logs:
>>  pc-francois kernel: [   48.132314] userspace ui: Failed to contact
>> userspace process.
>> I don't encounter this problem with tuxonice on the 3.3 kernel.
>>
>> Does anybody knows what's happening ?
>> Thanks in advance for your help.
> I've had this just once on 3.3rc7. It didn't happen before or after that.
>
>
>
> _______________________________________________
> TuxOnIce-devel mailing list
> [email protected]
> http://lists.tuxonice.net/listinfo/tuxonice-devel
I encounter this problem everytime with the latest tuxonice-head git
tree. The attached patch I made to solve the merge conflicts before
3.4-rc1 allows userspace ui to work correctly. However, with this,
TuxOnIce can't be compiled as a module.

Thanks for your help.
François

_______________________________________________
TuxOnIce-devel mailing list
[email protected]
http://lists.tuxonice.net/listinfo/tuxonice-devel
tuxonice3.diff (text/plain, 3.5 KB)
diff --git a/kernel/power/tuxonice.h b/kernel/power/tuxonice.h
index accce22..e2064cb 100644
--- a/kernel/power/tuxonice.h
+++ b/kernel/power/tuxonice.h
@@ -217,7 +217,7 @@ extern void toi_early_boot_message(int can_erase_image, int default_answer,
 extern int do_check_can_resume(void);
 extern int do_toi_step(int step);
 extern int toi_launch_userspace_program(char *command, int channel_no,
-		int debug);
+		int wait, int debug);
 
 extern char tuxonice_signature[9];
 
diff --git a/kernel/power/tuxonice_highlevel.c b/kernel/power/tuxonice_highlevel.c
index c928e37..49da167 100644
--- a/kernel/power/tuxonice_highlevel.c
+++ b/kernel/power/tuxonice_highlevel.c
@@ -135,7 +135,7 @@ static char *result_strings[] = {
 		"hibernation",
 	"Pre-snapshot preparation failed",
 	"Pre-restore preparation failed",
-	"(Obsolete) Failed to disable usermode helpers",
+	"Failed to disable usermode helpers",
 	"Can't resume from alternate image",
 	"Header reservation too small",
 	"Device Power Management Preparation failed",
@@ -467,6 +466,7 @@ static void do_cleanup(int get_debug_info, int restarting)
 			toiActiveAllocator->remove_image();
 
 	free_bitmaps();
+	usermodehelper_enable();
 
 	if (test_toi_state(TOI_NOTIFIERS_PREPARE)) {
 		pm_notifier_call_chain(PM_POST_HIBERNATION);
@@ -565,6 +565,14 @@ static int toi_init(int restarting)
 		toi_start_other_threads();
 	}
 
+	result = usermodehelper_disable();
+	if (result) {
+		printk(KERN_ERR "TuxOnIce: Failed to disable usermode "
+				"helpers\n");
+		set_result_state(TOI_USERMODE_HELPERS_ERR);
+		return 1;
+	}
+
 	boot_kernel_data_buffer = toi_get_zeroed_page(37, TOI_ATOMIC_GFP);
 	if (!boot_kernel_data_buffer) {
 		printk(KERN_ERR "TuxOnIce: Failed to allocate "
@@ -1138,7 +1146,7 @@ out:
  * channel_no: If !0, -c <channel_no> is added to args (userui).
  */
 int toi_launch_userspace_program(char *command, int channel_no,
-		int debug)
+		int wait, int debug)
 {
 	int retval;
 	static char *envp[] = {
@@ -1189,7 +1197,7 @@ int toi_launch_userspace_program(char *command, int channel_no,
 		strcpy(argv[arg], "--debug");
 	}
 
-	retval = call_usermodehelper(argv[0], argv, envp, 0);
+	retval = call_usermodehelper(argv[0], argv, envp, wait);
 
 	/*
 	 * If the program reports an error, retval = 256. Don't complain
diff --git a/kernel/power/tuxonice_io.c b/kernel/power/tuxonice_io.c
index a93abb5..896b7d6 100644
--- a/kernel/power/tuxonice_io.c
+++ b/kernel/power/tuxonice_io.c
@@ -1696,6 +1696,9 @@ static int __read_pageset1(void)
 	if (result)
 		goto out_notifier_call_chain;;
 
+	if (usermodehelper_disable())
+		goto out_enable_nonboot_cpus;
+
 	current->flags |= PF_NOFREEZE;
 	freeze_result = FREEZE_IN_PROGRESS;
 
@@ -1760,9 +1763,11 @@ out_thaw:
 	wait_event(freeze_wait, freeze_result != FREEZE_IN_PROGRESS);
 	trap_non_toi_io = 0;
 	thaw_processes();
-out_notifier_call_chain:
+	usermodehelper_enable();
+out_enable_nonboot_cpus:
 	enable_nonboot_cpus();
-	pm_notifier_call_chain(PM_POST_RESTORE);
+out_notifier_call_chain:
+  pm_notifier_call_chain(PM_POST_RESTORE);
 out_reset_console:
 	toi_cleanup_console();
 out_remove_image:
diff --git a/kernel/power/tuxonice_netlink.c b/kernel/power/tuxonice_netlink.c
index 8dfc7db..c5208ee 100644
--- a/kernel/power/tuxonice_netlink.c
+++ b/kernel/power/tuxonice_netlink.c
@@ -324,7 +324,7 @@ int toi_netlink_setup(struct user_helper_data *uhd)
 	}
 
 	if (toi_launch_userspace_program(uhd->program, uhd->netlink_id,
-				uhd->debug) < 0) {
+				UMH_WAIT_EXEC, uhd->debug) < 0) {
 		printk(KERN_INFO "Launch userspace program failed.\n");
 		toi_netlink_close_complete(uhd);
 		return 1;