lkml.org 
[lkml]   [2015]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: linux-next: Tree for Feb 4
On Wed, 04 Feb 2015 23:14:55 -0800
Dave Hansen <dave@sr71.net> wrote:

> On 02/04/2015 05:53 PM, Sedat Dilek wrote:
> > The architecture-specific switch_mm() function can be called by offline
> > CPUs, but includes event tracing, which cannot be legally carried out
> > on offline CPUs. This results in a lockdep-RCU splat. This commit fixes
> > this splat by omitting the tracing when the CPU is offline.
> ...
> >>> >> > load_cr3(next->pgd);
> >>> >> > - trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
> >>> >> > + if (cpu_online(smp_processor_id()))
> >>> >> > + trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
>
> Is this, perhaps, something that we should be doing in the generic trace
> code so that all of the trace users don't have to worry about it? Also,
> this patch will add overhead to the code when tracing is off. It would
> be best if we could manage to make the cpu_online() check only in the
> cases where the tracepoint is on.

Note, we can move the check into the code that enables or disables
trace points. I believe, the rcu part of a tracepoint is only the call
to the callbacks. The jump_label part should be safe outside of rcu.

In that case, instead, have this, which does exactly the same thing
without having any overhead of the branch when tracing is disabled:

(not tested)

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h
index 13391d288107..040c1cdfe6d1 100644
--- a/include/trace/events/tlb.h
+++ b/include/trace/events/tlb.h
@@ -13,11 +13,13 @@
{ TLB_LOCAL_SHOOTDOWN, "local shootdown" }, \
{ TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" }

-TRACE_EVENT(tlb_flush,
+TRACE_EVENT_CONDITION(tlb_flush,

TP_PROTO(int reason, unsigned long pages),
TP_ARGS(reason, pages),

+ TP_CONDITION(cpu_online(smp_processor_id()),
+
TP_STRUCT__entry(
__field( int, reason)
__field(unsigned long, pages)

\
 
 \ /
  Last update: 2015-02-05 19:21    [W:0.077 / U:1.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site