Back to home page

LXR

 
 

    


0001 IRQ-flags state tracing
0002 
0003 started by Ingo Molnar <mingo@redhat.com>
0004 
0005 the "irq-flags tracing" feature "traces" hardirq and softirq state, in
0006 that it gives interested subsystems an opportunity to be notified of
0007 every hardirqs-off/hardirqs-on, softirqs-off/softirqs-on event that
0008 happens in the kernel.
0009 
0010 CONFIG_TRACE_IRQFLAGS_SUPPORT is needed for CONFIG_PROVE_SPIN_LOCKING
0011 and CONFIG_PROVE_RW_LOCKING to be offered by the generic lock debugging
0012 code. Otherwise only CONFIG_PROVE_MUTEX_LOCKING and
0013 CONFIG_PROVE_RWSEM_LOCKING will be offered on an architecture - these
0014 are locking APIs that are not used in IRQ context. (the one exception
0015 for rwsems is worked around)
0016 
0017 architecture support for this is certainly not in the "trivial"
0018 category, because lots of lowlevel assembly code deal with irq-flags
0019 state changes. But an architecture can be irq-flags-tracing enabled in a
0020 rather straightforward and risk-free manner.
0021 
0022 Architectures that want to support this need to do a couple of
0023 code-organizational changes first:
0024 
0025 - add and enable TRACE_IRQFLAGS_SUPPORT in their arch level Kconfig file
0026 
0027 and then a couple of functional changes are needed as well to implement
0028 irq-flags-tracing support:
0029 
0030 - in lowlevel entry code add (build-conditional) calls to the
0031   trace_hardirqs_off()/trace_hardirqs_on() functions. The lock validator
0032   closely guards whether the 'real' irq-flags matches the 'virtual'
0033   irq-flags state, and complains loudly (and turns itself off) if the
0034   two do not match. Usually most of the time for arch support for
0035   irq-flags-tracing is spent in this state: look at the lockdep
0036   complaint, try to figure out the assembly code we did not cover yet,
0037   fix and repeat. Once the system has booted up and works without a
0038   lockdep complaint in the irq-flags-tracing functions arch support is
0039   complete.
0040 - if the architecture has non-maskable interrupts then those need to be
0041   excluded from the irq-tracing [and lock validation] mechanism via
0042   lockdep_off()/lockdep_on().
0043 
0044 in general there is no risk from having an incomplete irq-flags-tracing
0045 implementation in an architecture: lockdep will detect that and will
0046 turn itself off. I.e. the lock validator will still be reliable. There
0047 should be no crashes due to irq-tracing bugs. (except if the assembly
0048 changes break other code by modifying conditions or registers that
0049 shouldn't be)
0050