Commit d3f97ce8 authored by Philippe Gerum's avatar Philippe Gerum

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
safely.

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
irrelevant.
parent de021e7a
......@@ -160,12 +160,12 @@ DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
this_cpu_inc(lockdep_stats.ptr);
#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); \
}
......
......@@ -57,6 +57,22 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
}
EXPORT_SYMBOL(trace_hardirqs_on_caller);
__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 && !irqs_disabled())
trace_hardirqs_on_caller(ip);
}
__visible void trace_hardirqs_on_virt(void)
{
trace_hardirqs_on_virt_caller(CALLER_ADDR0);
}
__visible void trace_hardirqs_off_caller(unsigned long caller_addr)
{
if (ipipe_root_p && !this_cpu_read(tracing_irq_cpu)) {
......
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