Re: [PATCH v7 2/2] tracing: Add support for preempt and irq enable/disable events

From: Steven Rostedt
Date: Fri Oct 06 2017 - 09:38:51 EST

On Fri, 6 Oct 2017 00:28:21 -0700
Joel Fernandes <joelaf@xxxxxxxxxx> wrote:

> Oh ok. So I traced this down to the original patch that added
> time_hardirqs_off to lockdep. I *think* it was added just to keep the
> irqsoff tracer working while lockdep is enabled, so that both lockdep
> and the tracer would work at the same time. So I guess nobody noticed
> any issues because nobody noticed or cared to check if irqsoff tracer
> showed the same results with lockdep enabled vs disabled.

As one of the main users of preemptirqsoff tracer, I can tell you that
we didn't care ;-)

Yes, it was added to keep them both working. It's dangerous to use
CALLER_ADDR1, as lockdep can be called by the top frame, and ADDR1
would go off the stack frame and cause a fault. I just put in ADDR0
as filler as it required something to be added.

We added a stack dump on new max latencies to figure out where the
problem occurred.

-- Steve

> I think the correct way this should be rewritten is lockdep should use
> register_trace_* to register callbacks onto the new tracepoints I'm
> adding. I am working on a patch that does something like this and gets
> rid of the time_* functions. I will try to have an RFC out by the
> weekend if I hopefully don't hit any roadblocks.
> thanks!
> - Joel