Fix: tracing: Centralize preemptirq tracepoints (4.19)
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 7 Sep 2018 16:21:13 +0000 (12:21 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 1 Oct 2018 17:58:41 +0000 (13:58 -0400)
See upstream commit:

  commit c3bc8fd637a9623f5c507bd18f9677effbddf584
  Author: Joel Fernandes (Google) <joel@joelfernandes.org>
  Date:   Mon Jul 30 15:24:23 2018 -0700

    tracing: Centralize preemptirq tracepoints and unify their usage

    This patch detaches the preemptirq tracepoints from the tracers and
    keeps it separate.

    Advantages:
    * Lockdep and irqsoff event can now run in parallel since they no longer
    have their own calls.

    * This unifies the usecase of adding hooks to an irqsoff and irqson
    event, and a preemptoff and preempton event.
      3 users of the events exist:
      - Lockdep
      - irqsoff and preemptoff tracers
      - irqs and preempt trace events

    The unification cleans up several ifdefs and makes the code in preempt
    tracer and irqsoff tracers simpler. It gets rid of all the horrific
    ifdeferry around PROVE_LOCKING and makes configuration of the different
    users of the tracepoints more easy and understandable. It also gets rid
    of the time_* function calls from the lockdep hooks used to call into
    the preemptirq tracer which is not needed anymore. The negative delta in
    lines of code in this patch is quite large too.

    In the patch we introduce a new CONFIG option PREEMPTIRQ_TRACEPOINTS
    as a single point for registering probes onto the tracepoints. With
    this,
    the web of config options for preempt/irq toggle tracepoints and its
    users becomes:

     PREEMPT_TRACER   PREEMPTIRQ_EVENTS  IRQSOFF_TRACER PROVE_LOCKING
           |                 |     \         |           |
           \    (selects)    /      \        \ (selects) /
          TRACE_PREEMPT_TOGGLE       ----> TRACE_IRQFLAGS
                          \                  /
                           \ (depends on)   /
                         PREEMPTIRQ_TRACEPOINTS

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/preemptirq.h

index 4f9be8549ee007ac3794791790aea45a00562fca..2fc81177cc3de8f7e941ba8ade021e132998c73e 100644 (file)
@@ -12,6 +12,9 @@
 #include <asm/sections.h>
 #include <probes/lttng-tracepoint-event.h>
 
+/*
+ * The preemptirq probe is built when CONFIG_PREEMPTIRQ_EVENTS is defined.
+ */
 
 LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template,
 
@@ -25,7 +28,19 @@ LTTNG_TRACEPOINT_EVENT_CLASS(preemptirq_template,
        )
 )
 
-#ifndef CONFIG_PROVE_LOCKING
+/*
+ * Tracing of irq enable / disable events is enabled
+ *   on >= 4.19 when CONFIG_TRACE_IRQFLAGS is defined.
+ *   on previous kernels when CONFIG_PROVE_LOCKING is NOT defined.
+ */
+#if defined(CONFIG_TRACE_IRQFLAGS)
+#define LTTNG_TRACE_IRQ
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0) && \
+       !defined(CONFIG_PROVE_LOCKING))
+#define LTTNG_TRACE_IRQ
+#endif
+
+#ifdef LTTNG_TRACE_IRQ
 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_disable,
 
        preemptirq_irq_disable,
@@ -43,9 +58,21 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, irq_enable,
 
        TP_ARGS(ip, parent_ip)
 )
-#endif /* !CONFIG_PROVE_LOCKING */
-
-#ifdef CONFIG_DEBUG_PREEMPT
+#endif /* LTTNG_TRACE_IRQ */
+
+/*
+ * Tracing of preempt enable / disable events is enabled
+ *   on >= 4.19 when CONFIG_TRACE_PREEMPT_TOGGLE is defined.
+ *   on previous kernels when CONFIG_DEBUG_PREEMPT is defined.
+ */
+#if defined(CONFIG_TRACE_PREEMPT_TOGGLE)
+#define LTTNG_TRACE_PREEMPT
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0) && \
+       defined(CONFIG_DEBUG_PREEMPT))
+#define LTTNG_TRACE_PREEMPT
+#endif
+
+#ifdef LTTNG_TRACE_PREEMPT
 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_disable,
 
        preemptirq_preempt_disable,
@@ -63,7 +90,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(preemptirq_template, preempt_enable,
 
        TP_ARGS(ip, parent_ip)
 )
-#endif /* CONFIG_DEBUG_PREEMPT */
+#endif /* LTTNG_TRACE_PREEMPT */
 
 #endif /* LTTNG_TRACE_PREEMPTIRQ_H */
 
This page took 0.026435 seconds and 4 git commands to generate.