Re: [BUG] msr-trace.h:42 suspicious rcu_dereference_check() usage!

From: Andi Kleen
Date: Mon Nov 21 2016 - 13:37:07 EST

> It tries to be optimized. I "unoptimized" it a while back to pull out
> all the inlines that were done in the tracepoint itself. That is, the
> trace_<tracepoint>() function is inlined in the code itself. By
> breaking that up a bit, I was able to save a bunch of text because the
> tracepoints were bloating the kernel tremendously.

Just adding a few inlines won't fix the gigantic bloat that is currently
there. See the PT trace I posted earlier (it was even truncated, it's
actually worse). Just a single enabled trace point took about a us.

POPF can cause some serializion but it won't be more than a few tens
of cycles, which would be a few percent at best.

Here is it again untruncated:

$ wc -l tracepoint-trace
640 tracepoint-trace
$ head -1 tracepoint-trace
[001] 264171.903577780: ffffffff810d6040 trace_event_raw_event_sched_switch push %rbp
$ tail -1 tracepoint-trace
[001] 264171.903578780: ffffffff810d6117 trace_event_raw_event_sched_switch ret

> There can be more optimization done too. But just because it's not
> optimized to the best it can be (which should be our goal) is not
> excuse to bloat it more with popf!

Ok so how should tracing in idle code work then in your opinion?