linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swsusp: introduce register_nosave_region_late
@ 2007-05-08  9:23 Johannes Berg
  2007-05-09  6:17 ` Paul Mackerras
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2007-05-08  9:23 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Rafael J. Wysocki, linuxppc-dev list

This patch introduces a new register_nosave_region_late function that
can be called from initcalls when register_nosave_region can no longer
be used because it uses bootmem.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

---
Paul, I see you merged the suspend to disk for G5 patches, but this one
is required for it to build. Rafael said that we should merge it with
the user, since our code is the only user right now I take it that means
it should go through the powerpc tree.

 include/linux/suspend.h |   11 ++++++++++-
 kernel/power/snapshot.c |   12 +++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

--- linux-2.6-git.orig/include/linux/suspend.h	2007-05-03 15:20:29.081123904 +0200
+++ linux-2.6-git/include/linux/suspend.h	2007-05-03 15:23:03.819123904 +0200
@@ -52,7 +52,15 @@ struct hibernation_ops {
 
 #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
 /* kernel/power/snapshot.c */
-extern void __init register_nosave_region(unsigned long, unsigned long);
+extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
+static inline void register_nosave_region(unsigned long b, unsigned long e)
+{
+	__register_nosave_region(b, e, 0);
+}
+static inline void register_nosave_region_late(unsigned long b, unsigned long e)
+{
+	__register_nosave_region(b, e, 1);
+}
 extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
@@ -70,6 +78,7 @@ void hibernation_set_ops(struct hibernat
 extern int hibernate(void);
 #else
 static inline void register_nosave_region(unsigned long b, unsigned long e) {}
+static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
--- linux-2.6-git.orig/kernel/power/snapshot.c	2007-05-03 15:20:01.842123904 +0200
+++ linux-2.6-git/kernel/power/snapshot.c	2007-05-03 15:22:19.138123904 +0200
@@ -608,7 +608,8 @@ static LIST_HEAD(nosave_regions);
  */
 
 void __init
-register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
+__register_nosave_region(unsigned long start_pfn, unsigned long end_pfn,
+			 int use_kmalloc)
 {
 	struct nosave_region *region;
 
@@ -624,8 +625,13 @@ register_nosave_region(unsigned long sta
 			goto Report;
 		}
 	}
-	/* This allocation cannot fail */
-	region = alloc_bootmem_low(sizeof(struct nosave_region));
+	if (use_kmalloc) {
+		/* during init, this shouldn't fail */
+		region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
+		BUG_ON(!region);
+	} else
+		/* This allocation cannot fail */
+		region = alloc_bootmem_low(sizeof(struct nosave_region));
 	region->start_pfn = start_pfn;
 	region->end_pfn = end_pfn;
 	list_add_tail(&region->list, &nosave_regions);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] swsusp: introduce register_nosave_region_late
  2007-05-08  9:23 [PATCH] swsusp: introduce register_nosave_region_late Johannes Berg
@ 2007-05-09  6:17 ` Paul Mackerras
  2007-05-09  6:36   ` Paul Mackerras
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Mackerras @ 2007-05-09  6:17 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Rafael J. Wysocki, linuxppc-dev list

Johannes Berg writes:

> This patch introduces a new register_nosave_region_late function that
> can be called from initcalls when register_nosave_region can no longer
> be used because it uses bootmem.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
> 
> ---
> Paul, I see you merged the suspend to disk for G5 patches, but this one
> is required for it to build. Rafael said that we should merge it with
> the user, since our code is the only user right now I take it that means
> it should go through the powerpc tree.

OK, but the patch doesn't apply against Linus' tree.  It has no
mention of register_nosave_region in include/linux/suspend.h, for
instance.  Which tree is this patch against?

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] swsusp: introduce register_nosave_region_late
  2007-05-09  6:17 ` Paul Mackerras
@ 2007-05-09  6:36   ` Paul Mackerras
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2007-05-09  6:36 UTC (permalink / raw)
  To: Johannes Berg, Rafael J. Wysocki, linuxppc-dev list

Paul Mackerras writes:

> OK, but the patch doesn't apply against Linus' tree.  It has no
> mention of register_nosave_region in include/linux/suspend.h, for
> instance.  Which tree is this patch against?

Sorry, ignore this, I had the wrong branch checked out.

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-09  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08  9:23 [PATCH] swsusp: introduce register_nosave_region_late Johannes Berg
2007-05-09  6:17 ` Paul Mackerras
2007-05-09  6:36   ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).