From: Patrick Bellasi <patrick.bellasi@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Joel Fernandes <joelaf@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Linux-kernel@vger.kernel.org
Subject: [PATCH] tracing: Fix trace_preempt_{on,off} for !CONFIG_DEBUG_PREEMPT builds
Date: Mon, 4 Dec 2017 09:46:42 +0000 [thread overview]
Message-ID: <20171204094642.6901-1-patrick.bellasi@arm.com> (raw)
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
next reply other threads:[~2017-12-04 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 9:46 Patrick Bellasi [this message]
2017-12-04 11:26 ` Steven Rostedt
2017-12-04 11:44 ` Patrick Bellasi
2017-12-05 16:41 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171204094642.6901-1-patrick.bellasi@arm.com \
--to=patrick.bellasi@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=joelaf@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome