Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721114
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch V3 06/44] x86/tracing: Introduce a static key for exception tracing |
| Date | 2017-08-28 09:10 +0200 |
| Message-ID | <ujmlm-2xk-73@gated-at.bofh.it> (permalink) |
| References | <ujmbD-2dY-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Switching the IDT just for avoiding tracepoints creates a complete
impenetrable macro/inline/ifdef mess.
There is no point in avoiding tracepoints for most of the traps/exceptions.
For the more expensive tracepoints, like pagefaults, this can be handled with
an explicit static key.
Preparatory patch to remove the tracing idt.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/include/asm/trace/common.h | 15 +++++++++++++++
arch/x86/include/asm/trace/exceptions.h | 4 +---
arch/x86/include/asm/trace/irq_vectors.h | 4 +---
arch/x86/kernel/tracepoint.c | 9 ++++++++-
4 files changed, 25 insertions(+), 7 deletions(-)
--- /dev/null
+++ b/arch/x86/include/asm/trace/common.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_TRACE_COMMON_H
+#define _ASM_TRACE_COMMON_H
+
+extern int trace_irq_vector_regfunc(void);
+extern void trace_irq_vector_unregfunc(void);
+
+#ifdef CONFIG_TRACING
+DECLARE_STATIC_KEY_FALSE(trace_irqvectors_key);
+#define trace_irqvectors_enabled() \
+ static_branch_unlikely(&trace_irqvectors_key)
+#else
+static inline bool trace_irqvectors_enabled(void) { return false; }
+#endif
+
+#endif
--- a/arch/x86/include/asm/trace/exceptions.h
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -5,9 +5,7 @@
#define _TRACE_PAGE_FAULT_H
#include <linux/tracepoint.h>
-
-extern int trace_irq_vector_regfunc(void);
-extern void trace_irq_vector_unregfunc(void);
+#include <asm/trace/common.h>
DECLARE_EVENT_CLASS(x86_exceptions,
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -5,9 +5,7 @@
#define _TRACE_IRQ_VECTORS_H
#include <linux/tracepoint.h>
-
-extern int trace_irq_vector_regfunc(void);
-extern void trace_irq_vector_unregfunc(void);
+#include <asm/trace/common.h>
DECLARE_EVENT_CLASS(x86_irq_vector,
--- a/arch/x86/kernel/tracepoint.c
+++ b/arch/x86/kernel/tracepoint.c
@@ -4,9 +4,11 @@
* Copyright (C) 2013 Seiji Aguchi <seiji.aguchi@hds.com>
*
*/
+#include <linux/jump_label.h>
+#include <linux/atomic.h>
+
#include <asm/hw_irq.h>
#include <asm/desc.h>
-#include <linux/atomic.h>
atomic_t trace_idt_ctr = ATOMIC_INIT(0);
struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1,
@@ -15,6 +17,7 @@ struct desc_ptr trace_idt_descr = { NR_V
/* No need to be aligned, but done to keep all IDTs defined the same way. */
gate_desc trace_idt_table[NR_VECTORS] __page_aligned_bss;
+DEFINE_STATIC_KEY_FALSE(trace_irqvectors_key);
static int trace_irq_vector_refcount;
static DEFINE_MUTEX(irq_vector_mutex);
@@ -36,6 +39,8 @@ static void switch_idt(void *arg)
int trace_irq_vector_regfunc(void)
{
+ static_branch_inc(&trace_irqvectors_key);
+
mutex_lock(&irq_vector_mutex);
if (!trace_irq_vector_refcount) {
set_trace_idt_ctr(1);
@@ -49,6 +54,8 @@ int trace_irq_vector_regfunc(void)
void trace_irq_vector_unregfunc(void)
{
+ static_branch_dec(&trace_irqvectors_key);
+
mutex_lock(&irq_vector_mutex);
trace_irq_vector_refcount--;
if (!trace_irq_vector_refcount) {
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch V3 00/44] x86: Cleanup IDT code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[patch V3 13/44] x86/mce: Remove duplicated tracing interrupt code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/mce: Remove duplicated tracing interrupt code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 05/44] x86/boot: Move EISA setup to a proper place Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/boot: Move EISA setup to a separate file tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 15/44] x86/smp: Use static key for reschedule interrupt tracing Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/smp: Use static key for reschedule interrupt tracing tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 12/44] x86/irqwork: Get rid of duplicated tracing interrupt code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/irqwork: Get rid of duplicated tracing interrupt code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 10/44] x86/irq: Get rid of duplicated trace_x86_platform_ipi() code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/irq: Get rid of duplicated trace_x86_platform_ipi() code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 06/44] x86/tracing: Introduce a static key for exception tracing Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/tracing: Introduce a static key for exception tracing tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 08/44] x86/apic: Remove the duplicated tracing version of local_timer_interrupt Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/apic: Remove the duplicated tracing version of local_timer_interrupt() tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 14/44] x86/smp: Remove pointless duplicated interrupt code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/smp: Remove pointless duplicated interrupt code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 04/44] x86/irq: Remove duplicated used_vectors definition Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/irq: Remove duplicated used_vectors definition tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 03/44] x86/irq: Get rid of the first_system_vector bogisity Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/irq: Get rid of the 'first_system_vector' indirection bogosity tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:20 +0200
[patch V3 28/44] x86/idt: Create file for IDT related code Thomas Gleixner <tglx@linutronix.de> - 2017-08-28 09:10 +0200
[tip:x86/apic] x86/idt: Create file for IDT related code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2017-08-29 13:30 +0200
csiph-web