[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xen: fix kdump kernel crash on Xen3.2



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222943342 -3600
# Node ID b54652ee29ef09b4a0cc0e3460629c5638d9cafb
# Parent  fc1b82ca1e6a6e59243a00e583b9bb357593f216
xen: fix kdump kernel crash on Xen3.2

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@xxxxxxxxxxxxx>
---
 drivers/xen/core/machine_kexec.c |   25 ++++++++++++++++++++-----
 drivers/xen/core/xen_sysfs.c     |   30 +++++++++++++++++-------------
 include/xen/interface/kexec.h    |    2 ++
 3 files changed, 39 insertions(+), 18 deletions(-)

diff -r fc1b82ca1e6a -r b54652ee29ef drivers/xen/core/machine_kexec.c
--- a/drivers/xen/core/machine_kexec.c  Mon Sep 29 10:07:48 2008 +0100
+++ b/drivers/xen/core/machine_kexec.c  Thu Oct 02 11:29:02 2008 +0100
@@ -27,6 +27,7 @@ void __init xen_machine_kexec_setup_reso
        xen_kexec_range_t range;
        struct resource *res;
        int k = 0;
+       int rc;
 
        if (!is_initial_xendomain())
                return;
@@ -103,12 +104,26 @@ void __init xen_machine_kexec_setup_reso
        memset(&range, 0, sizeof(range));
        range.range = KEXEC_RANGE_MA_VMCOREINFO;
 
-       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
-               return;
-
-       if (range.size) {
+       rc = HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range);
+
+       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 fc1b82ca1e6a -r b54652ee29ef drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c      Mon Sep 29 10:07:48 2008 +0100
+++ b/drivers/xen/core/xen_sysfs.c      Thu Oct 02 11:29:02 2008 +0100
@@ -339,9 +339,6 @@ static void xen_properties_destroy(void)
 
 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);
 }
@@ -359,11 +356,6 @@ static void xen_sysfs_vmcoreinfo_destroy
        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
 
 static int __init hyper_sysfs_init(void)
@@ -388,10 +380,19 @@ static int __init hyper_sysfs_init(void)
        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 @@ out:
 
 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 fc1b82ca1e6a -r b54652ee29ef include/xen/interface/kexec.h
--- a/include/xen/interface/kexec.h     Mon Sep 29 10:07:48 2008 +0100
+++ b/include/xen/interface/kexec.h     Thu Oct 02 11:29:02 2008 +0100
@@ -175,6 +175,8 @@ void vmcoreinfo_append_str(const char *f
 #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 */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.