From: Kazuhito Hagio k-hagio@ab.jp.nec.com
# resend this set bacause the previous one is being held..
These are both backports from upstream, and tested OK with kernel 5.3.0-0.rc1.git3.1.fc31.x86_64.
Patch 2/2 fixes a failure of makedumpfile on Linux 5.3-rc1 that prints error like the following:
readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 __exclude_unnecessary_pages: Can't read the buffer of struct page. create_2nd_bitmap: Can't exclude unnecessary pages.
Patch 1/2 is not necessary for fixing the issue, but without the patch, if a similar issue occurs in the future, makedumpfile can take a long time to finish generating a broken vmcore meaninglessly, and 2nd kernel cannot reboot soon.
Kazuhito Hagio (2): makedumpfile: Do not proceed when get_num_dumpable_cyclic() fails makedumpfile: Increase SECTION_MAP_LAST_BIT to 4
...d-when-get_num_dumpable_cyclic-fails.patch | 44 +++++++++++++++++++ ...e-Increase-SECTION_MAP_LAST_BIT-to-4.patch | 38 ++++++++++++++++ kexec-tools.spec | 4 ++ 3 files changed, 86 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch
From: Kazuhito Hagio k-hagio@ab.jp.nec.com
Backport from the makedumpfile devel branch in upstream.
commit c1b834f80311706db2b5070cbccdcba3aacc90e5 Author: Kazuhito Hagio k-hagio@ab.jp.nec.com Date: Tue Jul 23 11:50:52 2019 -0400
[PATCH] Do not proceed when get_num_dumpable_cyclic() fails
Currently, when get_num_dumpable_cyclic() fails and returns FALSE in create_dump_bitmap(), info->num_dumpable is set to 0 and makedumpfile proceeds to write a broken dumpfile slowly with incorrect progress indicator due to the value.
It should not proceed when get_num_dumpable_cyclic() fails.
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com --- ...d-when-get_num_dumpable_cyclic-fails.patch | 44 +++++++++++++++++++ kexec-tools.spec | 2 + 2 files changed, 46 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch
diff --git a/kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch b/kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch new file mode 100644 index 0000000..4cbdfa1 --- /dev/null +++ b/kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch @@ -0,0 +1,44 @@ +From c1b834f80311706db2b5070cbccdcba3aacc90e5 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio k-hagio@ab.jp.nec.com +Date: Tue, 23 Jul 2019 11:50:52 -0400 +Subject: [PATCH 1/2] Do not proceed when get_num_dumpable_cyclic() fails + +Currently, when get_num_dumpable_cyclic() fails and returns FALSE in +create_dump_bitmap(), info->num_dumpable is set to 0 and makedumpfile +proceeds to write a broken dumpfile slowly with incorrect progress +indicator due to the value. + +It should not proceed when get_num_dumpable_cyclic() fails. + +Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com +--- + makedumpfile.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/makedumpfile.c b/makedumpfile.c +index d76a4358a2b2..88df788fd6e7 100644 +--- a/makedumpfile-1.6.6/makedumpfile.c ++++ b/makedumpfile-1.6.6/makedumpfile.c +@@ -7344,7 +7344,8 @@ create_dump_bitmap(void) + if (!prepare_bitmap2_buffer()) + goto out; + +- info->num_dumpable = get_num_dumpable_cyclic(); ++ if (!(info->num_dumpable = get_num_dumpable_cyclic())) ++ goto out; + + if (!info->flag_elf_dumpfile) + free_bitmap2_buffer(); +@@ -7362,7 +7363,8 @@ create_dump_bitmap(void) + if (!create_2nd_bitmap(&cycle)) + goto out; + +- info->num_dumpable = get_num_dumpable_cyclic(); ++ if (!(info->num_dumpable = get_num_dumpable_cyclic())) ++ goto out; + } + + ret = TRUE; +-- +2.18.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index 0c82769..d4ab5a7 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -92,6 +92,7 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch # # Patches 601 onward are generic patches # +Patch601: kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch
%description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -108,6 +109,7 @@ tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE19}
%patch0 -p1 +%patch601 -p1
%ifarch ppc %define archdef ARCH=ppc
From: Kazuhito Hagio k-hagio@ab.jp.nec.com
Backport from the makedumpfile devel branch in upstream.
commit 7bdb468c2c99dd780c9a5321f93c79cbfdce2527 Author: Kazuhito Hagio k-hagio@ab.jp.nec.com Date: Tue Jul 23 12:24:47 2019 -0400
[PATCH] Increase SECTION_MAP_LAST_BIT to 4
kernel commit 326e1b8f83a4 ("mm/sparsemem: introduce a SECTION_IS_EARLY flag") added the flag to mem_section->section_mem_map value, and it caused makedumpfile an error like the following:
readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 __exclude_unnecessary_pages: Can't read the buffer of struct page. create_2nd_bitmap: Can't exclude unnecessary pages.
To fix this, SECTION_MAP_LAST_BIT needs to be updated. The bit has not been used until the addition, so we can just increase the value.
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com
Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com --- ...e-Increase-SECTION_MAP_LAST_BIT-to-4.patch | 38 +++++++++++++++++++ kexec-tools.spec | 2 + 2 files changed, 40 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch
diff --git a/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch b/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch new file mode 100644 index 0000000..050d83c --- /dev/null +++ b/kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch @@ -0,0 +1,38 @@ +From 7bdb468c2c99dd780c9a5321f93c79cbfdce2527 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio k-hagio@ab.jp.nec.com +Date: Tue, 23 Jul 2019 12:24:47 -0400 +Subject: [PATCH 2/2] Increase SECTION_MAP_LAST_BIT to 4 + +kernel commit 326e1b8f83a4 ("mm/sparsemem: introduce a SECTION_IS_EARLY +flag") added the flag to mem_section->section_mem_map value, and it caused +makedumpfile an error like the following: + + readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. + readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 + __exclude_unnecessary_pages: Can't read the buffer of struct page. + create_2nd_bitmap: Can't exclude unnecessary pages. + +To fix this, SECTION_MAP_LAST_BIT needs to be updated. The bit has not +been used until the addition, so we can just increase the value. + +Signed-off-by: Kazuhito Hagio k-hagio@ab.jp.nec.com +--- + makedumpfile.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makedumpfile.h b/makedumpfile.h +index 24b2f69f400c..df745b9f53e5 100644 +--- a/makedumpfile-1.6.6/makedumpfile.h ++++ b/makedumpfile-1.6.6/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<<3) ++#define SECTION_MAP_LAST_BIT (1UL<<4) + #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.18.1 + diff --git a/kexec-tools.spec b/kexec-tools.spec index d4ab5a7..eb6fe29 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -93,6 +93,7 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch # Patches 601 onward are generic patches # Patch601: kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch +Patch602: kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch
%description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -110,6 +111,7 @@ tar -z -x -v -f %{SOURCE19}
%patch0 -p1 %patch601 -p1 +%patch602 -p1
%ifarch ppc %define archdef ARCH=ppc
On 08/02/19 at 10:59am, Kazuhito Hagio wrote:
From: Kazuhito Hagio k-hagio@ab.jp.nec.com
# resend this set bacause the previous one is being held..
These are both backports from upstream, and tested OK with kernel 5.3.0-0.rc1.git3.1.fc31.x86_64.
Patch 2/2 fixes a failure of makedumpfile on Linux 5.3-rc1 that prints error like the following:
readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 __exclude_unnecessary_pages: Can't read the buffer of struct page. create_2nd_bitmap: Can't exclude unnecessary pages.
Patch 1/2 is not necessary for fixing the issue, but without the patch, if a similar issue occurs in the future, makedumpfile can take a long time to finish generating a broken vmcore meaninglessly, and 2nd kernel cannot reboot soon.
Kazuhito Hagio (2): makedumpfile: Do not proceed when get_num_dumpable_cyclic() fails makedumpfile: Increase SECTION_MAP_LAST_BIT to 4
...d-when-get_num_dumpable_cyclic-fails.patch | 44 +++++++++++++++++++ ...e-Increase-SECTION_MAP_LAST_BIT-to-4.patch | 38 ++++++++++++++++ kexec-tools.spec | 4 ++ 3 files changed, 86 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch
-- 2.20.1
Kazu, thanks for the patch!
Acked-by: Dave Young dyoung@redhat.com
Thanks Dave
On Fri, Aug 2, 2019 at 11:00 PM Kazuhito Hagio khagio@redhat.com wrote:
From: Kazuhito Hagio k-hagio@ab.jp.nec.com
# resend this set bacause the previous one is being held..
These are both backports from upstream, and tested OK with kernel 5.3.0-0.rc1.git3.1.fc31.x86_64.
Patch 2/2 fixes a failure of makedumpfile on Linux 5.3-rc1 that prints error like the following:
readmem: Can't convert a virtual address(fffffc97d1000000) to physical address. readmem: type_addr: 0, addr:fffffc97d1000000, size:32768 __exclude_unnecessary_pages: Can't read the buffer of struct page. create_2nd_bitmap: Can't exclude unnecessary pages.
Patch 1/2 is not necessary for fixing the issue, but without the patch, if a similar issue occurs in the future, makedumpfile can take a long time to finish generating a broken vmcore meaninglessly, and 2nd kernel cannot reboot soon.
Kazuhito Hagio (2): makedumpfile: Do not proceed when get_num_dumpable_cyclic() fails makedumpfile: Increase SECTION_MAP_LAST_BIT to 4
...d-when-get_num_dumpable_cyclic-fails.patch | 44 +++++++++++++++++++ ...e-Increase-SECTION_MAP_LAST_BIT-to-4.patch | 38 ++++++++++++++++ kexec-tools.spec | 4 ++ 3 files changed, 86 insertions(+) create mode 100644 kexec-tools-2.0.20-makedumpfile-Do-not-proceed-when-get_num_dumpable_cyclic-fails.patch create mode 100644 kexec-tools-2.0.20-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-4.patch
-- 2.20.1
Thanks for the patch! Acked and applied.
-- Best Regards, Kairui Song