• Joel Fernandes (Google)'s avatar
    lib: Add module for testing preemptoff/irqsoff latency tracers · f96e8577
    Joel Fernandes (Google) authored
    Here we introduce a test module for introducing a long preempt or irq
    disable delay in the kernel which the preemptoff or irqsoff tracers can
    detect. This module is to be used only for test purposes and is default
    disabled.
    
    Following is the expected output (only briefly shown) that can be parsed
    to verify that the tracers are working correctly. We will use this from
    the kselftests in future patches.
    
    For the preemptoff tracer:
    
    echo preemptoff > /d/tracing/current_tracer
    sleep 1
    insmod ./preemptirq_delay_test.ko test_mode=preempt delay=500000
    sleep 1
    bash-4.3# cat /d/tracing/trace
    preempt -1066    2...2    0us@: preemptirq_delay_run <-preemptirq_delay_run
    preempt -1066    2...2 500002us : preemptirq_delay_run <-preemptirq_delay_run
    preempt -1066    2...2 500004us : tracer_preempt_on <-preemptirq_delay_run
    preempt -1066    2...2 500012us : <stack trace>
     => kthread
     => ret_from_fork
    
    For the irqsoff tracer:
    
    echo irqsoff > /d/tracing/current_tracer
    sleep 1
    insmod ./preemptirq_delay_test.ko test_mode=irq delay=500000
    sleep 1
    bash-4.3# cat /d/tracing/trace
    irq dis -1069    1d..1    0us@: preemptirq_delay_run
    irq dis -1069    1d..1 500001us : preemptirq_delay_run
    irq dis -1069    1d..1 500002us : tracer_hardirqs_on <-preemptirq_delay_run
    irq dis -1069    1d..1 500005us : <stack trace>
     => ret_from_fork
    
    Link: http://lkml.kernel.org/r/20180712213611.GA8743@joelaf.mtv.corp.google.com
    
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Byungchul Park <byungchul.park@lge.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Julia Cartwright <julia@ni.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Thomas Glexiner <tglx@linutronix.de>
    Cc: Todd Kjos <tkjos@google.com>
    Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
    [ Erick is a co-developer of this commit ]
    Signed-off-by: default avatarErick Reyes <erickreyes@google.com>
    Signed-off-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    f96e8577
preemptirq_delay_test.c 1.63 KB