[RFC][PATCH 1/3] Embed vmcoreinfo into kernel file

Vivek Goyal vgoyal at in.ibm.com
Fri Aug 17 08:28:03 EDT 2007


On Fri, Aug 17, 2007 at 03:43:31PM +0900, Ken'ichi Ohmichi wrote:
[..]
> >- There is another important field which I would like to see in vmcoreinfo
> >  and that is time of crash (lets say CRASH_TIME). This will indicate the
> >  timestamp when did system actually crash. One can read the time in
> >  crash_kexec(), fill in the field and then save vmcore info note.
> >
> >  For this, either you need to scan the vmcoreinfo note again and fill in
> >  the time stamp. Or you need to do vmcoreinfo note saving after crash
> >  instead of boot time.
> 
> Is it necessary of the field for timestamp ?
> The crash utility can display the time of crash already like the following.
> 
> # crash vmlinux vmcore
> [snip]
>       KERNEL: vmlinux
>     DUMPFILE: vmcore
>         CPUS: 2
>         DATE: Tue Jul 10 20:41:50 2007  <- Here
>       UPTIME: 00:04:58
> LOAD AVERAGE: 0.12, 0.22, 0.11
>        TASKS: 88
>     NODENAME: peak
>      RELEASE: 2.6.16.46-0.12-default
>      VERSION: #1 SMP Thu May 17 14:00:09 UTC 2007
>      MACHINE: ia64  (1000 Mhz)
>       MEMORY: 5.5 GB
>        PANIC: "SysRq : Trigger a crashdump"
>          PID: 3455
>      COMMAND: "bash"
>         TASK: e0000040f2f40000  [THREAD_INFO: e0000040f2f410d0]
>          CPU: 0
>        STATE: TASK_RUNNING (SYSRQ)
> 
> 

But this requires a debug compiled vmlinux to be available on the system
and that's a rarity. For example, we are exporting UTSNAME also which 
can be retrieved by opening vmcore with crash.

By exporting this, now one can write a small utility in second kernel,
which can just look at the /proc/vmcore in second kernel, determine that
machine had crashed and send a notification over network to other machine
with crash time stamp.
 
[..]
> +#define SYMBOL(name) \
> +	vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
> +#define SIZE(name) \
> +	vmcoreinfo_append_str("SIZE(%s)=%d\n", #name, sizeof(struct name))
> +#define OFFSET(name, field) \
> +	vmcoreinfo_append_str("OFFSET(%s.%s)=%d\n", #name, #field, &(((struct name *)0)->field))
> +#define LENGTH(name, value) \
> +	vmcoreinfo_append_str("LENGTH(%s)=%d\n", #name, value)
> +#define CONFIG(name) \
> +	vmcoreinfo_append_str("CONFIG_%s=%c\n", #name, CONFIG_##name)
> +

Have you tested CONFIG(). For me it did not work? Are you getting output
like CONFIG_KEXEC=y with above macro?

Thanks
Vivek



More information about the kexec mailing list