x86/tracing: Build tracepoints only when they are used

The tracepoint macro magic emits code for all tracepoints in a event header
file. That code stays around even if the tracepoint is not used at all. The
linker does not discard it.

Build the various irq_vector tracepoints dependent on the appropriate CONFIG
switches.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170828064957.770651777@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Thomas Gleixner 2017-08-28 08:47:36 +02:00 committed by Ingo Molnar
parent a45525b5b4
commit 7328552780

View File

@ -7,6 +7,8 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#include <asm/trace/common.h> #include <asm/trace/common.h>
#ifdef CONFIG_X86_LOCAL_APIC
extern int trace_resched_ipi_reg(void); extern int trace_resched_ipi_reg(void);
extern void trace_resched_ipi_unreg(void); extern void trace_resched_ipi_unreg(void);
@ -52,18 +54,6 @@ DEFINE_EVENT_FN(x86_irq_vector, name##_exit, \
*/ */
DEFINE_IRQ_VECTOR_EVENT(local_timer); DEFINE_IRQ_VECTOR_EVENT(local_timer);
/*
* The ifdef is required because that tracepoint macro hell emits tracepoint
* code in files which include this header even if the tracepoint is not
* enabled. Brilliant stuff that.
*/
#ifdef CONFIG_SMP
/*
* reschedule - called when entering/exiting a reschedule vector handler
*/
DEFINE_RESCHED_IPI_EVENT(reschedule);
#endif
/* /*
* spurious_apic - called when entering/exiting a spurious apic vector handler * spurious_apic - called when entering/exiting a spurious apic vector handler
*/ */
@ -80,6 +70,7 @@ DEFINE_IRQ_VECTOR_EVENT(error_apic);
*/ */
DEFINE_IRQ_VECTOR_EVENT(x86_platform_ipi); DEFINE_IRQ_VECTOR_EVENT(x86_platform_ipi);
#ifdef CONFIG_IRQ_WORK
/* /*
* irq_work - called when entering/exiting a irq work interrupt * irq_work - called when entering/exiting a irq work interrupt
* vector handler * vector handler
@ -96,6 +87,18 @@ DEFINE_IRQ_VECTOR_EVENT(irq_work);
* 4) goto 1 * 4) goto 1
*/ */
TRACE_EVENT_PERF_PERM(irq_work_exit, is_sampling_event(p_event) ? -EPERM : 0); TRACE_EVENT_PERF_PERM(irq_work_exit, is_sampling_event(p_event) ? -EPERM : 0);
#endif
/*
* The ifdef is required because that tracepoint macro hell emits tracepoint
* code in files which include this header even if the tracepoint is not
* enabled. Brilliant stuff that.
*/
#ifdef CONFIG_SMP
/*
* reschedule - called when entering/exiting a reschedule vector handler
*/
DEFINE_RESCHED_IPI_EVENT(reschedule);
/* /*
* call_function - called when entering/exiting a call function interrupt * call_function - called when entering/exiting a call function interrupt
@ -108,24 +111,33 @@ DEFINE_IRQ_VECTOR_EVENT(call_function);
* single interrupt vector handler * single interrupt vector handler
*/ */
DEFINE_IRQ_VECTOR_EVENT(call_function_single); DEFINE_IRQ_VECTOR_EVENT(call_function_single);
#endif
#ifdef CONFIG_X86_MCE_THRESHOLD
/* /*
* threshold_apic - called when entering/exiting a threshold apic interrupt * threshold_apic - called when entering/exiting a threshold apic interrupt
* vector handler * vector handler
*/ */
DEFINE_IRQ_VECTOR_EVENT(threshold_apic); DEFINE_IRQ_VECTOR_EVENT(threshold_apic);
#endif
#ifdef CONFIG_X86_MCE_AMD
/* /*
* deferred_error_apic - called when entering/exiting a deferred apic interrupt * deferred_error_apic - called when entering/exiting a deferred apic interrupt
* vector handler * vector handler
*/ */
DEFINE_IRQ_VECTOR_EVENT(deferred_error_apic); DEFINE_IRQ_VECTOR_EVENT(deferred_error_apic);
#endif
#ifdef CONFIG_X86_THERMAL_VECTOR
/* /*
* thermal_apic - called when entering/exiting a thermal apic interrupt * thermal_apic - called when entering/exiting a thermal apic interrupt
* vector handler * vector handler
*/ */
DEFINE_IRQ_VECTOR_EVENT(thermal_apic); DEFINE_IRQ_VECTOR_EVENT(thermal_apic);
#endif
#endif /* CONFIG_X86_LOCAL_APIC */
#undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH . #define TRACE_INCLUDE_PATH .