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

[Xen-changelog] [linux-2.6.18-xen] extract vmcoreinfo from /proc/vmcore for Xen



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213347290 -3600
# Node ID 32a80b65ddadc49c48950690a0705b8f6d473a70
# Parent  e01b3a133ddc88d280d593f12a60e8def46ae86a
extract vmcoreinfo from /proc/vmcore for Xen

- get the machine address of the vmcoreinfo area of xen
- expose the machine address and the size of the vmcoreinfo area
  via /sys/hypervisor/vmcoreinfo so that the kexec-tools looks them.

Signed-off-by: Itsuro Oda <oda@xxxxxxxxxxxxx>
---
 drivers/xen/core/machine_kexec.c |   15 +++++++++++++++
 drivers/xen/core/xen_sysfs.c     |   25 +++++++++++++++++++++++++
 include/xen/interface/kexec.h    |    4 ++++
 3 files changed, 44 insertions(+)

diff -r e01b3a133ddc -r 32a80b65ddad drivers/xen/core/machine_kexec.c
--- a/drivers/xen/core/machine_kexec.c  Wed Jun 11 09:28:01 2008 +0100
+++ b/drivers/xen/core/machine_kexec.c  Fri Jun 13 09:54:50 2008 +0100
@@ -19,6 +19,9 @@ static struct resource xen_hypervisor_re
 static struct resource xen_hypervisor_res;
 static struct resource *xen_phys_cpus;
 
+size_t vmcoreinfo_size_xen;
+unsigned long paddr_vmcoreinfo_xen;
+
 void __init xen_machine_kexec_setup_resources(void)
 {
        xen_kexec_range_t range;
@@ -94,6 +97,18 @@ void __init xen_machine_kexec_setup_reso
        if (range.size) {
                crashk_res.start = range.start;
                crashk_res.end = range.start + range.size - 1;
+       }
+
+       /* get physical address of vmcoreinfo */
+       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) {
+               paddr_vmcoreinfo_xen = range.start;
+               vmcoreinfo_size_xen = range.size;
        }
 
        if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus,
diff -r e01b3a133ddc -r 32a80b65ddad drivers/xen/core/xen_sysfs.c
--- a/drivers/xen/core/xen_sysfs.c      Wed Jun 11 09:28:01 2008 +0100
+++ b/drivers/xen/core/xen_sysfs.c      Fri Jun 13 09:54:50 2008 +0100
@@ -15,6 +15,7 @@
 #include <xen/features.h>
 #include <xen/hypervisor_sysfs.h>
 #include <xen/xenbus.h>
+#include <xen/interface/kexec.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mike D. Day <ncmike@xxxxxxxxxx>");
@@ -334,6 +335,24 @@ static void xen_properties_destroy(void)
                           &xen_properties_group);
 }
 
+static ssize_t vmcoreinfo_show(struct hyp_sysfs_attr *attr, char *page)
+{
+       return sprintf(page, "%lx %zx\n",
+               paddr_vmcoreinfo_xen, vmcoreinfo_size_xen);
+}
+
+HYPERVISOR_ATTR_RO(vmcoreinfo);
+
+static int __init xen_sysfs_vmcoreinfo_init(void)
+{
+       return sysfs_create_file(&hypervisor_subsys.kset.kobj, 
&vmcoreinfo_attr.attr);
+}
+
+static void xen_sysfs_vmcoreinfo_destroy(void)
+{
+       sysfs_remove_file(&hypervisor_subsys.kset.kobj, &vmcoreinfo_attr.attr);
+}
+
 static int __init hyper_sysfs_init(void)
 {
        int ret;
@@ -354,9 +373,14 @@ static int __init hyper_sysfs_init(void)
        if (ret)
                goto uuid_out;
        ret = xen_properties_init();
+       if (ret)
+               goto prop_out;
+       ret = xen_sysfs_vmcoreinfo_init();
        if (!ret)
                goto out;
 
+       xen_properties_destroy();
+prop_out:
        xen_sysfs_uuid_destroy();
 uuid_out:
        xen_compilation_destroy();
@@ -370,6 +394,7 @@ out:
 
 static void __exit hyper_sysfs_exit(void)
 {
+       xen_sysfs_vmcoreinfo_destroy();
        xen_properties_destroy();
        xen_compilation_destroy();
        xen_sysfs_uuid_destroy();
diff -r e01b3a133ddc -r 32a80b65ddad include/xen/interface/kexec.h
--- a/include/xen/interface/kexec.h     Wed Jun 11 09:28:01 2008 +0100
+++ b/include/xen/interface/kexec.h     Fri Jun 13 09:54:50 2008 +0100
@@ -138,6 +138,10 @@ typedef struct xen_kexec_load {
                                      * the ia64_boot_param */
 #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
                                      * of the EFI Memory Map */
+#define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of vmcoreinfo 
*/
+
+extern size_t vmcoreinfo_size_xen;
+extern unsigned long paddr_vmcoreinfo_xen;
 
 /*
  * Find the address and size of certain memory areas

_______________________________________________
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®.