Backport from upstream.
commit 646456862df8926ba10dd7330abf3bf0f887e1b6
Author: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Date: Wed May 26 14:31:26 2021 +0900
[PATCH] Increase SECTION_MAP_LAST_BIT to 5
* Required for kernel 5.12
Kernel commit 1f90a3477df3 ("mm: teach pfn_to_online_page() about
ZONE_DEVICE section collisions") added a section flag
(SECTION_TAINT_ZONE_DEVICE) and causes makedumpfile an error on
some machines like this:
__vtop4_x86_64: Can't get a valid pmd_pte.
readmem: Can't convert a virtual address(ffffe2bdc2000000) to physical address.
readmem: type_addr: 0, addr:ffffe2bdc2000000, size:32768
__exclude_unnecessary_pages: Can't read the buffer of struct page.
create_2nd_bitmap: Can't exclude unnecessary pages.
Increase SECTION_MAP_LAST_BIT to 5 to fix this. The bit had not
been used until the change, so we can just increase the value.
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
...e-Increase-SECTION_MAP_LAST_BIT-to-5.patch | 42 +++++++++++++++++++
kexec-tools.spec | 3 ++
2 files changed, 45 insertions(+)
create mode 100644
kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
diff --git a/kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
b/kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
new file mode 100644
index 0000000..a59bef1
--- /dev/null
+++ b/kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
@@ -0,0 +1,42 @@
+From 646456862df8926ba10dd7330abf3bf0f887e1b6 Mon Sep 17 00:00:00 2001
+From: Kazuhito Hagio <k-hagio-ab(a)nec.com>
+Date: Wed, 26 May 2021 14:31:26 +0900
+Subject: [PATCH] Increase SECTION_MAP_LAST_BIT to 5
+
+* Required for kernel 5.12
+
+Kernel commit 1f90a3477df3 ("mm: teach pfn_to_online_page() about
+ZONE_DEVICE section collisions") added a section flag
+(SECTION_TAINT_ZONE_DEVICE) and causes makedumpfile an error on
+some machines like this:
+
+ __vtop4_x86_64: Can't get a valid pmd_pte.
+ readmem: Can't convert a virtual address(ffffe2bdc2000000) to physical address.
+ readmem: type_addr: 0, addr:ffffe2bdc2000000, size:32768
+ __exclude_unnecessary_pages: Can't read the buffer of struct page.
+ create_2nd_bitmap: Can't exclude unnecessary pages.
+
+Increase SECTION_MAP_LAST_BIT to 5 to fix this. The bit had not
+been used until the change, so we can just increase the value.
+
+Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
+---
+ makedumpfile.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/makedumpfile-1.6.9/makedumpfile.h b/makedumpfile-1.6.9/makedumpfile.h
+index 93aa774..79046f2 100644
+--- a/makedumpfile-1.6.9/makedumpfile.h
++++ b/makedumpfile-1.6.9/makedumpfile.h
+@@ -195,7 +195,7 @@ isAnon(unsigned long mapping)
+ * 2. it has been verified that (1UL<<2) was never set, so it is
+ * safe to mask that bit off even in old kernels.
+ */
+-#define SECTION_MAP_LAST_BIT (1UL<<4)
++#define SECTION_MAP_LAST_BIT (1UL<<5)
+ #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
+ #define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
+ #define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
+--
+2.29.2
+
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 7b29b0e..ca2e30c 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -100,6 +100,7 @@ Requires: systemd-udev%{?_isa}
#
# Patches 601 onward are generic patches
#
+Patch601: ./kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@@ -115,6 +116,8 @@ mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
+%patch601 -p1
+
%ifarch ppc
%define archdef ARCH=ppc
%endif
--
2.29.2