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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/2] extract vmcoreinfo from /proc/vmcore for Xen
From: Itsuro ODA <oda@xxxxxxxxxxxxx>
Date: Thu, 12 Jun 2008 17:23:23 +0900
Cc: kexec@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 12 Jun 2008 01:26:12 -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.

- 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>

diff -r e01b3a133ddc 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  Thu Jun 12 13:10:40 2008 +0900
@@ -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 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      Thu Jun 12 13:39:04 2008 +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>");
@@ -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 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     Thu Jun 12 13:11:44 2008 +0900
@@ -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

-- 
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>
  • [Xen-devel] [PATCH 2/2] extract vmcoreinfo from /proc/vmcore for Xen, Itsuro ODA <=