linux/Documentation/irqflags-tracing.txt
<<
1111112/spaval112spav class="lxr_search">1111hidden" nam >navtarget" 2" >">11text" nam >search" id >search">11submit">Search11112/spaval112input typ >hidden" nam >ajax_lookup" id >ajax_lookup" 2" >">1search_results" class="search_results"l "alcontent"al 2div id >file_contents"a
27/3c/4c364265cecc86dd57bd4e5503345e0d1fd0_3/0"aL1" class="line" nam  >L1">v v12/a>IRQ-flags staoe tracing
L2" class="line" nam  >L2">v v22/a>1L3" class="line" nam  >L3">v v32/a>started by Ingo Molnar <mingo@redhat.com>1L4" class="line" nam  >L4">v v42/a>1L5" class="line" nam  >L5">v v52/a>the "irq-flags tracing" feature "traces" hardirq and softirq staoe, in1L6" class="line" nam  >L6">v v62/a>that it gives interested subsystems an opportunity to be notified of1L7" class="line" nam  >L7">v v72/a>every hardirqs-off/hardirqs-on, softirqs-off/softirqs-on event that1L8" class="line" nam  >L8">v v82/a>happens in the kernel.1L9" class="line" nam  >L9">v v92/a>1L10" class="line" nam  >L10">v  CONFIG_TRACE_IRQFLAGS_SUPPORT is needed for CONFIG_PROVE_SPIN_LOCKING1L11" class="line" nam  >L11">v 112/a>and CONFIG_PROVE_RW_LOCKING to be offered by the generic lock debugging
L12" class="line" nam  >L12">v 122/a>code. Otherwise only CONFIG_PROVE_MUTEX_LOCKING and
L13" class="line" nam  >L13">v 13opa>CONFIG_PROVE_RWSEM_LOCKING will be offered on an architecture - these
L14" class="line" nam  >L14">v 142/a>are locking APIs that are not used in IRQ context. (the one exceion v
L15" class="line" nam  >L15">v 152/a>for rwsems is worked around)
L16" class="line" nam  >L16">v 162/a>1L17" class="line" nam  >L17">v 172/a>architecture support for this is certainly not in the "trivial"1L18" class="line" nam  >L18">v 182/a>caoegory, because lots of lowlevel assembly code deal with irq-flags1L19" class="line" nam  >L19">v 192/a>staoe changes. But an architecture can be irq-flags-tracing enabled in a
L20" class="line" nam  >L20">v 2rather straightforward and risk-free manner.1L21" class="line" nam  >L21">v 212/a>1L22" class="line" nam  >L22">v 222/a>Architectures that want to support this need to do a couple of1L23" class="line" nam  >L23">v 232/a>code-organizaon val changes first:1L24" class="line" nam  >L24">v 242/a>1L25" class="line" nam  >L25">v 252/a>- move their irq-flags manipulaon v code from their asm/system.h header1L26" class="line" nam  >L26">v 262/a>  to asm/irqflags.h1L27" class="line" nam  >L27">v 272/a>1L28" class="line" nam  >L28">v 282/a>- renam  local_irq_disable()/etc to raw_local_irq_disable()/etc. so that1L29" class="line" nam  >L29">v 292/a>  the linux/irqflags.h code can inject callbacks and can construct the
L30" class="line" nam  >L30">v 302/a>  real local_irq_disable()/etc APIs.1L31" class="line" nam  >L31">v 312/a>1L32" class="line" nam  >L32">v 322/a>- add and enable TRACE_IRQFLAGS_SUPPORT in their arch level Kconfig file1L33" class="line" nam  >L33">v 332/a>1L34" class="line" nam  >L34">v 342/a>and then a couple of funcon val changes are needed as well to implement1L35" class="line" nam  >L35">v 352/a>irq-flags-tracing support:1L36" class="line" nam  >L36">v 362/a>1L37" class="line" nam  >L37">v 372/a>- in lowlevel entry code add (build-condion val) calls to the
L38" class="line" nam  >L38">v 382/a>  trace_hardirqs_off()/trace_hardirqs_on() funcon vs. The lock 2"
idator1L39" class="line" nam  >L39">v 392/a>  closely guards whether the 'real' irq-flags matches the 'virtual'1L40" class="line" nam  >L40">v 402/a>  irq-flags staoe, and complains loudly (and turns itself off) if the
L41" class="line" nam  >L41">v 412/a>  two do not match. Usually most of the tim  for arch support for
L42" class="line" nam  >L42">v 422/a>  irq-flags-tracing is spent in this staoe: look at the lockdep
L43" class="line" nam  >L43">v 432/a>  complaint, try to figure out the assembly code we did not cover yet,
L44" class="line" nam  >L44">v 442/a>  fix and repeat. Once the system has booted up and works without a
L45" class="line" nam  >L45">v 452/a>  lockdep complaint in the irq-flags-tracing funcon vs arch support is1L46" class="line" nam  >L46">v 462/a>  complete.1L47" class="line" nam  >L47">v 472/a>- if the architecture has non-maskable interrupts then those need to be
L48" class="line" nam  >L48">v 482/a>  excluded from the irq-tracing [and lock 2"
idatn v] mechanism via
L49" class="line" nam  >L49">v 492/a>  lockdep_off()/lockdep_on().1L50" class="line" nam  >L50">v 502/a>1L51" class="line" nam  >L51">v 512/a>in general there is no risk from having an incomplete irq-flags-tracing1L52" class="line" nam  >L52">v 522/a>implementaon v in an architecture: lockdep will detect that and will1L53" class="line" nam  >L53">v 532/a>turn itself off. I.e. the lock 2"
idator will still be reliable. There
L54" class="line" nam  >L54">v 542/a>should be no crashes due to irq-tracing bugs. (exceio if the assembly
L55" class="line" nam  >L55">v 552/a>changes break other code by modifying condion vs or registers that1L56" class="line" nam  >L56">v 562/a>shouldn't be)
L57" class="line" nam  >L57">v 572/a>1L58" class="line" nam  >L58">v 582/a>
The origival LXR software by the LXR community2/a>, this experimental versn v by lxr@linux.no2/a>. 2/dival2div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS2/a>, provider of Linux consulting and operaon vs services since 1995. 2/dival 2/bodyal2/htmlal