Skip to contentSkip to conversation

IA64: log insertion of crashkernel region

PATCH In review Horms 2 participants 3 messages Mar 6, 2007 – Mar 7, 2007

lore
Share & tools
lore

Horms

author
#0 lore raw

PATCH 2/3 IA64: log insertion of crashkernel region

This patch adds a faclilty to print out a message regarding the success or failure of inserting the crashkernel region. On systems with a large ammount of memory, the chances of failure tend to be quite low, especially now that the base address of the region can be determined by the kernel. However, on systems with less memory, such as Xen's Domain 0, it can occur, and silently failing is confusing to say the least.

It also updates the error message generated by kdump_find_rsvd_region() if it can't locate a base address for the requested crashkernel region, which is really just another failure mode for the problem detailed in the paragraph above.

 linux-2.6/arch/ia64/kernel/efi.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/ia64/kernel/efi.c
=================================--- linux-2.6.orig/arch/ia64/kernel/efi.c 2007-03-06 16:25:46.000000000 +0900
+++ linux-2.6/arch/ia64/kernel/efi.c 2007-03-06 16:25:46.000000000 +0900
@@ -1049,6 +1049,9 @@
u64 efi_desc_size;
char *name;
unsigned long flags;
+#ifdef CONFIG_KEXEC
+ int crashk_res_inserted = 0;
+#endif

efi_map_start = __va(ia64_boot_param->efi_memmap);
efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -1125,11 +1128,25 @@

 #ifdef CONFIG_KEXEC
                         insert_resource(res, &efi_memmap_res);
                         insert_resource(res, &boot_param_res);

- if (crashk_res.end > crashk_res.start)
- insert_resource(res, &crashk_res);
+ if (!crashk_res_inserted &&
+ crashk_res.end > crashk_res.start &&
+ insert_resource(res, &crashk_res) >= 0)
+ crashk_res_inserted = 1;
+
#endif
}
}
+
+ if (crashk_res.end > crashk_res.start) {
+ if (crashk_res_inserted)
+ printk(KERN_ERR "Kdump: registered crashdump: "
+ "0x%08lx-0x%08lx\n", crashk_res.start,
+ crashk_res.end);
+ else
+ printk(KERN_ERR "Kdump: failed to insert resource for "
+ "crashdump: 0x%08lx-0x%08lx\n",
+ crashk_res.start, crashk_res.end);
+ }
}

#ifdef CONFIG_KEXEC
@@ -1172,8 +1189,8 @@
return start;
}

- printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n",
- size);
+ printk(KERN_WARNING "Kdump: failed to find a base address for 0x%lx bytes"
+ "of memory for crashdump\n", size);
return ~0UL;
}
#endif

--

Signature · 3 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/
#1 lore raw
Quoted 71 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Horms
Sent: 2007Äê3ÔÂ6ÈÕ 15:29
To: Linux-IA64; [email protected]
Cc: Luck, Tony; Zou, Nanhai; Magnus Damm
Subject: [patch 2/3] IA64: log insertion of crashkernel region

This patch adds a faclilty to print out a message regarding the success or failure of inserting the crashkernel region. On systems with a large ammount of memory, the chances of failure tend to be quite low, especially now that the base address of the region can be determined by the kernel. However, on systems with less memory, such as Xen's Domain 0, it can occur, and silently failing is confusing to say the least.

It also updates the error message generated by kdump_find_rsvd_region() if it can't locate a base address for the requested crashkernel region, which is really just another failure mode for the problem detailed in the paragraph above.

 linux-2.6/arch/ia64/kernel/efi.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/ia64/kernel/efi.c
=================================> --- linux-2.6.orig/arch/ia64/kernel/efi.c 2007-03-06 16:25:46.000000000
+0900
+++ linux-2.6/arch/ia64/kernel/efi.c 2007-03-06 16:25:46.000000000 +0900

(quoted diff) +19 -2
@@ -1049,6 +1049,9 @@
 	u64 efi_desc_size;
 	char *name;
 	unsigned long flags;
+#ifdef CONFIG_KEXEC
+	int crashk_res_inserted = 0;
+#endif
 
 	efi_map_start = __va(ia64_boot_param->efi_memmap);
 	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -1125,11 +1128,25 @@
 #ifdef CONFIG_KEXEC
                         insert_resource(res, &efi_memmap_res);
                         insert_resource(res, &boot_param_res);
-			if (crashk_res.end > crashk_res.start)
-				insert_resource(res, &crashk_res);
+			if (!crashk_res_inserted &&
+			    crashk_res.end > crashk_res.start &&
+			    insert_resource(res, &crashk_res) >= 0)
+				crashk_res_inserted = 1;
+
 #endif
 		}
 	}
+
+	if (crashk_res.end > crashk_res.start) {
+		if (crashk_res_inserted)
+			printk(KERN_ERR "Kdump: registered crashdump: "
+			       "0x%08lx-0x%08lx\n", crashk_res.start,
+			       crashk_res.end);
+		else
+			printk(KERN_ERR "Kdump: failed to insert resource for "
+			       "crashdump: 0x%08lx-0x%08lx\n",
+			       crashk_res.start, crashk_res.end);
+	}
 }
 
 #ifdef CONFIG_KEXEC
@@ -1172,8 +1189,8 @@
 		return start;
   }

Review

Quoted 10 lines
(quoted diff) +2 -3
 
-  printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n",
-	size);
+  printk(KERN_WARNING "Kdump: failed to find a base address for 0x%lx bytes"
+	 "of memory for crashdump\n", size);
   return ~0UL;
 }
 #endif
 
--

You can check if crash_res is inserted from /proc/iomem.
Thanks
Zou Nan hai

Quoted 9 lines

--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
In reply to Horms

Hi,

Here is a minor update to this patch, which makes the use of log priorities more consistent.

Signature · 77 lines
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

This patch adds a faclilty to print out a message regarding the success or
failure of inserting the crashkernel region. On systems with a large
ammount of memory, the chances of failure tend to be quite low, especially
now that the base address of the region can be determined by the kernel.
However, on systems with less memory, such as Xen's Domain 0, it
can occur, and silently failing is confusing to say the least.

It also updates the error message generated by kdump_find_rsvd_region()
if it can't locate a base address for the requested crashkernel region,
which is really just another failure mode for the problem detailed
in the paragraph above.

* Update 
  - Consistently use KERN_WARNING for errors/warnings (which are not
    critical) and ERN_INFO for logging success

Signed-off-by: Simon Horman <[email protected]>

 linux-2.6/arch/ia64/kernel/efi.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/ia64/kernel/efi.c
=================================--- linux-2.6.orig/arch/ia64/kernel/efi.c	2007-03-07 09:39:15.000000000 +0900
+++ linux-2.6/arch/ia64/kernel/efi.c	2007-03-07 09:40:49.000000000 +0900
@@ -1076,6 +1076,9 @@
 	u64 efi_desc_size;
 	char *name;
 	unsigned long flags;
+#ifdef CONFIG_KEXEC
+	int crashk_res_inserted = 0;
+#endif
 
 	efi_map_start = __va(ia64_boot_param->efi_memmap);
 	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -1152,11 +1155,25 @@
 #ifdef CONFIG_KEXEC
                         insert_resource(res, &efi_memmap_res);
                         insert_resource(res, &boot_param_res);
-			if (crashk_res.end > crashk_res.start)
-				insert_resource(res, &crashk_res);
+			if (!crashk_res_inserted &&
+			    crashk_res.end > crashk_res.start &&
+			    insert_resource(res, &crashk_res) >= 0)
+				crashk_res_inserted = 1;
+
 #endif
 		}
 	}
+
+	if (crashk_res.end > crashk_res.start) {
+		if (crashk_res_inserted)
+			printk(KERN_INFO "Kdump: registered crashdump: "
+			       "0x%08lx-0x%08lx\n", crashk_res.start,
+			       crashk_res.end);
+		else
+			printk(KERN_WARNING "Kdump: failed to insert resource "
+			       "for crashdump: 0x%08lx-0x%08lx\n",
+			       crashk_res.start, crashk_res.end);
+	}
 }
 
 #ifdef CONFIG_KEXEC
@@ -1277,8 +1294,8 @@
 		return start;
   }
 
-  printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n",
-	size);
+  printk(KERN_WARNING "Kdump: failed to find a base address for 0x%lx bytes"
+	 "of memory for crashdump\n", size);
   return ~0UL;
 }
 #endif