WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] [dom0-kernel] fix kdump kernel crash on Xen3.2

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] [dom0-kernel] fix kdump kernel crash on Xen3.2
From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Date: Wed, 01 Oct 2008 11:05:57 +0100
Delivery-date: Wed, 01 Oct 2008 03:06:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.16 (X11/20080724)
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@xxxxxxxxxxxxx>
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 */
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] [dom0-kernel] fix kdump kernel crash on Xen3.2, Alex Zeffertt <=