: add dmesg log symbols to /proc/vmcoreinfo lists
Subsystems (3)
PATCH 1/1 : add dmesg log symbols to /proc/vmcoreinfo lists
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in /proc/vmcore. This patch adds the log_buf and log_end symbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.
Regards
Neil
include/linux/kernel.h | 2 ++ kernel/kexec.c | 3 +++ kernel/printk.c | 8 ++++++++ 3 files changed, 13 insertions(+)
include/linux/kernel.h +2 -0
@@ -242,6 +242,7 @@ extern struct ratelimit_state printk_ratelimit_state;extern int printk_ratelimit (void );extern bool printk_timed_ratelimit (unsigned long *caller_jiffies,unsigned int interval_msec); +void log_buf_kexec_setup (void );#else static inline int vprintk (const char *s,va_list args) __attribute__ ((format (printf,1 ,0 )));
@@ -253,6 +254,7 @@ static inline int printk_ratelimit(void) { return 0; }static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } +#define log_buf_kexec_setup () do {} while(0)#endif extern int printk_needs_cpu (int cpu);
kernel/kexec.c +3 -0
@@ -1409,6 +1409,9 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_OFFSET (list_head, prev);VMCOREINFO_OFFSET (vm_struct, addr);VMCOREINFO_LENGTH (zone.free_area,MAX_ORDER ); +#ifdef CONFIG_PRINTK +log_buf_kexec_setup (); +#endif VMCOREINFO_LENGTH (free_area.free_list,MIGRATE_TYPES );VMCOREINFO_NUMBER (NR_FREE_PAGES );VMCOREINFO_NUMBER (PG_lru);
kernel/printk.c +8 -0
@@ -32,6 +32,7 @@#include <linux/security.h> #include <linux/bootmem.h> #include <linux/syscalls.h> +#include <linux/kexec.h> #include <asm/uaccess.h>
@@ -136,6 +137,13 @@ static char *log_buf = __log_buf;static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ +void log_buf_kexec_setup (void ) +{ +VMCOREINFO_SYMBOL (log_buf); +VMCOREINFO_SYMBOL (log_end); +} + +static int __init log_buf_len_setup (char *str) {unsigned size =memparse (str, &str);
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 11 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Regards
NeilSigned-off-by Neil Horman <[email protected]>
THis sounds reasonable to me.
Signature · 9 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
Quoted 59 lines
Regards
NeilSigned-off-by Neil Horman <[email protected]>include/linux/kernel.h | 2 ++ kernel/kexec.c | 3 +++ kernel/printk.c | 8 ++++++++ 3 files changed, 13 insertions(+)include/linux/kernel.h +2
-0@@ -242,6 +242,7 @@ extern struct ratelimit_state printk_ratelimit_state;extern int printk_ratelimit (void );extern bool printk_timed_ratelimit (unsigned long *caller_jiffies,unsigned int interval_msec); +void log_buf_kexec_setup (void );#else static inline int vprintk (const char *s,va_list args) __attribute__ ((format (printf,1 ,0 )));@@ -253,6 +254,7 @@ static inline int printk_ratelimit(void) { return 0; }static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } +#define log_buf_kexec_setup () do {} while(0)#endif extern int printk_needs_cpu (int cpu);kernel/kexec.c +3
-0@@ -1409,6 +1409,9 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_OFFSET (list_head, prev);VMCOREINFO_OFFSET (vm_struct, addr);VMCOREINFO_LENGTH (zone.free_area,MAX_ORDER ); +#ifdef CONFIG_PRINTK +log_buf_kexec_setup (); +#endif VMCOREINFO_LENGTH (free_area.free_list,MIGRATE_TYPES );VMCOREINFO_NUMBER (NR_FREE_PAGES );VMCOREINFO_NUMBER (PG_lru);kernel/printk.c +1
-0@@ -32,6 +32,7 @@#include <linux/security.h> #include <linux/bootmem.h> #include <linux/syscalls.h> +#include <linux/kexec.h> #include <asm/uaccess.h>
kernel/printk.c static char *log_buf = __log_buf; · line 145
Quoted 9 lines
kernel/printk.c +6
-0@@ -136,6 +137,13 @@ static char *log_buf = __log_buf;static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ +void log_buf_kexec_setup (void ) +{ +VMCOREINFO_SYMBOL (log_buf); +VMCOREINFO_SYMBOL (log_end); +} +
Will it be an issue if we make log_buf and log_end non static and directly access these in kexec.c?
Thanks
Vivek
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore
file without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.
Quoted 4 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
Or: Just include the address of the kallsyms buffer in the VMCOREINFO, and you even can extract the System.map from the memory, no need to have System.map files copied.
Yes, that's the same amount of addition in the initrd, but it opens more possibilities than just the log buffer.
Bernhard
Signature · 6 lines
Bernhard Walle, SUSE Linux Products GmbH, Architecture Development _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.
Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols. log_buf and log_end are static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.
Quoted 5 lines
<snip>
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?
I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out the log_buf_setup function, and let that be that. It seems more consice to me this way.
Regards
Neil
Quoted 3 lines
Thanks
Vivek
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Vivek Goyal
Acked-byQuoted 22 lines · Neil Horman
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols.
log_bufandlog_endare static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.Quoted 2 lines
<snip>
Quoted 9 lines
Quoted 3 lines
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables
CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out thelog_buf_setupfunction, and let that be that. It seems more consice to me this way.
Makes sense to me.
Thanks
Vivek
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Andrew Morton
maintainerQuoted 33 lines · On Tue, 20 Jan 2009 10:22:56 -0500 Vivek Goyal <[email protected]> wrote:
Quoted 22 lines · Neil Horman
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols.
log_bufandlog_endare static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.Quoted 2 lines
<snip>
Quoted 9 lines
Quoted 3 lines
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables
CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out thelog_buf_setupfunction, and let that be that. It seems more consice to me this way.
Quoted 4 lines
Makes sense to me.
Acked-by Vivek Goyal <[email protected]>
I rewrote the title to
kexec: add dmesg log symbols to /proc/vmcoreinfo lists
it's nice to identify which subsystem is responsible for a patch.
I also did all the below. Please check it. (Is anyone else reading all this stuff??)
From: Andrew Morton <[email protected]>
- switch didnt-need-to-be-a-macro to inline
- Remove unneeded ifdefs (we already did that in the header)
- repair bouncy enter key
---
include/linux/kernel.h | 5 ++++- kernel/kexec.c | 2 -- kernel/printk.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-)
include/linux/kernel.h renamed from include/linux/kernel.h~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +4 -1
@@ -254,7 +254,10 @@ static inline int printk_ratelimit(void)static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } -#define log_buf_kexec_setup () do {} while(0) + +static inline void log_buf_kexec_setup (void ) +{ +}#endif extern int printk_needs_cpu (int cpu);
kernel/kexec.c renamed from kernel/kexec.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0 -2
@@ -1409,9 +1409,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_OFFSET (list_head, prev);VMCOREINFO_OFFSET (vm_struct, addr);VMCOREINFO_LENGTH (zone.free_area,MAX_ORDER ); -#ifdef CONFIG_PRINTK log_buf_kexec_setup (); -#endif VMCOREINFO_LENGTH (free_area.free_list,MIGRATE_TYPES );VMCOREINFO_NUMBER (NR_FREE_PAGES );VMCOREINFO_NUMBER (PG_lru);
kernel/printk.c renamed from kernel/printk.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0 -1
@@ -143,7 +143,6 @@ void log_buf_kexec_setup(void)VMCOREINFO_SYMBOL (log_end); } -static int __init log_buf_len_setup (char *str) {unsigned size =memparse (str, &str);
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 40 lines · Andrew Morton
Quoted 33 lines · On Tue, 20 Jan 2009 10:22:56 -0500 Vivek Goyal <[email protected]> wrote:
Quoted 22 lines · Neil Horman
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols.
log_bufandlog_endare static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.Quoted 2 lines
<snip>
Quoted 9 lines
Quoted 3 lines
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables
CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out thelog_buf_setupfunction, and let that be that. It seems more consice to me this way.Quoted 4 lines
Makes sense to me.
Acked-by Vivek Goyal <[email protected]>
Quoted 10 lines
I rewrote the title to
kexec: add dmesg log symbols to
/proc/vmcoreinfolistsit's nice to identify which subsystem is responsible for a patch.
I also did all the below. Please check it. (Is anyone else reading all this stuff??)
Hey Andrew-
Yes, that all looks fine, thank. I'm not sure of the advantage of an
inline over a #define in the event that CONFIG_PRINTK isn't defined, but its fine with me either way.
Much appreciated!
Neil
Quoted 1 line
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 56 lines · Andrew Morton
Quoted 33 lines · On Tue, 20 Jan 2009 10:22:56 -0500 Vivek Goyal <[email protected]> wrote:
Quoted 22 lines · Neil Horman
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols.
log_bufandlog_endare static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.Quoted 2 lines
<snip>
Quoted 9 lines
Quoted 3 lines
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables
CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out thelog_buf_setupfunction, and let that be that. It seems more consice to me this way.Quoted 4 lines
Makes sense to me.
Acked-by Vivek Goyal <[email protected]>I rewrote the title to
kexec: add dmesg log symbols to
/proc/vmcoreinfolistsit's nice to identify which subsystem is responsible for a patch.
I also did all the below. Please check it. (Is anyone else reading all this stuff??)
From: Andrew Morton <[email protected]>
- switch didnt-need-to-be-a-macro to inline
- Remove unneeded ifdefs (we already did that in the header)
Quoted 8 lines
- repair bouncy enter key
Cc Neil Horman <[email protected]>Cc Simon Horman <[email protected]>Cc Vivek Goyal <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Hi Andrew,
This looks good. I should have altleast caught unnecessary #ifdefs.:-(
Thanks
Vivek
Quoted 44 lines
include/linux/kernel.h | 5 ++++- kernel/kexec.c | 2 -- kernel/printk.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-)diff -puN
include/linux/kernel.h~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixinclude/linux/kernel.hinclude/linux/kernel.h renamed from include/linux/kernel.h~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +4
-1@@ -254,7 +254,10 @@ static inline int printk_ratelimit(void)static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } -#define log_buf_kexec_setup () do {} while(0) + +static inline void log_buf_kexec_setup (void ) +{ +}#endif extern int printk_needs_cpu (int cpu);diff -puN
kernel/kexec.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixkernel/kexec.ckernel/kexec.c renamed from kernel/kexec.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0
-2@@ -1409,9 +1409,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_OFFSET (list_head, prev);VMCOREINFO_OFFSET (vm_struct, addr);VMCOREINFO_LENGTH (zone.free_area,MAX_ORDER ); -#ifdef CONFIG_PRINTK log_buf_kexec_setup (); -#endif VMCOREINFO_LENGTH (free_area.free_list,MIGRATE_TYPES );VMCOREINFO_NUMBER (NR_FREE_PAGES );VMCOREINFO_NUMBER (PG_lru);diff -puN
kernel/printk.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixkernel/printk.ckernel/printk.c renamed from kernel/printk.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0
-1@@ -143,7 +143,6 @@ void log_buf_kexec_setup(void)VMCOREINFO_SYMBOL (log_end); } -static int __init log_buf_len_setup (char *str) {unsigned size =memparse (str, &str);
Quoted 1 line
_
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 40 lines · Andrew Morton
Quoted 33 lines · On Tue, 20 Jan 2009 10:22:56 -0500 Vivek Goyal <[email protected]> wrote:
Quoted 22 lines · Neil Horman
Quoted 9 lines · Vivek Goyal
Quoted 7 lines · Neil Horman
Hey all-
It would be nice to be able to extract the dmesg log from a vmcore file
without needing to keep the debug symbols for the running kernel handy all the time. We have a facility to do this in/proc/vmcore. This patch adds thelog_bufandlog_endsymbols to the vmcoreinfo area so that tools (like makedumpfile) can easily extract the dmesg logs from a vmcore image.Quoted 5 lines
It would be nice to get dmesg log if debug symbols are not around. Can't we use System.map for getting symbol addresses? vmcoreinfo had started small and seems to be growing now. I am thinking down the line will making use of System.map for such cases make sense?
System.map only include exported and public symbols.
log_bufandlog_endare static, and not reported in the System.map. Its a nice idea, but not comprehensive for everything in the kernel.Quoted 2 lines
<snip>
Quoted 9 lines
Quoted 3 lines
Will it be an issue if we make
log_bufandlog_endnon static and directly access these inkexec.c?I had considered that, but was a bit hesitant to do so, since it exposes the internal implementation of the dmesg buffer. In the event someone disables
CONFIG_PRINTK, thats just more code we need to ifdef. With this implementation we just stub out thelog_buf_setupfunction, and let that be that. It seems more consice to me this way.Quoted 4 lines
Makes sense to me.
Acked-by Vivek Goyal <[email protected]>
Quoted 8 lines
I rewrote the title to
kexec: add dmesg log symbols to
/proc/vmcoreinfolistsit's nice to identify which subsystem is responsible for a patch.
I also did all the below. Please check it. (Is anyone else reading all this stuff??)
These look fine to me. Unfortunately they don't apply to the version of Linus' tree that I have checked out and I'm away from net access at this moment (though obviously not by the time this message reaches you). I'll update my tree and check once I'm back online.
Eric Biederman usually watches kexec stuff. I'm pretty sure he is on the kexec mailing list, but I've CCed him anyway.
Quoted 59 lines
From: Andrew Morton <[email protected]>
- switch didnt-need-to-be-a-macro to inline
- Remove unneeded ifdefs (we already did that in the header)
- repair bouncy enter key
Cc Neil Horman <[email protected]>Cc Simon Horman <[email protected]>Cc Vivek Goyal <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
include/linux/kernel.h | 5 ++++- kernel/kexec.c | 2 -- kernel/printk.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-)diff -puN
include/linux/kernel.h~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixinclude/linux/kernel.hinclude/linux/kernel.h renamed from include/linux/kernel.h~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +4
-1@@ -254,7 +254,10 @@ static inline int printk_ratelimit(void)static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } -#define log_buf_kexec_setup () do {} while(0) + +static inline void log_buf_kexec_setup (void ) +{ +}#endif extern int printk_needs_cpu (int cpu);diff -puN
kernel/kexec.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixkernel/kexec.ckernel/kexec.c renamed from kernel/kexec.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0
-2@@ -1409,9 +1409,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_OFFSET (list_head, prev);VMCOREINFO_OFFSET (vm_struct, addr);VMCOREINFO_LENGTH (zone.free_area,MAX_ORDER ); -#ifdef CONFIG_PRINTK log_buf_kexec_setup (); -#endif VMCOREINFO_LENGTH (free_area.free_list,MIGRATE_TYPES );VMCOREINFO_NUMBER (NR_FREE_PAGES );VMCOREINFO_NUMBER (PG_lru);diff -puN
kernel/printk.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fixkernel/printk.ckernel/printk.c renamed from kernel/printk.c~kexec-add-dmesg-log-symbols-to-proc-vmcoreinfo-lists-fix +0
-1@@ -143,7 +143,6 @@ void log_buf_kexec_setup(void)VMCOREINFO_SYMBOL (log_end); } -static int __init log_buf_len_setup (char *str) {unsigned size =memparse (str, &str);_
Signature · 3 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en
Quoted 10 lines · Simon Horman
Quoted 2 lines
I also did all the below. Please check it. (Is anyone else reading all this stuff??)
These look fine to me. Unfortunately they don't apply to the version of Linus' tree that I have checked out and I'm away from net access at this moment (though obviously not by the time this message reaches you). I'll update my tree and check once I'm back online.
Eric Biederman usually watches kexec stuff. I'm pretty sure he is on the kexec mailing list, but I've CCed him anyway.
Thanks.
The question at head seems to be does it make sense to always export log_buf and log_end in the VMCOREINFO section of the core file we generate.
The premise of VMCOREINFO is that it gives crash or other analysis tools enough information to pair a core dump with a vmlinux and decipher the page table layout. In general things that are tricky to infer from just the core dump, and the vmlinux.
Do log_buf and log_end fall in that category?
They are certainly important enough and they are symbols that are tricky to find. That said I think we should also have this information exported so that we can get at
it with kgdb, jtag debuggers, and other weird debugging tools. Do we have that already? It doesn't look like it. That may be an argument for a different interface.
That aside we aren't currently exporting log_buf_len, so I don't think this code works actually works.
Neil can you add a comment in kernel/printk.c of the algorithm necessary for external tools to decode the ring buffer?
We need the comment because people working on kernel/printk.c need to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.
Eric
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.
Quoted 8 lines
Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.
Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on printk.c will know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standard PAGE_SIZE configuration, and lets us detect and handle buffer wraps.
Thanks!
printk.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
kernel/printk.c +11 -1
@@ -138,10 +138,20 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like +* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file +* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf); -VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 13 lines · Neil Horman
Quoted 4 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.Quoted 8 lines
Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.
Quoted 6 lines
Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on
printk.cwill know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standardPAGE_SIZEconfiguration, and lets us detect and handle buffer wraps.
Looks like a good start but what is the algorithm for using the variables? Given a kernel core file how do you extract the dmesg ring buffer?
It still does not appear obvious to me that you are extracting the dmesg ring buffer correctly or easily.
Eric
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 22 lines · Eric W. Biederman
Quoted 13 lines · Neil Horman
Quoted 4 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.Quoted 8 lines
Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.Quoted 6 lines
Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on
printk.cwill know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standardPAGE_SIZEconfiguration, and lets us detect and handle buffer wraps.
Quoted 3 lines
Looks like a good start but what is the algorithm for using the variables? Given a kernel core file how do you extract the dmesg ring buffer?
Its the same as for every other symbol in vmcoreinfo:
1) kexec copies the symbol info for each symbol specified from /sys/kernel/vmcoreinfo to an ELF note in the vmcore pre-defined header when the kexec kernel is loaded into protected memory
2) on a crash, that ELF note is saved to the vmcore file along with the rest of the data
3) apps (in this case makedumpfile) reads that ELF note so it knows where to seek into the vmcore file to find the contents of that symbol.
Quoted 3 lines
It still does not appear obvious to me that you are extracting the dmesg ring buffer correctly or easily.
You know this patch doesn't do that right? The functionality for that is in a user app (in this case makedumpfile). I have a patch here:
https://sourceforge.net/tracker/index.php?func=detail&aid=2521075&group_id=178938&atid=887142
for makedumpfile that uses this symbol info to extract the dmesg log quite well. ken'ichi has an updated version to be posted soon which handles ring wrap and log sizes > PAGE_SIZE as well.
Neil
Quoted 7 lines
Eric
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Neil,
Thank you for a kernel patch and a makedumpfile patch.
Quoted 41 lines · Neil Horman
Quoted 11 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on
printk.cwill know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standardPAGE_SIZEconfiguration, and lets us detect and handle buffer wraps.Thanks!
printk.c| 12 +++++++++++-1 file changed, 11 insertions(+), 1 deletion(-)Signed-off-by Neil Horman <[email protected]>kernel/printk.c +7
-0@@ -138,10 +138,20 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like +* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file
kernel/printk.c static int log_buf_len = __LOG_BUF_LEN; · line 156
Quoted 10 lines
kernel/printk.c +4
-1+* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf); -VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif
Please do not remove VMCOREINFO_SYMBOL(log_end), because makedumpfile needs it for knowing the latest log offset in ring buffer of dmesg. I updated a makedumpfile patch for handling ring buffer, and it is possible to download the latest patch from the following site:
https://sourceforge.net/tracker2/download.php?group_id=178938&atid=887142&file_id=312113&aid=2521075
Thanks
Ken'ichi Ohmichi
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 63 lines · Ken'ichi Ohmichi
Hi Neil,
Thank you for a kernel patch and a makedumpfile patch.
Quoted 41 lines · Neil Horman
Quoted 11 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on
printk.cwill know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standardPAGE_SIZEconfiguration, and lets us detect and handle buffer wraps.Thanks!
printk.c| 12 +++++++++++-1 file changed, 11 insertions(+), 1 deletion(-)Signed-off-by Neil Horman <[email protected]>kernel/printk.c +7
-0@@ -138,10 +138,20 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like +* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file kernel/printk.c static int log_buf_len = __LOG_BUF_LEN; · line 156
Quoted 10 lines
kernel/printk.c +4
-1+* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf); -VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif Please do not remove
VMCOREINFO_SYMBOL(log_end), because makedumpfile needs it for knowing the latest log offset in ring buffer of dmesg. I updated a makedumpfile patch for handling ring buffer, and it is possible to download the latest patch from the following site:
Quoted 2 lines
https://sourceforge.net/tracker2/download.php?group_id=178938&atid=887142&file_id=312113&aid=2521075
Understood, new patch attached.
Add some comments and extra symbols on top of whats there for kernel/printk.c to satisfy Erics requests, and support Ken'ichi's enhanced version of the makedumpfile patch
Neil
printk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
kernel/printk.c +11 -0
@@ -138,10 +138,21 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like +* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file +* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf);VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 87 lines · Neil Horman
Quoted 63 lines · Ken'ichi Ohmichi
Hi Neil,
Thank you for a kernel patch and a makedumpfile patch.
Quoted 41 lines · Neil Horman
Quoted 11 lines
That aside we aren't currently exporting
log_buf_len, so I don't think this code works actually works.Neil can you add a comment in
kernel/printk.cof the algorithm necessary for external tools to decode the ring buffer?We need the comment because people working on
kernel/printk.cneed to know what is happening and without having to review lots of user space code, and we need the comment to verify that we are exporting the right things.Ok, as per Erics comment, I've written this. It applies on top of whats already in your tree Andrew. It adds some comments on the function in question so that anyone working on
printk.cwill know why we're exporting their symbols. It also modifies slightly the symbols we are exporting so that we can handle dmesg buffers that are longer than the standardPAGE_SIZEconfiguration, and lets us detect and handle buffer wraps.Thanks!
printk.c| 12 +++++++++++-1 file changed, 11 insertions(+), 1 deletion(-)Signed-off-by Neil Horman <[email protected]>kernel/printk.c +7
-0@@ -138,10 +138,20 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like +* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file kernel/printk.c static int log_buf_len = __LOG_BUF_LEN; · line 156
Quoted 10 lines
kernel/printk.c +4
-1+* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf); -VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif Please do not remove
VMCOREINFO_SYMBOL(log_end), because makedumpfile needs it for knowing the latest log offset in ring buffer of dmesg. I updated a makedumpfile patch for handling ring buffer, and it is possible to download the latest patch from the following site:Quoted 2 lines
https://sourceforge.net/tracker2/download.php?group_id=178938&atid=887142&file_id=312113&aid=2521075
Understood, new patch attached.
Add some comments and extra symbols on top of whats there for
kernel/printk.cto satisfy Erics requests, and support Ken'ichi's enhanced version of the makedumpfile patchNeil
Signed-off-by Neil Horman <[email protected]>printk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)kernel/printk.c +0
-0
kernel/printk.c static int log_buf_len = __LOG_BUF_LEN; · line 143
Quoted 6 lines
kernel/printk.c +3
-0@@ -138,10 +138,21 @@ static int log_buf_len = __LOG_BUF_LEN;static unsigned logged_chars;/* Number of chars produced since last read+clear operation */ #ifdef CONFIG_KEXEC +/* +* This appends the listed symbols to /proc/vmcoreinfo +* /proc/vmcoreinfo is used by various utiilties, like
Utilities appears to have a typo.
Quoted 14 lines
kernel/printk.c +8
-0+* crash and makedumpfile to obtain access to symbols that +* are otherwise very difficult to locate. These symbols +* are specifically used so that utilities +* can access and extract the dmesg log from a vmcore file +* after a crash +*/ void log_buf_kexec_setup (void ) {VMCOREINFO_SYMBOL (log_buf);VMCOREINFO_SYMBOL (log_end); +VMCOREINFO_SYMBOL (log_buf_len); + VMCOREINFO_SYMBOL(logged_chars) }#endif
Signature · 9 lines
Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec