Re: TuxOnIce for 3.19 breaks x86

Oleksandr Natalenko <[email protected]> Sun, 22 Feb 2015 12:46:50 +0200
Newsgroups gmane.linux.swsusp.devel
Message-ID <4322108.LKh9ByE5dF@spock>
This is a multi-part message in MIME format.

--nextPart1736119.x1axYZ9oYj
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"

Nigel,

please consider reviewing attached patches. Two of them address mentioned 
issue. One more fixes compiling with TOI disabled.

On Saturday 21 February 2015 15:12:25 Oleksandr Natalenko wrote:
> Hello.
> 
> One of my users has reported that TuxOnIce patch (regardless of whether it
> is enabled in kernel config or not) breaks 32-bit kernel compiling with the
> following errors (I guess that is related to memory bitmap rework):
> 
> ...
> 
> How one could fix that?
-- 
Oleksandr post-factum Natalenko, MSc
pf-kernel community
https://natalenko.name/
--nextPart1736119.x1axYZ9oYj
Content-Disposition: attachment; filename="0001-toi-3.18-attempt-to-fix-compiling-without-TOI.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0001-toi-3.18-attempt-to-fix-compiling-without-TOI.patch"

From b247c8271dfc47e7f2c4dee9956596f9118043d7 Mon Sep 17 00:00:00 2001
From: Oleksandr Natalenko <[email protected]>
Date: Tue, 17 Feb 2015 20:15:02 +0200
Subject: [PATCH 1/3] toi-3.18: attempt to fix compiling without TOI

---
 kernel/power/snapshot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 2014a9e..60a9e202 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -101,8 +101,10 @@ static void *get_image_page(gfp_t gfp_mask, int safe_needed)
 {
 	void *res;
 
+#ifdef CONFIG_TOI
         if (toi_running)
             return (void *) toi_get_nonconflicting_page();
+#endif
 
 	res = (void *)get_zeroed_page(gfp_mask);
 	if (safe_needed)
-- 
2.3.0


--nextPart1736119.x1axYZ9oYj
Content-Disposition: attachment; filename="0002-toi-3.19-attempt-to-fix-TOI-for-32-bit-kernels.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0002-toi-3.19-attempt-to-fix-TOI-for-32-bit-kernels.patch"

From 463e055c50759155783d20c26fdf4d6cb96a7c6e Mon Sep 17 00:00:00 2001
From: Oleksandr Natalenko <[email protected]>
Date: Sun, 22 Feb 2015 12:15:02 +0200
Subject: [PATCH 2/3] toi-3.19: attempt to fix TOI for 32-bit kernels

---
 kernel/power/power.h    |  8 ++++----
 kernel/power/snapshot.c | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/power/power.h b/kernel/power/power.h
index a11892a..500b7fe 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -37,7 +37,7 @@ static inline char *check_image_kernel(struct swsusp_info *info)
 			"architecture specific data" : NULL;
 }
 #else
-extern char *check_image_kernel(struct swsusp_info *info);
+static char *check_image_kernel(struct swsusp_info *info);
 #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
 extern int init_header(struct swsusp_info *info);
 
@@ -275,12 +275,12 @@ static inline void suspend_thaw_processes(void)
 }
 #endif
 
-extern struct page *saveable_page(struct zone *z, unsigned long p);
+extern struct page *saveable_page(struct zone *zone, unsigned long pfn);
 #ifdef CONFIG_HIGHMEM
-extern void *saveable_highmem_page(struct zone *z, unsigned long p);
+extern struct page *saveable_highmem_page(struct zone *zone, unsigned long pfn);
 #else
 static
-inline void *saveable_highmem_page(struct zone *z, unsigned long p)
+inline struct page *saveable_highmem_page(struct zone *zone, unsigned long pfn)
 {
 	return NULL;
 }
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 60a9e202..3843730 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1831,7 +1831,7 @@ alloc_highmem_pages(struct memory_bitmap *bm, unsigned int nr_highmem)
 		struct page *page;
 
 		page = alloc_image_page(__GFP_HIGHMEM);
-		memory_bm_set_bit(bm, page_to_pfn(page));
+		memory_bm_set_bit(bm, 0, page_to_pfn(page));
 	}
 	return nr_highmem;
 }
@@ -2193,12 +2193,12 @@ static unsigned int count_highmem_image_pages(struct memory_bitmap *bm)
 	unsigned int cnt = 0;
 
 	memory_bm_position_reset(bm);
-	pfn = memory_bm_next_pfn(bm);
+	pfn = memory_bm_next_pfn(bm, 0);
 	while (pfn != BM_END_OF_MAP) {
 		if (PageHighMem(pfn_to_page(pfn)))
 			cnt++;
 
-		pfn = memory_bm_next_pfn(bm);
+		pfn = memory_bm_next_pfn(bm, 0);
 	}
 	return cnt;
 }
@@ -2243,7 +2243,7 @@ prepare_highmem_image(struct memory_bitmap *bm, unsigned int *nr_highmem_p)
 		page = alloc_page(__GFP_HIGHMEM);
 		if (!swsusp_page_is_free(page)) {
 			/* The page is "safe", set its bit the bitmap */
-			memory_bm_set_bit(bm, page_to_pfn(page));
+			memory_bm_set_bit(bm, 0, page_to_pfn(page));
 			safe_highmem_pages++;
 		}
 		/* Mark the page as allocated */
@@ -2301,7 +2301,7 @@ get_highmem_page_buffer(struct page *page, struct chain_allocator *ca)
 
 		/* Copy of the page will be stored in high memory */
 		kaddr = buffer;
-		tmp = pfn_to_page(memory_bm_next_pfn(safe_highmem_bm));
+		tmp = pfn_to_page(memory_bm_next_pfn(safe_highmem_bm, 0));
 		safe_highmem_pages--;
 		last_highmem_page = tmp;
 		pbe->copy_page = tmp;
-- 
2.3.0


--nextPart1736119.x1axYZ9oYj
Content-Disposition: attachment; filename="0003-toi-3.19-remove-static-qualifier-from-check_image_ke.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0003-toi-3.19-remove-static-qualifier-from-check_image_ke.patch"

From ba5fac0030f6961bbd3f03cee8e939aeebfcd6cf Mon Sep 17 00:00:00 2001
From: Oleksandr Natalenko <[email protected]>
Date: Sun, 22 Feb 2015 12:27:06 +0200
Subject: [PATCH 3/3] toi-3.19: remove static qualifier from
 check_image_kernel()

---
 kernel/power/power.h    | 2 +-
 kernel/power/snapshot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/power.h b/kernel/power/power.h
index 500b7fe..fecf5e2 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -37,7 +37,7 @@ static inline char *check_image_kernel(struct swsusp_info *info)
 			"architecture specific data" : NULL;
 }
 #else
-static char *check_image_kernel(struct swsusp_info *info);
+char *check_image_kernel(struct swsusp_info *info);
 #endif /* CONFIG_ARCH_HIBERNATION_HEADER */
 extern int init_header(struct swsusp_info *info);
 
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 3843730..cd03d5b 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1939,7 +1939,7 @@ static int init_header_complete(struct swsusp_info *info)
 	return 0;
 }
 
-static char *check_image_kernel(struct swsusp_info *info)
+char *check_image_kernel(struct swsusp_info *info)
 {
 	if (info->version_code != LINUX_VERSION_CODE)
 		return "kernel version";
-- 
2.3.0


--nextPart1736119.x1axYZ9oYj
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHV4T25JY2Ut
ZGV2ZWwgbWFpbGluZyBsaXN0ClR1eE9uSWNlLWRldmVsQGxpc3RzLnR1eG9uaWNlLm5ldApodHRw
Oi8vbGlzdHMudHV4b25pY2UubmV0L2xpc3RpbmZvL3R1eG9uaWNlLWRldmVs

--nextPart1736119.x1axYZ9oYj--