Skip to contentSkip to conversation

makedumpfile: Xen fixes

PATCH Superseded Daniel Kiper 2 participants 9 messages Nov 26, 2013 – Nov 28, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover makedumpfile: Xen fixes

Hi,

This patch series contains following makedumpfile Xen fixes:
- makedumpfile/xen: Move Xen crash dump check,
- makedumpfile/xen: Disable cyclic mode for every Xen crash dump,
- makedumpfile/xen: Fail immediately if dump level is invalid.

All patches were tested with Xen versions up to latest unstable.

Please apply.

Daniel

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

PATCH 1/3 makedumpfile/xen: Move Xen crash dump check

Commit 92563d7a7a5175ef78c4a94ee269b1b455331b4c (cache: Allocate buffers at initialization to detect malloc() failure) split cache_alloc() to cache_init() and cache_alloc(). cache_init() is called in initial(). However, sadly initial_xen() is called before cache_init() and it uses cache_alloc() indirectly which refers to uninitialized structures. Hence, makedumfile run on Xen crash dumps finally fails. This patch moves initial_xen() behind cache_init() call and fixes above mentioned issue.

---
 makedumpfile.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
makedumpfile.c +1 -4
index 0c68f32..74376cd 100644
@@ -2905,9 +2905,6 @@ initial(void)
 	unsigned long size;
 	int debug_info = FALSE;
 
-	if (is_xen_memory() && !initial_xen())
-		return FALSE;
-
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
 		info->flag_lzo_support = TRUE;
@@ -3172,7 +3169,7 @@ out:
 			return FALSE;
 	}
 
-	if (is_xen_memory() && !get_dom0_mapnr())
+	if (is_xen_memory() && (!initial_xen() || !get_dom0_mapnr()))
 		return FALSE;
 
 	if (!get_value_for_old_linux())
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/3 makedumpfile/xen: Move Xen crash dump check

In reply to Daniel Kiper

Commit 92563d7a7a5175ef78c4a94ee269b1b455331b4c (cache: Allocate buffers at initialization to detect malloc() failure) split cache_alloc() to cache_init() and cache_alloc(). cache_init() is called in initial(). However, sadly initial_xen() is called before cache_init() and it uses cache_alloc() indirectly which refers to uninitialized structures. Hence, makedumfile run on Xen crash dumps finally fails. This patch moves initial_xen() behind cache_init() call and fixes above mentioned issue.

---
 makedumpfile.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
makedumpfile.c +1 -4
index 0c68f32..74376cd 100644
@@ -2905,9 +2905,6 @@ initial(void)
 	unsigned long size;
 	int debug_info = FALSE;
 
-	if (is_xen_memory() && !initial_xen())
-		return FALSE;
-
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
 		info->flag_lzo_support = TRUE;
@@ -3172,7 +3169,7 @@ out:
 			return FALSE;
 	}
 
-	if (is_xen_memory() && !get_dom0_mapnr())
+	if (is_xen_memory() && (!initial_xen() || !get_dom0_mapnr()))
 		return FALSE;
 
 	if (!get_value_for_old_linux())
Signature · 7 lines
1.7.10.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw

PATCH 2/3 makedumpfile/xen: Disable cyclic mode for every Xen crash dump

In reply to Daniel Kiper

Disable cyclic mode for every Xen crash dump not only when -X option is used. This way makedumpfile is much more flexible and different modes could be used to dump whole system memory (e.g. zero pages could be striped without requiring -X option).

---
 makedumpfile.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
makedumpfile.c +8 -8
index 74376cd..b160cea 100644
@@ -2925,20 +2925,20 @@ initial(void)
 	}
 #endif
 
-	if (info->flag_exclude_xen_dom) {
+	if (is_xen_memory()) {
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
 			MSG("because the cyclic mode doesn't support Xen.\n");
 		}
+	}
 
-		if (!is_xen_memory()) {
-			MSG("'-X' option is disable,");
-			MSG("because %s is not Xen's memory core image.\n", info->name_memory);
-			MSG("Commandline parameter is invalid.\n");
-			MSG("Try `makedumpfile --help' for more information.\n");
-			return FALSE;
-		}
+	if (info->flag_exclude_xen_dom && !is_xen_memory()) {
+		MSG("'-X' option is disable,");
+		MSG("because %s is not Xen's memory core image.\n", info->name_memory);
+		MSG("Commandline parameter is invalid.\n");
+		MSG("Try `makedumpfile --help' for more information.\n");
+		return FALSE;
 	}
 
 	if (info->flag_refiltering) {
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 2/3 makedumpfile/xen: Disable cyclic mode for every Xen crash dump

In reply to Daniel Kiper

Disable cyclic mode for every Xen crash dump not only when -X option is used. This way makedumpfile is much more flexible and different modes could be used to dump whole system memory (e.g. zero pages could be striped without requiring -X option).

---
 makedumpfile.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
makedumpfile.c +8 -8
index 74376cd..b160cea 100644
@@ -2925,20 +2925,20 @@ initial(void)
 	}
 #endif
 
-	if (info->flag_exclude_xen_dom) {
+	if (is_xen_memory()) {
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
 			MSG("because the cyclic mode doesn't support Xen.\n");
 		}
+	}
 
-		if (!is_xen_memory()) {
-			MSG("'-X' option is disable,");
-			MSG("because %s is not Xen's memory core image.\n", info->name_memory);
-			MSG("Commandline parameter is invalid.\n");
-			MSG("Try `makedumpfile --help' for more information.\n");
-			return FALSE;
-		}
+	if (info->flag_exclude_xen_dom && !is_xen_memory()) {
+		MSG("'-X' option is disable,");
+		MSG("because %s is not Xen's memory core image.\n", info->name_memory);
+		MSG("Commandline parameter is invalid.\n");
+		MSG("Try `makedumpfile --help' for more information.\n");
+		return FALSE;
 	}
 
 	if (info->flag_refiltering) {
Signature · 7 lines
1.7.10.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw

PATCH 3/3 makedumpfile/xen: Fail immediately if dump level is invalid

In reply to Daniel Kiper

Do not try to process Xen crash dump if dump level is invalid. Fail immediately and print relevant error message.

---
 makedumpfile.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
makedumpfile.c +17 -1
index b160cea..389efc5 100644
@@ -64,6 +64,8 @@ do { \
 static void check_cyclic_buffer_overrun(void);
 static void setup_page_is_buddy(void);
 
+int get_next_dump_level(int index);
+
 void
 initialize_tables(void)
 {
@@ -2903,7 +2905,7 @@ initial(void)
 {
 	off_t offset;
 	unsigned long size;
-	int debug_info = FALSE;
+	int debug_info = FALSE, dump_level, i;
 
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
@@ -2926,6 +2928,20 @@ initial(void)
 #endif
 
 	if (is_xen_memory()) {
+		for (i = 0; ; ++i) {
+			dump_level = get_next_dump_level(i);
+
+			if (dump_level < 0)
+				break;
+
+			if (dump_level <= 1)
+				continue;
+
+			MSG("Allowed Dump_Level for Xen dump filtering is 0 or 1\n");
+
+			return FALSE;
+		}
+
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 3/3 makedumpfile/xen: Fail immediately if dump level is invalid

In reply to Daniel Kiper

Do not try to process Xen crash dump if dump level is invalid. Fail immediately and print relevant error message.

---
 makedumpfile.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
makedumpfile.c +17 -1
index b160cea..389efc5 100644
@@ -64,6 +64,8 @@ do { \
 static void check_cyclic_buffer_overrun(void);
 static void setup_page_is_buddy(void);
 
+int get_next_dump_level(int index);
+
 void
 initialize_tables(void)
 {
@@ -2903,7 +2905,7 @@ initial(void)
 {
 	off_t offset;
 	unsigned long size;
-	int debug_info = FALSE;
+	int debug_info = FALSE, dump_level, i;
 
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
@@ -2926,6 +2928,20 @@ initial(void)
 #endif
 
 	if (is_xen_memory()) {
+		for (i = 0; ; ++i) {
+			dump_level = get_next_dump_level(i);
+
+			if (dump_level < 0)
+				break;
+
+			if (dump_level <= 1)
+				continue;
+
+			MSG("Allowed Dump_Level for Xen dump filtering is 0 or 1\n");
+
+			return FALSE;
+		}
+
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
Signature · 7 lines
1.7.10.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#7 lore raw

Re: [PATCH 3/3] makedumpfile/xen: Fail immediately if dump level is invalid

Hello Daniel,

Quoted 38 lines · Daniel Kiper

Do not try to process Xen crash dump if dump level is invalid. Fail immediately and print relevant error message.

---
 makedumpfile.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
makedumpfile.c +7 -1
index b160cea..389efc5 100644
@@ -64,6 +64,8 @@ do { \
 static void check_cyclic_buffer_overrun(void);
 static void setup_page_is_buddy(void);
 
+int get_next_dump_level(int index);
+
 void
 initialize_tables(void)
 {
@@ -2903,7 +2905,7 @@ initial(void)
 {
 	off_t offset;
 	unsigned long size;
-	int debug_info = FALSE;
+	int debug_info = FALSE, dump_level, i;
 
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
@@ -2926,6 +2928,20 @@ initial(void)
 #endif
 
 	if (is_xen_memory()) {
+		for (i = 0; ; ++i) {
+			dump_level = get_next_dump_level(i);
+
+			if (dump_level < 0)

makedumpfile.c initial(void) · line 2944

Quoted 10 lines
makedumpfile.c +10 -0
+				break;
+
+			if (dump_level <= 1)
+				continue;
+
+			MSG("Allowed Dump_Level for Xen dump filtering is 0 or 1\n");
+
+			return FALSE;
+		}
+

This check is already exist in initial_xen():

#ifndef __x86_64__
        if (DL_EXCLUDE_ZERO < info->max_dump_level) {
                MSG("Dump_level is invalid. It should be 0 or 1.\n");
                MSG("Commandline parameter is invalid.\n");
                MSG("Try `makedumpfile --help' for more information.\n");
                return FALSE;
        }

#endif

So if you want to check the dump level early, you should extract the code above from initial_xen() and insert it into here instead.

Thanks
Atsushi Kumagai

Quoted 7 lines
makedumpfile.c +0 -0
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
Signature · 1 line
1.7.10.4
#8 lore raw

Re: [PATCH 3/3] makedumpfile/xen: Fail immediately if dump level is invalid

In reply to Daniel Kiper

Hello Daniel,

Quoted 38 lines · Daniel Kiper

Do not try to process Xen crash dump if dump level is invalid. Fail immediately and print relevant error message.

---
 makedumpfile.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
makedumpfile.c +7 -1
index b160cea..389efc5 100644
@@ -64,6 +64,8 @@ do { \
 static void check_cyclic_buffer_overrun(void);
 static void setup_page_is_buddy(void);
 
+int get_next_dump_level(int index);
+
 void
 initialize_tables(void)
 {
@@ -2903,7 +2905,7 @@ initial(void)
 {
 	off_t offset;
 	unsigned long size;
-	int debug_info = FALSE;
+	int debug_info = FALSE, dump_level, i;
 
 #ifdef USELZO
 	if (lzo_init() == LZO_E_OK)
@@ -2926,6 +2928,20 @@ initial(void)
 #endif
 
 	if (is_xen_memory()) {
+		for (i = 0; ; ++i) {
+			dump_level = get_next_dump_level(i);
+
+			if (dump_level < 0)

makedumpfile.c initial(void) · line 2944

Quoted 10 lines
makedumpfile.c +10 -0
+				break;
+
+			if (dump_level <= 1)
+				continue;
+
+			MSG("Allowed Dump_Level for Xen dump filtering is 0 or 1\n");
+
+			return FALSE;
+		}
+

This check is already exist in initial_xen():

#ifndef __x86_64__
        if (DL_EXCLUDE_ZERO < info->max_dump_level) {
                MSG("Dump_level is invalid. It should be 0 or 1.\n");
                MSG("Commandline parameter is invalid.\n");
                MSG("Try `makedumpfile --help' for more information.\n");
                return FALSE;
        }

#endif

So if you want to check the dump level early, you should extract the code above from initial_xen() and insert it into here instead.

Thanks
Atsushi Kumagai

Quoted 7 lines
makedumpfile.c +0 -0
 		if(info->flag_cyclic) {
 			info->flag_cyclic = FALSE;
 			MSG("Switched running mode from cyclic to non-cyclic,\n");
Signature · 1 line
1.7.10.4

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec