Kexec jump: Hibernation image operations
Subsystems (2)
PATCH 1/2 Kexec jump: Hibernation image operations
This patch make it possible to have multiple implementations of hibernation image operations such as write, read, check, etc, and they can be switched at run time through writing the "/sys/power/hibernation_image_ops". The uswsusp is the default implementation.
include/linux/suspend.h | 14 ++++++++++ kernel/power/disk.c | 64 +++++++++++++++++++++++++++++++++++++++++++----- kernel/power/swsusp.c | 19 ++++++++++++++ 3 files changed, 91 insertions(+), 6 deletions(-)
include/linux/suspend.h +14 -0
@@ -50,6 +50,17 @@ struct hibernation_ops {void (*finish)(void ); }; +struct hibernation_image_ops { +struct list_head list; +char *name; +int (*suspend)(void ); +int (*resume)(void ); +int (*write)(void ); +int (*check)(void ); +int (*read)(void ); +void (*close)(void ); +}; +#if defined(CONFIG_PM ) && defined(CONFIG_SOFTWARE_SUSPEND )/* kernel/power/snapshot.c */ extern void __register_nosave_region (unsigned long b,unsigned long e,int km);
@@ -67,6 +78,7 @@ extern void swsusp_unset_page_free(struct page *);extern unsigned long get_safe_page (gfp_t gfp_mask);extern void hibernation_set_ops (struct hibernation_ops *ops); +extern void hibernation_add_image_ops (struct hibernation_image_ops *ops);extern int hibernate (void );#else static inline void register_nosave_region (unsigned long b,unsigned long e) {}
@@ -76,6 +88,8 @@ static inline void swsusp_set_page_free(struct page *p) {}static inline void swsusp_unset_page_free (struct page *p) {}static inline void hibernation_set_ops (struct hibernation_ops *ops) {} +static inline void hibernation_add_image_ops (struct hibernation_image_ops *ops) +{}static inline int hibernate (void ) {return -ENOSYS ; }#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */
kernel/power/disk.c +58 -6
117 lines not on this page · raw message
kernel/power/swsusp.c +19 -0
@@ -337,3 +337,22 @@ int swsusp_resume(void)local_irq_enable ();return error; } + +static struct hibernation_image_ops uswsusp_hibernation_image_ops = +{ + .name ="uswsusp" , + .suspend = swsusp_suspend, + .resume = swsusp_resume, + .write = swsusp_write, + .check = swsusp_check, + .read = swsusp_read, + .close = swsusp_close, +}; + +static int __init uswsusp_hibernation_init (void ) +{ +hibernation_add_image_ops (&uswsusp_hibernation_image_ops); +return 0 ; +} + +subsys_initcall (uswsusp_hibernation_init);
Quoted 5 lines · Ying
This patch make it possible to have multiple implementations of hibernation image operations such as write, read, check, etc, and they can be switched at run time through writing the "
/sys/power/hibernation_image_ops". The uswsusp is the default implementation.
Umm, so you hook into hibernation_ops, only to run kexec from it?
Would it make more sense to just run kexec manually, maybe with some parameter saying "prepare devices before"?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
Quoted 5 lines · Ying
This patch make it possible to have multiple implementations of hibernation image operations such as write, read, check, etc, and they can be switched at run time through writing the "
/sys/power/hibernation_image_ops". The uswsusp is the default implementation.Umm, so you hook into
hibernation_ops, only to run kexec from it?Would it make more sense to just run kexec manually, maybe with some parameter saying "prepare devices before"?
Well, I think that the $subject patch is unnecessary and confusing. Instead, I'd like to have a separate interface to invoke the feature provided by the second patch.
What the second patch achieves, as far as I understand it, is the ability to be able to jump between two kernels back and forth, on i386. Although it may generally be useful for hibernation, IMO it has very little to it right now, because _many_ important elements of the infrastructure are still needed.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 11 lines · Pavel Machek
Quoted 5 lines · Ying
This patch make it possible to have multiple implementations of hibernation image operations such as write, read, check, etc, and they can be switched at run time through writing the "
/sys/power/hibernation_image_ops". The uswsusp is the default implementation.Umm, so you hook into
hibernation_ops, only to run kexec from it?Would it make more sense to just run kexec manually, maybe with some parameter saying "prepare devices before"?
Well, I think that the $subject patch is unnecessary and confusing. Instead, I'd like to have a separate interface to invoke the feature provided by the second patch.
What the second patch achieves, as far as I understand it, is the ability to be able to jump between two kernels back and forth, on i386. Although it may generally be useful for hibernation, IMO it has very little to it right now, because _many_ important elements of the infrastructure are still needed.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth