From: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] [dom0-kernel] fix kdump kernel crash on Xen3.2
Date: Wed, 01 Oct 2008 11:05:57 +0100 [thread overview]
Message-ID: <48E34B85.4000505@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 871 bytes --]
The current dom0 kernel fails to initialise resources needed by a kdump kernel
when running on Xen3.2, causing the kdump kernel to panic when it is kexec'd.
The kernel is supposed to create some "Crash note" resources (children of the
"Hypervisor code and data" resource in /proc/iomem). However, when running on
Xen 3.2, xen_machine_kexec_setup_resources() encounters an error and returns
prior to doing this.
The error occurs when it calls the "kexec_get_range" hypercall to determine the
location of the "vmcoreinfo". This was only implemented in Xen 3.3.
This patch makes the kernel handle this error gracefully by simply not creating
the sysfs file "hypervisor/vmcoreinfo" if the hypervisor is unable to provide
the info - rather than bailing out of xen_machine_kexec_setup_resources() early.
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
[-- Attachment #2: handle-kexec_get_range-hypercall-failure-gracefully.patch --]
[-- Type: text/x-diff, Size: 3082 bytes --]
diff -r c2eae050926d drivers/xen/core/machine_kexec.c
--- a/drivers/xen/core/machine_kexec.c Mon Sep 29 15:31:13 2008 +0100
+++ b/drivers/xen/core/machine_kexec.c Wed Oct 01 10:48:21 2008 +0100
@@ -27,6 +27,7 @@
xen_kexec_range_t range;
struct resource *res;
int k = 0;
+ int rc;
if (!is_initial_xendomain())
return;
@@ -103,12 +104,26 @@
memset(&range, 0, sizeof(range));
range.range = KEXEC_RANGE_MA_VMCOREINFO;
- if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
- return;
+ rc = HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range);
- if (range.size) {
+ if (rc == 0) {
+ /* Hypercall succeeded */
+ vmcoreinfo_size_xen = range.size;
paddr_vmcoreinfo_xen = range.start;
- vmcoreinfo_size_xen = range.size;
+
+ } else {
+ /* Hypercall failed.
+ * Indicate not to create sysfs file by resetting globals
+ */
+ vmcoreinfo_size_xen = 0;
+ paddr_vmcoreinfo_xen = 0;
+
+ /* The KEXEC_CMD_kexec_get_range hypercall did not implement
+ * KEXEC_RANGE_MA_VMCOREINFO until Xen 3.3.
+ * Do not bail out if it fails for this reason.
+ */
+ if (rc != -EINVAL)
+ return;
}
if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus,
diff -r c2eae050926d drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c Mon Sep 29 15:31:13 2008 +0100
+++ b/drivers/xen/core/xen_sysfs.c Wed Oct 01 10:48:21 2008 +0100
@@ -339,9 +339,6 @@
static ssize_t vmcoreinfo_show(struct hyp_sysfs_attr *attr, char *page)
{
- extern size_t vmcoreinfo_size_xen;
- extern unsigned long paddr_vmcoreinfo_xen;
-
return sprintf(page, "%lx %zx\n",
paddr_vmcoreinfo_xen, vmcoreinfo_size_xen);
}
@@ -358,11 +355,6 @@
{
sysfs_remove_file(&hypervisor_subsys.kset.kobj, &vmcoreinfo_attr.attr);
}
-
-#else
-
-#define xen_sysfs_vmcoreinfo_init() 0
-#define xen_sysfs_vmcoreinfo_destroy() ((void)0)
#endif
@@ -388,10 +380,19 @@
ret = xen_properties_init();
if (ret)
goto prop_out;
- ret = xen_sysfs_vmcoreinfo_init();
- if (!ret)
- goto out;
+#ifdef CONFIG_KEXEC
+ if (vmcoreinfo_size_xen != 0) {
+ ret = xen_sysfs_vmcoreinfo_init();
+ if (ret)
+ goto vmcoreinfo_out;
+ }
+#endif
+ goto out;
+
+#ifdef CONFIG_KEXEC
+vmcoreinfo_out:
+#endif
xen_properties_destroy();
prop_out:
xen_sysfs_uuid_destroy();
@@ -407,7 +408,10 @@
static void __exit hyper_sysfs_exit(void)
{
- xen_sysfs_vmcoreinfo_destroy();
+#ifdef CONFIG_KEXEC
+ if (vmcoreinfo_size_xen != 0)
+ xen_sysfs_vmcoreinfo_destroy();
+#endif
xen_properties_destroy();
xen_compilation_destroy();
xen_sysfs_uuid_destroy();
diff -r c2eae050926d include/xen/interface/kexec.h
--- a/include/xen/interface/kexec.h Mon Sep 29 15:31:13 2008 +0100
+++ b/include/xen/interface/kexec.h Wed Oct 01 10:48:22 2008 +0100
@@ -175,6 +175,8 @@
#define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \
vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \
(unsigned long)offsetof(struct name, field))
+extern size_t vmcoreinfo_size_xen;
+extern unsigned long paddr_vmcoreinfo_xen;
#endif /* _XEN_PUBLIC_KEXEC_H */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2008-10-01 10:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48E34B85.4000505@eu.citrix.com \
--to=alex.zeffertt@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.