Commit 038a0da6 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

lockdep: ipipe: make the logic aware of interrupt pipelining

The lockdep engine will check for the current interrupt state as part
of the locking validation process, which must encompass:

- the CPU interrupt state
- the current pipeline domain
- the virtual interrupt disable flag

so that we can traverse the tracepoints from any context sanely and

In addition trace_hardirqs_on_virt_caller() should be called by the
arch-dependent code when tracking the interrupt state before returning
to user-space after a kernel entry (exceptions, IRQ). This makes sure
that the tracking logic only applies to the root domain, and considers
the virtual disable flag exclusively.

For instance, the kernel may be entered when interrupts are (only)
virtually disabled for the root domain (i.e. stalled), and we should
tell the IRQ tracing logic that IRQs are about to be enabled back only
if the root domain is unstalled before leaving to user-space. In such
a context, the state of the interrupt bit in the CPU would be
parent 5b0d8c02
......@@ -2931,6 +2931,17 @@ __visible void trace_hardirqs_on_caller(unsigned long ip)
__visible void trace_hardirqs_on_virt_caller(unsigned long ip)
* The IRQ tracing logic only applies to the root domain, and
* must consider the virtual disable flag exclusively when
* leaving an interrupt/fault context.
if (ipipe_root_p && !raw_irqs_disabled())
void trace_hardirqs_on(void)
......@@ -160,12 +160,12 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
#define debug_atomic_inc(ptr) { \
WARN_ON_ONCE(!irqs_disabled()); \
WARN_ON_ONCE(!hard_irqs_disabled() && !irqs_disabled()); \
__this_cpu_inc(lockdep_stats.ptr); \
#define debug_atomic_dec(ptr) { \
WARN_ON_ONCE(!irqs_disabled()); \
WARN_ON_ONCE(!hard_irqs_disabled() && !irqs_disabled());\
__this_cpu_dec(lockdep_stats.ptr); \
......@@ -502,6 +502,12 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
__visible void trace_hardirqs_on_virt_caller(unsigned long caller_addr)
if (ipipe_root_p && !raw_irqs_disabled())
__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
if (ipipe_root_p && !preempt_trace() && irq_trace())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment