lkml.org 
[lkml]   [2017]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tracing: Fix trace_preempt_{on,off} for !CONFIG_DEBUG_PREEMPT builds
Date
The new preempt enable/disable events introduced by:

d59158162 tracing: Add support for preempt and irq enable/disable events

are defined only for CONFIG_DEBUG_PREEMPT kernels when the
CONFIG_PREEMPTIRQ_EVENTS support, introduced by the above patch, is
enabled.

These events are generated within by trace_preempt_{on,off} calls,
which are part of the the "Preemption-off Latency Tracer"
(CONFIG_PREEMPT_TRACER).

Currently these calls are (correctly) generated on CONFIG_PREEMPT_TRACER
even when the kernel is !CONFIG_DEBUG_PREEMPT configured. Thus leading
to an undefined reference to the new trace events.

Let's ensure that we always have an (eventually) empty definition of the
events for CONFIG_PREEMPTIRQ_EVENTS kernels.

This patch will ensure that the additional preempt enabled/disable
events are generated only when we have both:
CONFIG_PREEMPT_TRACER && CONFIG_DEBUG_PREEMPT

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Alessio Balsini <alessio.balsini@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Linux-kernel@vger.kernel.org

---
Fix kernel compilation for this configuration:
!CONFIG_DEBUG_PREEMPT && CONFIG_PREEMPT_TRACER

To reproduce, e.g.
1. make defconfig
2. add:
CONFIG_PREEMPTIRQ_EVENTS=y
CONFIG_PREEMPT_TRACER=y
3. make kernel/trace/trace_irqsoff.o

For sake of consistency, this patch adds a default empty definition of
all the new trace events whenever CONFIG_PREEMPTIRQ_EVENTS is enabled
but the specific event's requirements are not satisfied.
This is complementary to the default empty definitions provided
for the !CONFIG_PREEMPTIRQ_EVENTS case.
---
include/trace/events/preemptirq.h | 10 ++++++++++
kernel/trace/trace_irqsoff.c | 3 +--
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h
index f5024c560d8f..500ad0a221d5 100644
--- a/include/trace/events/preemptirq.h
+++ b/include/trace/events/preemptirq.h
@@ -40,6 +40,11 @@ DEFINE_EVENT(preemptirq_template, irq_disable,
DEFINE_EVENT(preemptirq_template, irq_enable,
TP_PROTO(unsigned long ip, unsigned long parent_ip),
TP_ARGS(ip, parent_ip));
+#else
+#define trace_irq_disable(...)
+#define trace_irq_enable(...)
+#define trace_irq_disable_rcuidle(...)
+#define trace_irq_enable_rcuidle(...)
#endif

#ifdef CONFIG_DEBUG_PREEMPT
@@ -50,6 +55,11 @@ DEFINE_EVENT(preemptirq_template, preempt_disable,
DEFINE_EVENT(preemptirq_template, preempt_enable,
TP_PROTO(unsigned long ip, unsigned long parent_ip),
TP_ARGS(ip, parent_ip));
+#else
+#define trace_preempt_disable(...)
+#define trace_preempt_enable(...)
+#define trace_preempt_disable_rcuidle(...)
+#define trace_preempt_enable_rcuidle(...)
#endif

#endif /* _TRACE_PREEMPTIRQ_H */
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 03ecb4465ee4..9d62e5f30d58 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -848,8 +848,7 @@ inline void print_irqtrace_events(struct task_struct *curr)
}
#endif

-#if defined(CONFIG_PREEMPT_TRACER) || \
- (defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPTIRQ_EVENTS))
+#ifdef CONFIG_PREEMPT_TRACER
void trace_preempt_on(unsigned long a0, unsigned long a1)
{
trace_preempt_enable_rcuidle(a0, a1);
--
2.14.1
\
 
 \ /
  Last update: 2017-12-04 10:47    [W:0.085 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site