Skip to content
  • Steven Rostedt's avatar
    ftrace: Do not disable interrupts for modules in mcount update · 4376cac6
    Steven Rostedt authored
    
    
    When I mounted an NFS directory, it caused several modules to be loaded. At the
    time I was running the preemptirqsoff tracer, and it showed the following
    output:
    
    # tracer: preemptirqsoff
    #
    # preemptirqsoff latency trace v1.1.5 on 2.6.33.9-rt30-mrg-test
    # --------------------------------------------------------------------
    # latency: 1177 us, #4/4, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
    #    -----------------
    #    | task: modprobe-19370 (uid:0 nice:0 policy:0 rt_prio:0)
    #    -----------------
    #  => started at: ftrace_module_notify
    #  => ended at:   ftrace_module_notify
    #
    #
    #                  _------=> CPU#
    #                 / _-----=> irqs-off
    #                | / _----=> need-resched
    #                || / _---=> hardirq/softirq
    #                ||| / _--=> preempt-depth
    #                |||| /_--=> lock-depth
    #                |||||/     delay
    #  cmd     pid   |||||| time  |   caller
    #     \   /      ||||||   \   |   /
    modprobe-19370   3d....    0us!: ftrace_process_locs <-ftrace_module_notify
    modprobe-19370   3d.... 1176us : ftrace_process_locs <-ftrace_module_notify
    modprobe-19370   3d.... 1178us : trace_hardirqs_on <-ftrace_module_notify
    modprobe-19370   3d.... 1178us : <stack trace>
     => ftrace_process_locs
     => ftrace_module_notify
     => notifier_call_chain
     => __blocking_notifier_call_chain
     => blocking_notifier_call_chain
     => sys_init_module
     => system_call_fastpath
    
    That's over 1ms that interrupts are disabled on a Real-Time kernel!
    
    Looking at the cause (being the ftrace author helped), I found that the
    interrupts are disabled before the code modification of mcounts into nops. The
    interrupts only need to be disabled on start up around this code, not when
    modules are being loaded.
    
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    4376cac6