extract vmcoreinfo from /proc/vmcore for Xen
Subsystems (2)
PATCH 2/4 extract vmcoreinfo from /proc/vmcore for Xen
This patch is for linux-2.6.18-xen-3.2.0.
xen/core/xen_sysfs.c renamed from xen/core/xen_sysfs.c.org +25 -0
@@ -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 <[email protected]>" );
@@ -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 ();
xen/core/machine_kexec.c renamed from xen/core/machine_kexec.c.org +14 -0
@@ -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:
xen/interface/kexec.h renamed from xen/interface/kexec.h.org +4 -0
@@ -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
Signature · 1 line
Itsuro ODA <[email protected]>
Hi, Itsuro
xen/interface/kexec.h line 116
Quoted 10 lines
xen/interface/kexec.h renamed from xen/interface/kexec.h.org +1
-0@@ -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 */
xen/interface/kexec.h renamed from xen/interface/kexec.h.org +2
-0+ +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
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi,
Quoted 13 lines · On Mon, 31 Mar 2008 15:51:30 +0900 Akio Takebe <[email protected]>…
Hi, Itsuro
xen/interface/kexec.h line 116
Quoted 10 lines
xen/interface/kexec.h renamed from xen/interface/kexec.h.org +1
-0@@ -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 */
xen/interface/kexec.h renamed from xen/interface/kexec.h.org +2
-0+ +extern size_t vmcoreinfo_max_size_xen;Why don't you use
VMCOREINFO_BYTES(4096) instead ofvmcoreinfo_max_size_xen?
There is no significant reason now. Just reserve the posibility to make it variable.
Thanks.
Signature · 1 line
Itsuro ODA <[email protected]>