[Makedumpfile Patch v3 2/7] initial(): call cach_init() a bit early

Atsushi Kumagai ats-kumagai at wm.jp.nec.com
Wed Jul 19 00:46:21 PDT 2017


Hello Pratyush,

>Call cach_init() before get_kcore_dump_loads(), because latter uses
>cache_search().
>
>Call path is like this :
>get_kcore_dump_loads() -> process_dump_load() -> vaddr_to_paddr() ->
>vtop4_x86_64() -> readmem() -> cache_search()

I found that the current cach_init() is too early, cache_init() should be
called after fallback_to_current_page_size() for older kernel
which doesn't have VMCOREINFO.
Could you confirm that the patch below is fine with you ?

Thanks,
Atsushi Kumagai

From: Atsushi Kumagai <ats-kumagai at wm.jp.nec.com>
Date: Wed, 19 Jul 2017 15:05:58 +0900
Subject: [PATCH] Fix the regression caused by moving cache_init() earlier

info->page_size should be set before calling cache_init() since it
allocates some buffers based on info->page_size. However, cache_init()
was moved before fallback_to_current_page_size() while it set
info->page_size for older kernel which doesn't have VMCOREINFO.

This patch moves cache_init() after fallback_to_current_page_size()
and reverts the commit: b98e6e0d2a(sadump: set info->page_size before cache_init())

Signed-off-by: Atsushi Kumagai <ats-kumagai at wm.jp.nec.com>
---
 makedumpfile.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index a3f0697..f85003a 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3905,15 +3905,6 @@ initial(void)
 	if (!get_value_for_old_linux())
 		return FALSE;
 
-	if (info->flag_sadump && !set_page_size(sadump_page_size()))
-			return FALSE;
-
-	if (!is_xen_memory() && !cache_init())
-		return FALSE;
-
-	if (info->flag_mem_usage && !get_kcore_dump_loads())
-		return FALSE;
-
 	if (info->flag_refiltering) {
 		if (info->flag_elf_dumpfile) {
 			MSG("'-E' option is disable, ");
@@ -3936,6 +3927,9 @@ initial(void)
 			return FALSE;
 		}
 
+		if (!set_page_size(sadump_page_size()))
+			return FALSE;
+
 		if (!sadump_initialize_bitmap_memory())
 			return FALSE;
 
@@ -3949,9 +3943,7 @@ initial(void)
 		 * postponed until debug information becomes
 		 * available.
 		 */
-
-	} else if (!get_phys_base())
-		return FALSE;
+	}
 
 out:
 	if (!info->page_size) {
@@ -3962,6 +3954,18 @@ out:
 		if (!fallback_to_current_page_size())
 			return FALSE;
 	}
+
+	if (!is_xen_memory() && !cache_init())
+		return FALSE;
+
+	if (info->flag_mem_usage && !get_kcore_dump_loads())
+		return FALSE;
+
+	if (!info->flag_refiltering && !info->flag_sadump) {
+		if (!get_phys_base())
+			return FALSE;
+	}
+
 	if (!get_max_mapnr())
 		return FALSE;
 
-- 
2.7.2


>Signed-off-by: Pratyush Anand <panand at redhat.com>
>---
> makedumpfile.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/makedumpfile.c b/makedumpfile.c
>index 6942047199de..3b8e9810468d 100644
>--- a/makedumpfile.c
>+++ b/makedumpfile.c
>@@ -3878,6 +3878,9 @@ initial(void)
> 	if (!get_value_for_old_linux())
> 		return FALSE;
>
>+	if (!is_xen_memory() && !cache_init())
>+		return FALSE;
>+
> 	if (info->flag_mem_usage && !get_kcore_dump_loads())
> 		return FALSE;
>
>@@ -4000,9 +4003,6 @@ out:
> 		}
> 	}
>
>-	if (!is_xen_memory() && !cache_init())
>-		return FALSE;
>-
> 	if (debug_info && !get_machdep_info())
> 		return FALSE;
>
>--
>2.9.3
>





More information about the kexec mailing list