Itsuro ODA
2008-Mar-31 04:25 UTC
[Xen-devel] [PATCH 2/4] extract vmcoreinfo from /proc/vmcore for Xen
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@us.ibm.com>"); @@ -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@valinux.co.jp> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Akio Takebe
2008-Mar-31 06:51 UTC
[Xen-devel] Re: [PATCH 2/4] extract vmcoreinfo from /proc/vmcore for Xen
Hi, Itsuro>--- 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;Why don''t you use VMCOREINFO_BYTES (4096) instead of vmcoreinfo_max_size_xen? Best Regards, Akio Takebe _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Itsuro ODA
2008-Mar-31 07:07 UTC
[Xen-devel] Re: [PATCH 2/4] extract vmcoreinfo from /proc/vmcore for Xen
Hi, On Mon, 31 Mar 2008 15:51:30 +0900 Akio Takebe <takebe_akio@jp.fujitsu.com> wrote:> Hi, Itsuro > > >--- 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; > Why don''t you use VMCOREINFO_BYTES (4096) instead of vmcoreinfo_max_size_xen?There is no significant reason now. Just reserve the posibility to make it variable. Thanks. -- Itsuro ODA <oda@valinux.co.jp> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel