Skip to contentSkip to conversation

kernel/power/swsusp.c

PATCH In review Erik Rigtorp 3 participants 8 messages Jul 3, 2004 – Jul 5, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/power/swsusp.c

Swsusp allocates a vt before it nows if it will need it. This interferes with bootsplash. Here is a patch that moves the pm_prepare_console() call so that its only executed if swsusp finds a valid image to resume.

kernel/power/swsusp.c +3 -4
diff -Nru linux-2.6.7/kernel/power/swsusp.c linux-2.6.7-swsusp/kernel/power/swsusp.c
@@ -1067,6 +1069,9 @@
 	printk( "%sSignature found, resuming\n", name_resume );
 	MDELAY(1000);
 
+   	if (pm_prepare_console())
+		printk("swsusp: Can't allocate a console... proceeding\n");
+   
 	if (bdev_read_page(bdev, next.val, cur)) return -EIO;
 	if (sanity_check(&cur->sh)) 	/* Is this same machine? */	
 		return -EPERM;
@@ -1190,9 +1195,6 @@
 	}
 	MDELAY(1000);
 
-	if (pm_prepare_console())
-		printk("swsusp: Can't allocate a console... proceeding\n");
-
 	if (!resume_file[0] && resume_status == RESUME_SPECIFIED) {
 		printk( "suspension device unspecified\n" );
 		return -EINVAL;
@@ -1206,7 +1208,6 @@
 	panic("This never returns");
 
 read_failure:
-	pm_restore_console();
 	return 0;
 }
#1 lore raw

Hi!

Quoted 3 lines

Swsusp allocates a vt before it nows if it will need it. This interferes with bootsplash. Here is a patch that moves the pm_prepare_console() call so that its only executed if swsusp finds a valid image to resume.

You are moving it inside function that should have no business doing this... Would something like this work better? [hand-edited, apply by hand; untested].

BTW is bootsplash actually used by suse and/or redhat? Suse certainly has some splashscreen... Perhaps some splash support into swsusp (as an add on) would be good idea, but it would be good to only code it once.
Pavel

kernel/power/swsusp.c +4 -3
@@ -1190,9 +1190,6 @@
 	}
 	MDELAY(1000);
 
-	if (pm_prepare_console())
-		printk("swsusp: Can't allocate a console... proceeding\n");
-
 	if (!resume_file[0] && resume_status == RESUME_SPECIFIED) {
 		printk( "suspension device unspecified\n" );
 		return -EINVAL;
@@ -1201,12 +1198,17 @@
 	printk( "resuming from %s\n", resume_file);
 	if (read_suspend_image(resume_file, 0))
 		goto read_failure;
+
+	if (pm_prepare_console())
+		printk("swsusp: Can't allocate a console... proceeding\n");
+
	device_suspend(4);

do_magic(1);
panic("This never returns");

read_failure:
- pm_restore_console();
return 0;
}

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#2 lore raw
Quoted 3 lines · Pavel Machek

You are moving it inside function that should have no business doing this... Would something like this work better? [hand-edited, apply by hand; untested].

I'll try it.

Quoted 1 line

BTW is bootsplash actually used by suse and/or redhat? Suse certainly

Suse uses bootsplash. Even without bootsplash the console jumps to a new vc then back at every boot, on systems with bootsplash and/or slow systems this causes the screen to flicker.

Quoted 3 lines

has some splashscreen... Perhaps some splash support into swsusp (as an add on) would be good idea, but it would be good to only code it once.

That is infact my intention. I've looked some at the swsusp2 code but it looks ugly. My plan is to create a general kernel level interface to bootsplash, then add hooks in swsusp. This code should probably live in the bootsplash patch.

Erik

#4 lore raw
In reply to Pavel Machek
Quoted 3 lines · Pavel Machek

You are moving it inside function that should have no business doing this... Would something like this work better? [hand-edited, apply by hand; untested].

Your patch works fine but now the swsusp resume messages appears on the normal console instead. The swsusp console should be allocated earlier as my patch did.

#5 lore raw

Hi!

Quoted 7 lines
Quoted 3 lines

You are moving it inside function that should have no business doing this... Would something like this work better? [hand-edited, apply by hand; untested].

Your patch works fine but now the swsusp resume messages appears on the normal console instead. The swsusp console should be allocated earlier as my patch did.

Actually, this has several advantages -- you can actually see the messages of the kernel during resume. And reading does logically belong to the kernel doing boot, so it belongs on its screen, too...

Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#3 lore raw
In reply to Erik Rigtorp

Hi.

Quoted 4 lines · Erik Rigtorp

That is infact my intention. I've looked some at the swsusp2 code but it looks ugly. My plan is to create a general kernel level interface to bootsplash, then add hooks in swsusp. This code should probably live in the bootsplash patch.

Yes. I'd love a better in kernel interface. Could you make it so that for an arbitrary vt, we easily detect if bootsplash is on, switch between silent and verbose and set the progress bar value?

Regards,

Nigel

#6 lore raw
In reply to Pavel Machek
Quoted 3 lines · Pavel Machek

Actually, this has several advantages -- you can actually see the messages of the kernel during resume. And reading does logically belong to the kernel doing boot, so it belongs on its screen, too...

Here's a clean patch that does just that.

kernel/power/swsusp.c +4 -4
diff -Nru linux-2.6.7/kernel/power/swsusp.c linux-2.6.7-pavel/kernel/power/swsusp.c
@@ -1190,9 +1190,6 @@
 	}
 	MDELAY(1000);
 
-	if (pm_prepare_console())
-		printk("swsusp: Can't allocate a console... proceeding\n");
-
 	if (!resume_file[0] && resume_status == RESUME_SPECIFIED) {
 		printk( "suspension device unspecified\n" );
 		return -EINVAL;
@@ -1201,12 +1198,15 @@
 	printk( "resuming from %s\n", resume_file);
 	if (read_suspend_image(resume_file, 0))
 		goto read_failure;
+
+	if (pm_prepare_console())
+		printk("swsusp: Can't allocate a console... proceeding\n");
+
 	device_suspend(4);
 	do_magic(1);
 	panic("This never returns");
 
 read_failure:
-	pm_restore_console();
 	return 0;
 }
 
#7 lore raw

Hi!

Quoted 6 lines · Pavel Machek
Quoted 3 lines

Actually, this has several advantages -- you can actually see the messages of the kernel during resume. And reading does logically belong to the kernel doing boot, so it belongs on its screen, too...

Here's a clean patch that does just that.

Thanks. I applied equivalent patch to my tree, and it will eventually propagate. This probably does not apply to latest -bk kernel. If it does, you can send it to akpm and say that I approved it.

Pavel

Quoted 30 lines

diff -Nru linux-2.6.7/kernel/power/swsusp.c linux-2.6.7-pavel/kernel/power/swsusp.c

kernel/power/swsusp.c +4 -4
@@ -1190,9 +1190,6 @@
 	}
 	MDELAY(1000);
 
-	if (pm_prepare_console())
-		printk("swsusp: Can't allocate a console... proceeding\n");
-
 	if (!resume_file[0] && resume_status == RESUME_SPECIFIED) {
 		printk( "suspension device unspecified\n" );
 		return -EINVAL;
@@ -1201,12 +1198,15 @@
 	printk( "resuming from %s\n", resume_file);
 	if (read_suspend_image(resume_file, 0))
 		goto read_failure;
+
+	if (pm_prepare_console())
+		printk("swsusp: Can't allocate a console... proceeding\n");
+
 	device_suspend(4);
 	do_magic(1);
 	panic("This never returns");
 
 read_failure:
-	pm_restore_console();
 	return 0;
 }
 
Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!