blob: f6da05670e16d9dcfc3f8b7d50a1a4291ad8a974 [file] [log] [blame]
Ingo Molnar55df3142006-07-03 00:24:43 -07001IRQ-flags state tracing
2
3started by Ingo Molnar <mingo@redhat.com>
4
5the "irq-flags tracing" feature "traces" hardirq and softirq state, in
6that it gives interested subsystems an opportunity to be notified of
7every hardirqs-off/hardirqs-on, softirqs-off/softirqs-on event that
8happens in the kernel.
9
10CONFIG_TRACE_IRQFLAGS_SUPPORT is needed for CONFIG_PROVE_SPIN_LOCKING
11and CONFIG_PROVE_RW_LOCKING to be offered by the generic lock debugging
12code. Otherwise only CONFIG_PROVE_MUTEX_LOCKING and
13CONFIG_PROVE_RWSEM_LOCKING will be offered on an architecture - these
14are locking APIs that are not used in IRQ context. (the one exception
15for rwsems is worked around)
16
17architecture support for this is certainly not in the "trivial"
18category, because lots of lowlevel assembly code deal with irq-flags
19state changes. But an architecture can be irq-flags-tracing enabled in a
20rather straightforward and risk-free manner.
21
22Architectures that want to support this need to do a couple of
23code-organizational changes first:
24
Ingo Molnar55df3142006-07-03 00:24:43 -070025- add and enable TRACE_IRQFLAGS_SUPPORT in their arch level Kconfig file
26
27and then a couple of functional changes are needed as well to implement
28irq-flags-tracing support:
29
30- in lowlevel entry code add (build-conditional) calls to the
31 trace_hardirqs_off()/trace_hardirqs_on() functions. The lock validator
32 closely guards whether the 'real' irq-flags matches the 'virtual'
33 irq-flags state, and complains loudly (and turns itself off) if the
34 two do not match. Usually most of the time for arch support for
35 irq-flags-tracing is spent in this state: look at the lockdep
36 complaint, try to figure out the assembly code we did not cover yet,
37 fix and repeat. Once the system has booted up and works without a
38 lockdep complaint in the irq-flags-tracing functions arch support is
39 complete.
40- if the architecture has non-maskable interrupts then those need to be
41 excluded from the irq-tracing [and lock validation] mechanism via
42 lockdep_off()/lockdep_on().
43
44in general there is no risk from having an incomplete irq-flags-tracing
45implementation in an architecture: lockdep will detect that and will
46turn itself off. I.e. the lock validator will still be reliable. There
47should be no crashes due to irq-tracing bugs. (except if the assembly
48changes break other code by modifying conditions or registers that
Lucas De Marchi25985ed2011-03-30 22:57:33 -030049shouldn't be)
Ingo Molnar55df3142006-07-03 00:24:43 -070050