lkml.org 
[lkml]   [2008]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/3] tracing/ftrace: don't insert TRACE_PRINT during selftests
    2008/12/4 Steven Rostedt <rostedt@goodmis.org>:
    > The comment style should be:
    >
    > /*
    > * comment
    > * comment
    > * comment
    > */

    Sorry, will fix it.

    >
    >> +static atomic_t tracing_selftest_running = ATOMIC_INIT(0);
    >
    > Do we need that is atomic? Also, it needs to be __read_mostly.


    I thought it should be atomic to be sure the value is synchronized
    on smp when read. But actually that should have been more likely an
    int with smp_wb after writing it.

    >> +
    >> /* For tracers that don't implement custom flags */
    >> static struct tracer_opt dummy_tracer_opt[] = {
    >> { }
    >> @@ -589,6 +597,8 @@ int register_tracer(struct tracer *type)
    >> struct tracer *saved_tracer = current_trace;
    >> struct trace_array *tr = &global_trace;
    >> int i;
    >> +
    >> + atomic_set(&tracing_selftest_running, 1);
    >
    > Enable this in the mutex lock, and we could make it a normal int.
    >


    But ftrace_printk can be called from interrupt context. I think we can loose
    some TRACE_PRINT entries at the selftests time since the tracer are not enabled
    by the user at this time, except the boot tracer...

    >> /*
    >> * Run a selftest on this tracer.
    >> * Here we reset the trace buffer, and set the current
    >> @@ -603,6 +613,7 @@ int register_tracer(struct tracer *type)
    >> /* the test is responsible for initializing and enabling */
    >> pr_info("Testing tracer %s: ", type->name);
    >> ret = type->selftest(type, tr);
    >> + atomic_set(&tracing_selftest_running, 0);
    >> /* the test is responsible for resetting too */
    >> current_trace = saved_tracer;
    >> if (ret) {
    >> @@ -3594,7 +3605,7 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
    >> unsigned long flags, irq_flags;
    >> int cpu, len = 0, size, pc;
    >>
    >> - if (tracing_disabled)
    >> + if (tracing_disabled || atomic_read(&tracing_selftest_running))
    >> return 0;
    >>
    >> pc = preempt_count();
    >> --
    >
    > -- Steve
    >
    >


    \
     
     \ /
      Last update: 2008-12-05 00:05    [W:0.030 / U:0.132 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site