Skip to contentSkip to conversation

tracing: always define trace_{irq,preempt}_{enable_disable}

PATCH Applied Arnd Bergmann 3 participants 5 messages Oct 19, 2017 – Oct 31, 2017 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: always define trace_{irq,preempt}_{enable_disable}

We get a build error in the irqsoff tracer in some configurations:

kernel/trace/trace_irqsoff.c: In function 'trace_preempt_on':
kernel/trace/trace_irqsoff.c:855:2: error: implicit declaration of function 'trace_preempt_enable_rcuidle'; did you mean 'trace_irq_enable_rcuidle'? [-Werror=implicit-function-declaration]
trace_preempt_enable_rcuidle(a0, a1);

The problem is that trace_preempt_enable_rcuidle() has different definition based on multiple Kconfig symbols, but not all combinations have a valid definition.

This changes the conditions so that we always get exactly one definition of each of the four tracing macros. I have not tried to verify that these definitions are sensible, but now we can build all randconfig combinations again.

Fixes d59158162e03 ("tracing: Add support for preempt and irq enable/disable events")
---
 include/trace/events/preemptirq.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
include/trace/events/preemptirq.h +7 -4
index f5024c560d8f..9c4eb33c5a1d 100644
@@ -56,15 +56,18 @@ DEFINE_EVENT(preemptirq_template, preempt_enable,
 
 #include <trace/define_trace.h>
 
-#else /* !CONFIG_PREEMPTIRQ_EVENTS */
+#endif /* !CONFIG_PREEMPTIRQ_EVENTS */
 
+#if !defined(CONFIG_PREEMPTIRQ_EVENTS) || defined(CONFIG_PROVE_LOCKING)
 #define trace_irq_enable(...)
 #define trace_irq_disable(...)
-#define trace_preempt_enable(...)
-#define trace_preempt_disable(...)
 #define trace_irq_enable_rcuidle(...)
 #define trace_irq_disable_rcuidle(...)
+#endif
+
+#if !defined(CONFIG_PREEMPTIRQ_EVENTS) || !defined(CONFIG_DEBUG_PREEMPT)
+#define trace_preempt_enable(...)
+#define trace_preempt_disable(...)
 #define trace_preempt_enable_rcuidle(...)
 #define trace_preempt_disable_rcuidle(...)
-
 #endif
Signature · 1 line
2.9.0
#1 lore raw

Hi Arnd,

Quoted 6 lines · Arnd Bergmann

We get a build error in the irqsoff tracer in some configurations:

kernel/trace/trace_irqsoff.c: In function 'trace_preempt_on':
kernel/trace/trace_irqsoff.c:855:2: error: implicit declaration of function 'trace_preempt_enable_rcuidle'; did you mean 'trace_irq_enable_rcuidle'? [-Werror=implicit-function-declaration]
trace_preempt_enable_rcuidle(a0, a1);

Quoted 9 lines

The problem is that trace_preempt_enable_rcuidle() has different definition based on multiple Kconfig symbols, but not all combinations have a valid definition.

This changes the conditions so that we always get exactly one definition of each of the four tracing macros. I have not tried to verify that these definitions are sensible, but now we can build all randconfig combinations again.

Thanks for catching this. I didn't follow why it breaks for you, especially I'm troubled by your proposal of defining the empty macro for !defined(CONFIG_DEBUG_PREEMPT) in your patch. Could you provide your config sample and architecture you're building for? I'm guessing its ARM but let me know. I will try to build it and reproduce it.

thanks,
Joel

#2 lore raw
Quoted 19 lines · Joel Fernandes

Hi Arnd,

Quoted 6 lines · Arnd Bergmann

We get a build error in the irqsoff tracer in some configurations:

kernel/trace/trace_irqsoff.c: In function 'trace_preempt_on':
kernel/trace/trace_irqsoff.c:855:2: error: implicit declaration of function 'trace_preempt_enable_rcuidle'; did you mean 'trace_irq_enable_rcuidle'? [-Werror=implicit-function-declaration]
trace_preempt_enable_rcuidle(a0, a1);

Quoted 9 lines

The problem is that trace_preempt_enable_rcuidle() has different definition based on multiple Kconfig symbols, but not all combinations have a valid definition.

This changes the conditions so that we always get exactly one definition of each of the four tracing macros. I have not tried to verify that these definitions are sensible, but now we can build all randconfig combinations again.

Quoted 5 lines

Thanks for catching this. I didn't follow why it breaks for you, especially I'm troubled by your proposal of defining the empty macro for !defined(CONFIG_DEBUG_PREEMPT) in your patch. Could you provide your config sample and architecture you're building for? I'm guessing its ARM but let me know. I will try to build it and reproduce it.

I ran into it during an arm64 randconfig build, uploaded the config file to
https://pastebin.com/s5AiqXTM

Arnd

Quoted 2 lines

thanks,
Joel

Acked-by on v1 1/1
#3 lore raw
In reply to Arnd Bergmann

Hi,

Quoted 10 lines · Arnd Bergmann

We get a build error in the irqsoff tracer in some configurations:

kernel/trace/trace_irqsoff.c: In function 'trace_preempt_on':
kernel/trace/trace_irqsoff.c:855:2: error: implicit declaration of function 'trace_preempt_enable_rcuidle'; did you mean 'trace_irq_enable_rcuidle'? [-Werror=implicit-function-declaration]
trace_preempt_enable_rcuidle(a0, a1);

The problem is that trace_preempt_enable_rcuidle() has different definition based on multiple Kconfig symbols, but not all combinations have a valid definition.

Quoted 7 lines

This changes the conditions so that we always get exactly one definition of each of the four tracing macros. I have not tried to verify that these definitions are sensible, but now we can build all randconfig combinations again.

Fixes d59158162e03 ("tracing: Add support for preempt and irq enable/disable events")

Yes this build condition is possible. Thanks for finding it. I agree with this patch, I will be simplifying this much more once I integrate PROVE_LOCKING to use tracepoint probes but this is Ok with me for now.

thanks!

- Joel

<snip>

maintainer Applied
#4 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · On Thu, 19 Oct 2017 10:32:13 +0200 Arnd Bergmann <[email protected]> wrote:

We get a build error in the irqsoff tracer in some configurations:

kernel/trace/trace_irqsoff.c: In function 'trace_preempt_on':
kernel/trace/trace_irqsoff.c:855:2: error: implicit declaration of function 'trace_preempt_enable_rcuidle'; did you mean 'trace_irq_enable_rcuidle'? [-Werror=implicit-function-declaration]
trace_preempt_enable_rcuidle(a0, a1);

The problem is that trace_preempt_enable_rcuidle() has different definition based on multiple Kconfig symbols, but not all combinations have a valid definition.

Quoted 7 lines

This changes the conditions so that we always get exactly one definition of each of the four tracing macros. I have not tried to verify that these definitions are sensible, but now we can build all randconfig combinations again.

Fixes d59158162e03 ("tracing: Add support for preempt and irq enable/disable events")

Applied. Thanks Arnd.

-- Steve