lkml.org 
[lkml]   [2009]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: [PATCH 1/2] tracing: Add sysctl to enable/disable tracing on oops
    From
    Date
    On Wed, 2009-09-09 at 09:15 +0800, Li Zefan wrote:
    > Currently we always disable tracing on oops, and this patch
    > adds a sysctl so one can choose to enable it.

    Hmm, we already have a way to enable it.

    # echo 1 > /debug/tracing/tracing_on

    -- Steve

    >
    > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
    > ---
    > include/linux/kernel.h | 2 ++
    > kernel/panic.c | 3 ++-
    > kernel/sysctl.c | 10 ++++++++++
    > kernel/trace/ring_buffer.c | 2 ++
    > 4 files changed, 16 insertions(+), 1 deletions(-)
    >
    > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
    > index f61039e..5c4528f 100644
    > --- a/include/linux/kernel.h
    > +++ b/include/linux/kernel.h
    > @@ -516,12 +516,14 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
    > * Most likely, you want to use tracing_on/tracing_off.
    > */
    > #ifdef CONFIG_RING_BUFFER
    > +extern int trace_on_oops;
    > void tracing_on(void);
    > void tracing_off(void);
    > /* trace_off_permanent stops recording with no way to bring it back */
    > void tracing_off_permanent(void);
    > int tracing_is_on(void);
    > #else
    > +#define trace_on_oops 0
    > static inline void tracing_on(void) { }
    > static inline void tracing_off(void) { }
    > static inline void tracing_off_permanent(void) { }
    > diff --git a/kernel/panic.c b/kernel/panic.c
    > index 512ab73..22ec502 100644
    > --- a/kernel/panic.c
    > +++ b/kernel/panic.c
    > @@ -301,7 +301,8 @@ int oops_may_print(void)
    > */
    > void oops_enter(void)
    > {
    > - tracing_off();
    > + if (!trace_on_oops)
    > + tracing_off();
    > /* can't trust the integrity of the kernel anymore: */
    > debug_locks_off();
    > do_oops_enter_exit();
    > diff --git a/kernel/sysctl.c b/kernel/sysctl.c
    > index cdbe8d0..a768c15 100644
    > --- a/kernel/sysctl.c
    > +++ b/kernel/sysctl.c
    > @@ -537,6 +537,16 @@ static struct ctl_table kern_table[] = {
    > .proc_handler = &stack_trace_sysctl,
    > },
    > #endif
    > +#ifdef CONFIG_RING_BUFFER
    > + {
    > + .ctl_name = CTL_UNNUMBERED,
    > + .procname = "trace_on_oops",
    > + .data = &trace_on_oops,
    > + .maxlen = sizeof(int),
    > + .mode = 0644,
    > + .proc_handler = &proc_dointvec,
    > + },
    > +#endif
    > #ifdef CONFIG_TRACING
    > {
    > .ctl_name = CTL_UNNUMBERED,
    > diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
    > index 454e74e..fc10962 100644
    > --- a/kernel/trace/ring_buffer.c
    > +++ b/kernel/trace/ring_buffer.c
    > @@ -155,6 +155,8 @@ static unsigned long ring_buffer_flags __read_mostly = RB_BUFFERS_ON;
    >
    > #define BUF_PAGE_HDR_SIZE offsetof(struct buffer_data_page, data)
    >
    > +int trace_on_oops;
    > +
    > /**
    > * tracing_on - enable all tracing buffers
    > *



    \
     
     \ /
      Last update: 2009-09-09 03:37    [W:3.874 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site