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 2/4] extract vmcoreinfo from /proc/vmcore for Xen

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/4] extract vmcoreinfo from /proc/vmcore for Xen
From: Itsuro ODA <oda@xxxxxxxxxxxxx>
Date: Mon, 31 Mar 2008 13:25:54 +0900
Cc: kexec@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 30 Mar 2008 21:26:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This patch is for linux-2.6.18-xen-3.2.0.

--- drivers/xen/core/xen_sysfs.c.org    2008-03-25 08:43:21.000000000 +0900
+++ drivers/xen/core/xen_sysfs.c        2008-03-25 09:15:55.000000000 +0900
@@ -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>");
@@ -330,6 +331,24 @@
                           &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_max_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;
@@ -350,9 +369,14 @@
        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();
@@ -366,6 +390,7 @@
 
 static void __exit hyper_sysfs_exit(void)
 {
+       xen_sysfs_vmcoreinfo_destroy();
        xen_properties_destroy();
        xen_compilation_destroy();
        xen_sysfs_uuid_destroy();
--- drivers/xen/core/machine_kexec.c.org        2008-03-25 09:01:39.000000000 
+0900
+++ drivers/xen/core/machine_kexec.c    2008-03-25 09:05:47.000000000 +0900
@@ -15,6 +15,9 @@
 static struct resource xen_hypervisor_res;
 static struct resource *xen_phys_cpus;
 
+size_t vmcoreinfo_max_size_xen = 4096;
+unsigned long paddr_vmcoreinfo_xen;
+
 void __init xen_machine_kexec_setup_resources(void)
 {
        xen_kexec_range_t range;
@@ -92,6 +95,17 @@
                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;
+       }
+
        return;
 
  err:
--- include/xen/interface/kexec.h.org   2008-03-25 09:08:43.000000000 +0900
+++ include/xen/interface/kexec.h       2008-03-25 09:12:02.000000000 +0900
@@ -111,6 +111,10 @@
 #define KEXEC_RANGE_MA_CRASH 0   /* machine address and size of crash area */
 #define KEXEC_RANGE_MA_XEN   1   /* machine address and size of Xen itself */
 #define KEXEC_RANGE_MA_CPU   2   /* machine address and size of a CPU note */
+#define KEXEC_RANGE_MA_VMCOREINFO   3   /* machine address and size of 
vmcoreinfo */
+
+extern size_t vmcoreinfo_max_size_xen;
+extern unsigned long paddr_vmcoreinfo_xen;
 
 /*
  * Find the address and size of certain memory areas

-- 
Itsuro ODA <oda@xxxxxxxxxxxxx>


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

<Prev in Thread] Current Thread [Next in Thread>