[PATCH] ftrace: ftrace_dump_on_oops=[tracer] - Kernel

This is a discussion on [PATCH] ftrace: ftrace_dump_on_oops=[tracer] - Kernel ; seems useful to debug crashes that happen before I read userspace. Signed-off-by: Peter Zijlstra --- diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index d2c115b..74c27ee 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -765,6 +765,10 @@ and is between 256 and 4096 characters. It is defined ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: [PATCH] ftrace: ftrace_dump_on_oops=[tracer]

  1. [PATCH] ftrace: ftrace_dump_on_oops=[tracer]

    seems useful to debug crashes that happen before I read userspace.

    Signed-off-by: Peter Zijlstra
    ---
    diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
    index d2c115b..74c27ee 100644
    --- a/Documentation/kernel-parameters.txt
    +++ b/Documentation/kernel-parameters.txt
    @@ -765,6 +765,10 @@ and is between 256 and 4096 characters. It is defined in the file
    parameter will force ia64_sal_cache_flush to call
    ia64_pal_cache_flush instead of SAL_CACHE_FLUSH.

    + ftrace_dump_on_oops=[tracer]
    + [ftrace] will dump the trace buffers on oops and
    + optionally set and start the specified tracer.
    +
    gamecon.map[2|3]=
    [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
    support via parallel port (up to 5 devices per port)
    diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
    index 5b8c90d..41845ef 100644
    --- a/kernel/trace/trace.c
    +++ b/kernel/trace/trace.c
    @@ -79,9 +79,12 @@ static int tracing_disabled = 1;
    */
    int ftrace_dump_on_oops;

    +static int tracing_set_tracer(char *buf);
    +
    static int __init set_ftrace_dump_on_oops(char *str)
    {
    ftrace_dump_on_oops = 1;
    + tracing_set_tracer(str);
    return 1;
    }
    __setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
    @@ -2394,29 +2397,11 @@ tracing_set_trace_read(struct file *filp, char __user *ubuf,
    return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
    }

    -static ssize_t
    -tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    - size_t cnt, loff_t *ppos)
    +static int tracing_set_tracer(char *buf)
    {
    struct trace_array *tr = &global_trace;
    struct tracer *t;
    - char buf[max_tracer_type_len+1];
    - int i;
    - size_t ret;
    -
    - ret = cnt;
    -
    - if (cnt > max_tracer_type_len)
    - cnt = max_tracer_type_len;
    -
    - if (copy_from_user(&buf, ubuf, cnt))
    - return -EFAULT;
    -
    - buf[cnt] = 0;
    -
    - /* strip ending whitespace. */
    - for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
    - buf[i] = 0;
    + int ret = 0;

    mutex_lock(&trace_types_lock);
    for (t = trace_types; t; t = t->next) {
    @@ -2440,6 +2425,33 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    out:
    mutex_unlock(&trace_types_lock);

    + return ret;
    +}
    +
    +static ssize_t
    +tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    + size_t cnt, loff_t *ppos)
    +{
    + char buf[max_tracer_type_len+1];
    + int i;
    + size_t ret;
    +
    + if (cnt > max_tracer_type_len)
    + cnt = max_tracer_type_len;
    +
    + if (copy_from_user(&buf, ubuf, cnt))
    + return -EFAULT;
    +
    + buf[cnt] = 0;
    +
    + /* strip ending whitespace. */
    + for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
    + buf[i] = 0;
    +
    + ret = tracing_set_tracer(buf);
    + if (!ret)
    + ret = cnt;
    +
    if (ret > 0)
    filp->f_pos += ret;



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH] ftrace: ftrace_dump_on_oops=[tracer]


    On Sat, 1 Nov 2008, Peter Zijlstra wrote:

    > seems useful to debug crashes that happen before I read userspace.


    Hmm, I think it might be better to separate this from the dump_on_oops.
    How about a ftrace_default_tracer parameter?

    If one is defined, it is activated as soon as it is initialized. This way
    we decouple the dump_on_oops, which we may not always want, and a way to
    start tracers before the switch to user space.

    -- Steve
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [PATCH] ftrace: ftrace_dump_on_oops=[tracer]

    On Sat, 2008-11-01 at 14:43 -0400, Steven Rostedt wrote:
    > On Sat, 1 Nov 2008, Peter Zijlstra wrote:
    >
    > > seems useful to debug crashes that happen before I read userspace.

    >
    > Hmm, I think it might be better to separate this from the dump_on_oops.
    > How about a ftrace_default_tracer parameter?
    >
    > If one is defined, it is activated as soon as it is initialized. This way
    > we decouple the dump_on_oops, which we may not always want, and a way to
    > start tracers before the switch to user space.


    Like so?

    ---
    Subject: ftrace: enable setting an ftrace tracer on boot

    In order to facilitate early boot trouble, allow one to specify a tracer
    on the kernel boot line.

    Signed-off-by: Peter Zijlstra
    ---
    diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
    index d2c115b..4d694fd 100644
    --- a/Documentation/kernel-parameters.txt
    +++ b/Documentation/kernel-parameters.txt
    @@ -765,6 +765,14 @@ and is between 256 and 4096 characters. It is defined in the file
    parameter will force ia64_sal_cache_flush to call
    ia64_pal_cache_flush instead of SAL_CACHE_FLUSH.

    + ftrace=[tracer]
    + [ftrace] will set and start the specified tracer
    + as early as possible in order to facilitate early
    + boot debugging.
    +
    + ftrace_dump_on_oops
    + [ftrace] will dump the trace buffers on oops.
    +
    gamecon.map[2|3]=
    [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
    support via parallel port (up to 5 devices per port)
    diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
    index 5b8c90d..a85187a 100644
    --- a/kernel/trace/trace.c
    +++ b/kernel/trace/trace.c
    @@ -79,6 +79,15 @@ static int tracing_disabled = 1;
    */
    int ftrace_dump_on_oops;

    +static int tracing_set_tracer(char *buf);
    +
    +static int __init set_ftrace(char *str)
    +{
    + tracing_set_tracer(str);
    + return 1;
    +}
    +__setup("ftrace", set_ftrace);
    +
    static int __init set_ftrace_dump_on_oops(char *str)
    {
    ftrace_dump_on_oops = 1;
    @@ -2394,29 +2403,11 @@ tracing_set_trace_read(struct file *filp, char __user *ubuf,
    return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
    }

    -static ssize_t
    -tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    - size_t cnt, loff_t *ppos)
    +static int tracing_set_tracer(char *buf)
    {
    struct trace_array *tr = &global_trace;
    struct tracer *t;
    - char buf[max_tracer_type_len+1];
    - int i;
    - size_t ret;
    -
    - ret = cnt;
    -
    - if (cnt > max_tracer_type_len)
    - cnt = max_tracer_type_len;
    -
    - if (copy_from_user(&buf, ubuf, cnt))
    - return -EFAULT;
    -
    - buf[cnt] = 0;
    -
    - /* strip ending whitespace. */
    - for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
    - buf[i] = 0;
    + int ret = 0;

    mutex_lock(&trace_types_lock);
    for (t = trace_types; t; t = t->next) {
    @@ -2440,6 +2431,33 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    out:
    mutex_unlock(&trace_types_lock);

    + return ret;
    +}
    +
    +static ssize_t
    +tracing_set_trace_write(struct file *filp, const char __user *ubuf,
    + size_t cnt, loff_t *ppos)
    +{
    + char buf[max_tracer_type_len+1];
    + int i;
    + size_t ret;
    +
    + if (cnt > max_tracer_type_len)
    + cnt = max_tracer_type_len;
    +
    + if (copy_from_user(&buf, ubuf, cnt))
    + return -EFAULT;
    +
    + buf[cnt] = 0;
    +
    + /* strip ending whitespace. */
    + for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
    + buf[i] = 0;
    +
    + ret = tracing_set_tracer(buf);
    + if (!ret)
    + ret = cnt;
    +
    if (ret > 0)
    filp->f_pos += ret;



    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. Re: [PATCH] ftrace: ftrace_dump_on_oops=[tracer]


    On Sat, 1 Nov 2008, Peter Zijlstra wrote:

    > On Sat, 2008-11-01 at 14:43 -0400, Steven Rostedt wrote:
    > > On Sat, 1 Nov 2008, Peter Zijlstra wrote:
    > >
    > > > seems useful to debug crashes that happen before I read userspace.

    > >
    > > Hmm, I think it might be better to separate this from the dump_on_oops.
    > > How about a ftrace_default_tracer parameter?
    > >
    > > If one is defined, it is activated as soon as it is initialized. This way
    > > we decouple the dump_on_oops, which we may not always want, and a way to
    > > start tracers before the switch to user space.

    >
    > Like so?


    Sure.

    >
    > ---
    > Subject: ftrace: enable setting an ftrace tracer on boot
    >
    > In order to facilitate early boot trouble, allow one to specify a tracer
    > on the kernel boot line.
    >
    > Signed-off-by: Peter Zijlstra


    Acked-by: Steven Rostedt

    -- Steve
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. Re: [PATCH] ftrace: ftrace_dump_on_oops=[tracer]


    * Steven Rostedt wrote:

    >
    > On Sat, 1 Nov 2008, Peter Zijlstra wrote:
    >
    > > On Sat, 2008-11-01 at 14:43 -0400, Steven Rostedt wrote:
    > > > On Sat, 1 Nov 2008, Peter Zijlstra wrote:
    > > >
    > > > > seems useful to debug crashes that happen before I read userspace.
    > > >
    > > > Hmm, I think it might be better to separate this from the dump_on_oops.
    > > > How about a ftrace_default_tracer parameter?
    > > >
    > > > If one is defined, it is activated as soon as it is initialized. This way
    > > > we decouple the dump_on_oops, which we may not always want, and a way to
    > > > start tracers before the switch to user space.

    > >
    > > Like so?

    >
    > Sure.
    >
    > >
    > > ---
    > > Subject: ftrace: enable setting an ftrace tracer on boot
    > >
    > > In order to facilitate early boot trouble, allow one to specify a tracer
    > > on the kernel boot line.
    > >
    > > Signed-off-by: Peter Zijlstra

    >
    > Acked-by: Steven Rostedt


    applied to tip/tracing/ftrace, thanks guys!

    Ingo
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread