Resume from initramfs
Subsystems (3)
PATCH 1/1 Resume from initramfs
Hi all,
seeing as it is that the current software suspend allows suspending only from built-in devices I've hacked the swsusp code to allow also for manual resume. Thus it is now be capable to suspend to modular devices also. This is actually based on a previous patch by mjg59 at scrf.ucam.org, augmented by suggestions from Pavel Machek.
For a clean implementation I've split up the function swsusp_read() into the distinct functions swsusp_check() and swsusp_read().
Furthermore the function prepare() has been split into prepare_processes() and prepare_devices().
With this we now have the functionality to first check whether the device really contains a resume image, then freeze all processes and free some memory, read in the resume image and shut down all devices. It actually makes checking for a resume image faster than the current implementation.
resume can be started by 'echo <major>:<minor> > /sys/power/resume".
Note that this _only_ works from within initramfs when _no_ devices are mounted. Otherwise resume will not be able to freeze the swapper task and consequently fail. And yes, it needs to be properly documented. Will do once the patch is accepted in principle :-).
Oh, and the usual applies: works for me, might eat your disk, beware of nasal demons.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Subject: activate resume from initrd
From: [email protected]
When using a fully modularized kernel it is necessary to activate resume manually as the device node might not be available during kernel init.
This patch implements a new sysfs attribute '/sys/power/resume' which allows for manual activation of software resume.
When read from it prints the configured resume device in 'major:minor' format.
When written to it expects a device in 'major:minor' format. This device is then checked for a suspended image and resume is started if a valid image is found.
The original functionality is left in place.
init/do_mounts.c renamed from init/do_mounts.c.orig +6 -4
@@ -53,7 +53,7 @@ static int __init readwrite(char *str)__setup ("ro" , readonly);__setup ("rw" , readwrite); -static dev_t __init try_name (char *name,int part) +static dev_t try_name (char *name,int part) {char path[64 ];char buf[32 ];
@@ -135,7 +135,7 @@ fail:* is mounted on rootfs /sys. */ -dev_t __init name_to_dev_t (char *name) +dev_t name_to_dev_t (char *name) {char s[32 ];char *p;
@@ -144,7 +144,8 @@ dev_t __init name_to_dev_t(char *name)#ifdef CONFIG_SYSFS int mkdir_err =sys_mkdir ("/sys" ,0700 ); -if (sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ) <0 ) +int mount_err =sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ); +if (mount_err <0 && mount_err != -EBUSY ) goto out;#endif
@@ -196,7 +197,8 @@ dev_t __init name_to_dev_t(char *name) res =try_name (s, part); done:#ifdef CONFIG_SYSFS -sys_umount ("/sys" ,0 ); +if (!mount_err) +sys_umount ("/sys" ,0 ); out:if (!mkdir_err)sys_rmdir ("/sys" );
kernel/power/disk.c renamed from kernel/power/disk.c.orig +84 -16
178 lines not on this page · raw message
kernel/power/swsusp.c renamed from kernel/power/swsusp.c.orig +59 -23
179 lines not on this page · raw message
include/linux/suspend.h renamed from include/linux/suspend.h.orig +2 -0
@@ -25,6 +25,8 @@ typedef struct pbe {#define SUSPEND_PD_PAGES (x) (((x)*sizeof(struct pbe))/PAGE_SIZE+1) + +extern dev_t swsusp_resume_device;/* mm/vmscan.c */ extern int shrink_mem (void );
One thing - if swsusp_read() fails (eg, due to there not actually being a suspend image), the processes will have been frozen but not woken up. The failure path in software_resume needs to call thaw_processes before exiting.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Matthew Garrett
One thing - if
swsusp_read()fails (eg, due to there not actually being a suspend image), the processes will have been frozen but not woken up. The failure path insoftware_resumeneeds to callthaw_processesbefore exiting.
You are, of course, correct. Will be fixing it.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Hi!
Quoted 15 lines
seeing as it is that the current software suspend allows suspending only from built-in devices I've hacked the swsusp code to allow also for manual resume. Thus it is now be capable to suspend to modular devices also. This is actually based on a previous patch by mjg59 at scrf.ucam.org, augmented by suggestions from Pavel Machek.
For a clean implementation I've split up the functionswsusp_read()into the distinct functionsswsusp_check()andswsusp_read(). Furthermore the functionprepare()has been split intoprepare_processes()andprepare_devices().
With this we now have the functionality to first check whether the device really contains a resume image, then freeze all processes and free some memory, read in the resume image and shut down all devices. It actually makes checking for a resume image faster than the current implementation.
Quoted 6 lines
resume can be started by 'echo <major>:<minor> >
/sys/power/resume". Note that this _only_ works from within initramfs when _no_ devices are mounted. Otherwise resume will not be able to freeze the swapper task and consequently fail.
And yes, it needs to be properly documented. Will do once the patch is accepted in principle :-).
In priciple it looks okay, but minor details still need to be ironed out.
Quoted 2 lines
Oh, and the usual applies: works for me, might eat your disk, beware of nasal demons.
:-) Please try to inline patches, it makes it easier to reply to them.
At one point you did something like
read_data() blk_device_put()
If read_data does blk_device_get(), it should also do the put() itself. Otherwise some caller will forget it.
Pavel
init/do_mounts.c fail: · line 141
Quoted 11 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +1
-1@@ -135,7 +135,7 @@ fail:* is mounted on rootfs /sys. */ -dev_t __init name_to_dev_t (char *name) +dev_t name_to_dev_t (char *name) {char s[32 ];char *p;
Why do you need this one? /sys/power/resume accepts numeric values, it should not need to translate...
init/do_mounts.c dev_t __init name_to_dev_t(char *name) · line 151
Quoted 10 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +2
-1@@ -144,7 +144,8 @@ dev_t __init name_to_dev_t(char *name)#ifdef CONFIG_SYSFS int mkdir_err =sys_mkdir ("/sys" ,0700 ); -if (sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ) <0 ) +int mount_err =sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ); +if (mount_err <0 && mount_err != -EBUSY ) goto out;#endif
This is probably not acceptable. Why do you need it? It should be easily doable from initrd.
Quoted 11 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +1
-1@@ -121,45 +125,54 @@ static void finish(void) } -static int prepare (void ) +static int prepare_processes (void ) {int error;
kernel/power/disk.c static void finish(void) · line 139
Quoted 10 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +3
-2pm_prepare_console ();sys_sync (); -if (freeze_processes ()) { + +if (freeze_processes () >1 ) { error = -EBUSY ; - goto Thaw; +return error; }
What does freeze_processes() == 1 mean and why is it suddenly ok?
kernel/power/disk.c static int software_resume(void) · line 267
Quoted 7 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +3
-2-pr_debug ("PM: Preparing system for restore.\n" ); +pr_debug ("PM: Preparing devices for restore.\n" ); -if ((error =prepare ())) +if ((error =prepare_devices ())) { goto Free; + }
I'd not add parenthesis for single command....
kernel/power/disk.c static ssize_t disk_store(struct subsyst · line 390
Quoted 9 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +9
-0+if (sscanf (buf,"%u:%u" , &maj, &min) ==2 ) { + res =MKDEV (maj,min); +if (maj ==MAJOR (res) && min ==MINOR (res)) { + swsusp_resume_device = res; +printk ("Attempting manual resume\n" ); + noresume =0 ; +set_current_state (TASK_STOPPED ); +software_resume (); +set_current_state (TASK_RUNNING );
Ugh, now that is "interesting" hack. You set yourself as stopped to avoid refrigerator.... Is it really needed?
kernel/power/swsusp.c static int __init read_suspend_image(voi · line 1238
Quoted 5 lines
kernel/power/swsusp.c renamed from kernel/power/swsusp.c.orig +3
-0+ }else { +pr_debug ("swsusp: Resume From Partition %d:%d\n" , +MAJOR (swsusp_resume_device),MINOR (swsusp_resume_device));
Missing space after ",".
kernel/power/swsusp.c static int __init read_suspend_image(voi · line 1245
Quoted 8 lines
kernel/power/swsusp.c renamed from kernel/power/swsusp.c.orig +3
-3- resume_bdev =open_by_devnum (resume_device,FMODE_READ ); + resume_bdev =open_by_devnum (swsusp_resume_device,FMODE_READ );if (!IS_ERR (resume_bdev)) {set_blocksize (resume_bdev,PAGE_SIZE ); - error =read_suspend_image (); -blkdev_put (resume_bdev); +if ((error =check_suspend_image ())) +blkdev_put (resume_bdev);
Please put space after "if" and fix formatting here.
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!
Quoted 2 lines · Pavel Machek
Hi!
[ .. ]
Quoted 5 lines
In priciple it looks okay, but minor details still need to be ironed out.
Cool. THX.
Quoted 8 lines
At one point you did something like
read_data() blk_device_put()If
read_datadoesblk_device_get(), it should also do theput()itself. Otherwise some caller will forget it.
Not so easy. blkdev_put() is done implicitely by open_by_devnum().
So if that fails we have to do it by hand (cf. swsusp_check()).
And I'll keep the reference to the block device open to avoid duplicate checking in swsusp_read(). So I'll have to close it there as the block device is local to swsusp.c.
But you are correct in another point, in that there is an error path when prepare_processes fails we have to drop the reference again.
Quoted 6 lines
Quoted 6 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +0
-0@@ -135,7 +135,7 @@ fail:* is mounted on rootfs /sys. */
Quoted 10 lines
init/do_mounts.c fail: · line 141
Quoted 5 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +1
-1-dev_t __init name_to_dev_t (char *name) +dev_t name_to_dev_t (char *name) {char s[32 ];char *p;Why do you need this one?
/sys/power/resumeaccepts numeric values, it should not need to translate...
swsusp_check is used by both entry points, and is itself not a init function. I simply found it bad style to reference a __init function from there. And name_to_dev_t is evil in itself. I'd gladly be rid of it if possible.
Quoted 16 lines
init/do_mounts.c dev_t __init name_to_dev_t(char *name) · line 151
Quoted 11 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +2
-1@@ -144,7 +144,8 @@ dev_t __init name_to_dev_t(char *name)#ifdef CONFIG_SYSFS int mkdir_err =sys_mkdir ("/sys" ,0700 ); -if (sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ) <0 ) +int mount_err =sys_mount ("sysfs" ,"/sys" ,"sysfs" ,0 ,NULL ); +if (mount_err <0 && mount_err != -EBUSY ) goto out;#endif This is probably not acceptable. Why do you need it? It should be easily doable from initrd.
If /sys is mounted the device lookup will fail. How sane is that?
But yes, it doesn't belong to this patch, so I'll be sending a separate one for it.
Quoted 1 line
[ .. ]
Quoted 4 lines
What does
freeze_processes()== 1 mean and why is it suddenly ok?
Sorry, leftover. Cleaned up.
Quoted 5 lines
Quoted 5 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +5
-0+if (sscanf (buf,"%u:%u" , &maj, &min) ==2 ) { + res =MKDEV (maj,min); +if (maj ==MAJOR (res) && min ==MINOR (res)) { + swsusp_resume_device = res; +printk ("Attempting manual resume\n" );
Quoted 9 lines
init/do_mounts.c
Quoted 4 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +4
-0+ noresume =0 ; +set_current_state (TASK_STOPPED ); +software_resume (); +set_current_state (TASK_RUNNING );Ugh, now that is "interesting" hack. You set yourself as stopped to avoid refrigerator.... Is it really needed?
No, again a leftover.
How about this version? Better?
Cheers,
Hannes
--
Subject: activate resume from initramfs
From: [email protected]
When using a fully modularized kernel it is necessary to activate resume manually as the device node might not be available during kernel init.
This patch implements a new sysfs attribute '/sys/power/resume' which allows for manual activation of software resume.
When read from it prints the configured resume device in 'major:minor' format.
When written to it expects a device in 'major:minor' format. This device is then checked for a suspended image and resume is started if a valid image is found.
The original functionality is left in place.
It should only be used from initramfs; other usage will most likely not work.
init/do_mounts.c renamed from init/do_mounts.c.orig +2 -2
@@ -53,7 +53,7 @@ static int __init readwrite(char *str)__setup ("ro" , readonly);__setup ("rw" , readwrite); -static dev_t __init try_name (char *name,int part) +static dev_t try_name (char *name,int part) {char path[64 ];char buf[32 ];
@@ -135,7 +135,7 @@ fail:* is mounted on rootfs /sys. */ -dev_t __init name_to_dev_t (char *name) +dev_t name_to_dev_t (char *name) {char s[32 ];char *p;
kernel/power/disk.c renamed from kernel/power/disk.c.orig +84 -16
184 lines not on this page · raw message
kernel/power/swsusp.c renamed from kernel/power/swsusp.c.orig +4 -2
@@ -36,6 +36,8 @@* For TODOs,FIXMEs also look in Documentation/power/swsusp.txt */ +#define DEBUG +#include <linux/module.h> #include <linux/mm.h> #include <linux/suspend.h>
@@ -80,7 +82,7 @@ static int pagedir_order_check;static int nr_copy_pages_check;extern char resume_file[]; -static dev_t resume_device; +/* Local variables that should not be affected by save */ unsigned int nr_copy_pages __nosavedata = 0;
@@ -170,7 +172,7 @@ static int is_resume_device(const structstruct inode *inode = file->f_dentry->d_inode;return S_ISBLK (inode->i_mode) && - resume_device ==MKDEV (imajor (inode),iminor (inode)); + swsusp_resume_device ==MKDEV (imajor (inode),iminor (inode)); }static int swsusp_swap_check (void )/* This is called before saving
image */
@@ -898,7 +900,7 @@ int swsusp_resume(void)
/*
* Returns true if given address/order collides with any orig_address */
-static int __init does_collide_order(unsigned long addr, int order) +static int does_collide_order(unsigned long addr, int order)
{
int i;
@@ -912,7 +914,7 @@ static int __init does_collide_order(uns
* We check here that pagedir & pages it points to won't collide with
pages
* where we're going to restore from the loaded pages later */
-static int __init check_pagedir(void)
+static int check_pagedir(void)
{
int i;
@@ -930,7 +932,7 @@ static int __init check_pagedir(void)
return 0;
}
-static int __init swsusp_pagedir_relocate(void)
+static int swsusp_pagedir_relocate(void)
{
/*
* We have to avoid recursion (not to overflow kernel stack),
@@ -1075,7 +1077,7 @@ static int bio_write_page(pgoff_t page_o
* I really don't think that it's foolproof but more than nothing.. */
-static const char * __init sanity_check(void) +static const char * sanity_check(void)
{
dump_info();
if(swsusp_info.version_code != LINUX_VERSION_CODE)
@@ -1096,7 +1098,7 @@ static const char * __init sanity_check(
}
-static int __init check_header(void)
+static int check_header(void)
{
const char * reason = NULL;
int error;
@@ -1114,7 +1116,7 @@ static int __init check_header(void)
return error;
}
-static int __init check_sig(void)
+static int check_sig(void)
{
int error;
@@ -1144,7 +1146,7 @@ static int __init check_sig(void)
* already did that.
*/
-static int __init data_read(void)
+static int data_read(void)
{
struct pbe * p;
int error;
@@ -1169,9 +1171,9 @@ static int __init data_read(void)
}
-extern dev_t __init name_to_dev_t(const char *line); +extern dev_t name_to_dev_t(const char *line);
-static int __init read_pagedir(void)
+static int read_pagedir(void)
{
unsigned long addr;
int i, n = swsusp_info.pagedir_pages;
@@ -1196,7 +1198,7 @@ static int __init read_pagedir(void)
return error;
}
-static int __init read_suspend_image(void)
+static int check_suspend_image(void)
{
int error = 0;
@@ -1204,6 +1206,13 @@ static int __init read_suspend_image(voi
return error;
if ((error = check_header()))
return error;
+ return error;
+}
+
+static int read_suspend_image(void)
+{
+ int error = 0;
+
if ((error = read_pagedir()))
return error;
if ((error = data_read()))
@@ -1212,30 +1221,74 @@ static int __init read_suspend_image(voi
}
/**
- * swsusp_read - Read saved image from swap.
+ * swsusp_check - Check for saved image in swap
*/
-int __init swsusp_read(void)
+int swsusp_check(void)
{
int error;
- if (!strlen(resume_file))
- return -ENOENT;
-
- resume_device = name_to_dev_t(resume_file);
- pr_debug("swsusp: Resume From Partition: %s\n", resume_file);
+ if (!swsusp_resume_device) {
+ if (!strlen(resume_file))
+ return -ENOENT;
+ swsusp_resume_device = name_to_dev_t(resume_file);
+ pr_debug("swsusp: Resume From Partition %s\n", resume_file);
+ } else {
+ pr_debug("swsusp: Resume From Partition %d:%d\n",
+ MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
+ }
- resume_bdev = open_by_devnum(resume_device, FMODE_READ);
+ resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ);
if (!IS_ERR(resume_bdev)) {
set_blocksize(resume_bdev, PAGE_SIZE);
- error = read_suspend_image();
- blkdev_put(resume_bdev);
+ error = check_suspend_image();
+ if (error)
+ blkdev_put(resume_bdev);
} else
error = PTR_ERR(resume_bdev);
if (!error)
- pr_debug("Reading resume file was successful\n");
+ pr_debug("swsusp: resume file found\n");
+ else
+ pr_debug("swsusp: Error %d check for resume file\n", error);
+ return error;
+}
+
+/**
+ * swsusp_read - Read saved image from swap.
+ */
+
+int swsusp_read(void)
+{
+ int error;
+
+ if (IS_ERR(resume_bdev)) {
+ pr_debug("swsusp: block device not initialised\n");
+ return PTR_ERR(resume_bdev);
+ }
+
+ error = read_suspend_image();
+ blkdev_put(resume_bdev);
+
+ if (!error)
+ pr_debug("swsusp: Reading resume file was successful\n");
else
pr_debug("swsusp: Error %d resuming\n", error);
return error;
}
+
+/**
+ * swsusp_close - close swap device.
+ */
+
+int swsusp_close(void)
+{
+ int error;
+
+ if (IS_ERR(resume_bdev)) {
+ pr_debug("swsusp: block device not initialised\n");
+ return;
+ }
+
+ blkdev_put(resume_bdev);
+}
include/linux/suspend.h renamed from include/linux/suspend.h.orig +2 -0
@@ -25,6 +25,8 @@ typedef struct pbe {#define SUSPEND_PD_PAGES (x) (((x)*sizeof(struct pbe))/PAGE_SIZE+1) + +extern dev_t swsusp_resume_device;/* mm/vmscan.c */ extern int shrink_mem (void );
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Quoted 4 lines · Hannes Reinecke
swsusp_checkis used by both entry points, and is itself not a init function.
I simply found it bad style to reference a__initfunction from there. Andname_to_dev_tis evil in itself. I'd gladly be rid of it if possible.
name_to_dev_t won't work once userspace has started - you need to set_fs(KERNEL_DS) at least one of the calls in it, IIRC.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 11 lines · Matthew Garrett
Quoted 3 lines · Hannes Reinecke
swsusp_checkis used by both entry points, and is itself not a init function. I simply found it bad style to reference a__initfunction from there. Andname_to_dev_tis evil in itself. I'd gladly be rid of it if possible.
name_to_dev_twon't work once userspace has started - you need toset_fs(KERNEL_DS)at least one of the calls in it, IIRC.
I'm not advocating to use it.
But referencing a non-existing function is just plain evil.
We should better seperate both entry points to do the necessary device resolution themselves before calling generic functions.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Quoted 16 lines · Hannes Reinecke
--- linux-2.6.10/kernel/power/disk.c.orig 2005-01-31
13:54:17.000000000 +0100+++
linux-2.6.10/kernel/power/disk.c2005-01-31 14:55:14.000000000 +0100kernel/power/disk.c renamed from kernel/power/disk.c.orig +3
-1@@ -9,6 +9,8 @@* */ +#define DEBUG +#include <linux/suspend.h> #include <linux/syscalls.h> #include <linux/reboot.h> --- linux-2.6.10/kernel/power/swsusp.c.orig 2005-01-31 13:54:17.000000000 +0100 +++ linux-2.6.10/kernel/power/swsusp.c 2005-01-31 14:53:36.000000000 +0100
kernel/power/disk.c line 43
Quoted 8 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +2
-0@@ -36,6 +36,8 @@* For TODOs,FIXMEs also look in Documentation/power/swsusp.txt */ +#define DEBUG +#include <linux/module.h> #include <linux/mm.h> #include <linux/suspend.h>
Another leftovers?
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 31 lines · Andreas Schwab
Quoted 16 lines · Hannes Reinecke
--- linux-2.6.10/kernel/power/disk.c.orig 2005-01-31
13:54:17.000000000 +0100
+++linux-2.6.10/kernel/power/disk.c2005-01-31 14:55:14.000000000 +0100kernel/power/disk.c renamed from kernel/power/disk.c.orig +3
-1@@ -9,6 +9,8 @@* */ +#define DEBUG +#include <linux/suspend.h> #include <linux/syscalls.h> #include <linux/reboot.h> --- linux-2.6.10/kernel/power/swsusp.c.orig 2005-01-31 13:54:17.000000000 +0100 +++ linux-2.6.10/kernel/power/swsusp.c 2005-01-31 14:53:36.000000000 +0100kernel/power/disk.c line 43
Quoted 8 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +2
-0@@ -36,6 +36,8 @@* For TODOs,FIXMEs also look in Documentation/power/swsusp.txt */ +#define DEBUG +#include <linux/module.h> #include <linux/mm.h> #include <linux/suspend.h> Another leftovers?
Quoted 2 lines
Andreas.
Yes. I'll clean that up once someone (ie Pavel) gives his thumbs-up.
Doesn't do any harm, really. swsusp in itself is chatty enough, two additional lines don't really matter.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke [email protected] SuSE Linux AG S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Hi!
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
--- linux-2.6.10/init/do_mounts.c.orig 2005-01-28
10:25:35.000000000 +0100
+++linux-2.6.10/init/do_mounts.c2005-01-28 10:30:43.000000000 +0100init/do_mounts.c renamed from init/do_mounts.c.orig +0
-0@@ -135,7 +135,7 @@ fail:* is mounted on rootfs /sys. */ Quoted 10 lines
init/do_mounts.c fail: · line 141
Quoted 5 lines
init/do_mounts.c renamed from init/do_mounts.c.orig +1
-1-dev_t __init name_to_dev_t (char *name) +dev_t name_to_dev_t (char *name) {char s[32 ];char *p;Why do you need this one?
/sys/power/resumeaccepts numeric values, it should not need to translate...
Quoted 5 lines
swsusp_checkis used by both entry points, and is itself not a init function.
I simply found it bad style to reference a__initfunction from there. Andname_to_dev_tis evil in itself. I'd gladly be rid of it if possible.
Can you do name_to_dev_t during resume= parsing? That's always done during early boot...
Quoted 1 line
How about this version? Better?
Yes, a bit :-). We still need the docs :-).
Pavel
Quoted 16 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +2
-2@@ -121,45 +126,54 @@ static void finish(void) } -static int prepare (void ) +static int prepare_processes (void ) {int error;pm_prepare_console ();sys_sync (); +if (freeze_processes ()) { error = -EBUSY ; - goto Thaw;
kernel/power/disk.c static void finish(void) · line 147
Quoted 10 lines
kernel/power/disk.c renamed from kernel/power/disk.c.orig +2
-1+return error; }if (pm_disk_mode ==PM_DISK_PLATFORM ) {if (pm_ops && pm_ops->prepare) {if ((error = pm_ops->prepare (PM_SUSPEND_DISK ))) - goto Thaw; +return error; } }
If freezing processes fails, it returns with processes running, here it returns with processes frozen. Bug?
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!