All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Peter Anvin <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [patch V2 18/44] x86/tracing: Disentangle pagefault and resched IPI tracing key
Date: Fri, 25 Aug 2017 23:47:06 +0200	[thread overview]
Message-ID: <20170825214941.648618593@linutronix.de> (raw)
In-Reply-To: 20170825214648.264521964@linutronix.de

[-- Attachment #1: x86-tracing--Distangle-pagefault-and-resched-IPI.patch --]
[-- Type: text/plain, Size: 5737 bytes --]

The pagefault and the resched IPI handler are the only ones where it is
worth to optimize the code further in case tracepoints are disabled. But it
makes no sense to have a single static key for both.

Seperate the static keys so the facilities are handled seperately.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/trace/common.h      |   15 ++++++++-------
 arch/x86/include/asm/trace/exceptions.h  |    6 ++++--
 arch/x86/include/asm/trace/irq_vectors.h |   29 +++++++++++++++++++++++------
 arch/x86/kernel/smp.c                    |    2 +-
 arch/x86/kernel/tracepoint.c             |   27 ++++++++++++++++++++++-----
 arch/x86/mm/fault.c                      |    2 +-
 6 files changed, 59 insertions(+), 22 deletions(-)

--- a/arch/x86/include/asm/trace/common.h
+++ b/arch/x86/include/asm/trace/common.h
@@ -1,15 +1,16 @@
 #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)
+DECLARE_STATIC_KEY_FALSE(trace_pagefault_key);
+#define trace_pagefault_enabled()			\
+	static_branch_unlikely(&trace_pagefault_key)
+DECLARE_STATIC_KEY_FALSE(trace_resched_ipi_key);
+#define trace_resched_ipi_enabled()			\
+	static_branch_unlikely(&trace_resched_ipi_key)
 #else
-static inline bool trace_irqvectors_enabled(void) { return false; }
+static inline bool trace_pagefault_enabled(void) { return false; }
+static inline bool trace_resched_ipi_enabled(void) { return false; }
 #endif
 
 #endif
--- a/arch/x86/include/asm/trace/exceptions.h
+++ b/arch/x86/include/asm/trace/exceptions.h
@@ -7,6 +7,9 @@
 #include <linux/tracepoint.h>
 #include <asm/trace/common.h>
 
+extern int trace_pagefault_reg(void);
+extern void trace_pagefault_unreg(void);
+
 DECLARE_EVENT_CLASS(x86_exceptions,
 
 	TP_PROTO(unsigned long address, struct pt_regs *regs,
@@ -35,8 +38,7 @@ DEFINE_EVENT_FN(x86_exceptions, name,
 	TP_PROTO(unsigned long address,	struct pt_regs *regs,	\
 		 unsigned long error_code),			\
 	TP_ARGS(address, regs, error_code),			\
-	trace_irq_vector_regfunc,				\
-	trace_irq_vector_unregfunc);
+	trace_pagefault_reg, trace_pagefault_unreg);
 
 DEFINE_PAGE_FAULT_EVENT(page_fault_user);
 DEFINE_PAGE_FAULT_EVENT(page_fault_kernel);
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -7,6 +7,9 @@
 #include <linux/tracepoint.h>
 #include <asm/trace/common.h>
 
+extern int trace_resched_ipi_reg(void);
+extern void trace_resched_ipi_unreg(void);
+
 DECLARE_EVENT_CLASS(x86_irq_vector,
 
 	TP_PROTO(int vector),
@@ -26,15 +29,22 @@ DECLARE_EVENT_CLASS(x86_irq_vector,
 #define DEFINE_IRQ_VECTOR_EVENT(name)		\
 DEFINE_EVENT_FN(x86_irq_vector, name##_entry,	\
 	TP_PROTO(int vector),			\
+	TP_ARGS(vector), NULL, NULL);		\
+DEFINE_EVENT_FN(x86_irq_vector, name##_exit,	\
+	TP_PROTO(int vector),			\
+	TP_ARGS(vector), NULL, NULL);
+
+#define DEFINE_RESCHED_IPI_EVENT(name)		\
+DEFINE_EVENT_FN(x86_irq_vector, name##_entry,	\
+	TP_PROTO(int vector),			\
 	TP_ARGS(vector),			\
-	trace_irq_vector_regfunc,		\
-	trace_irq_vector_unregfunc);		\
+	trace_resched_ipi_reg,			\
+	trace_resched_ipi_unreg);		\
 DEFINE_EVENT_FN(x86_irq_vector, name##_exit,	\
 	TP_PROTO(int vector),			\
 	TP_ARGS(vector),			\
-	trace_irq_vector_regfunc,		\
-	trace_irq_vector_unregfunc);
-
+	trace_resched_ipi_reg,			\
+	trace_resched_ipi_unreg);
 
 /*
  * local_timer - called when entering/exiting a local timer interrupt
@@ -43,9 +53,16 @@ DEFINE_EVENT_FN(x86_irq_vector, name##_e
 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_IRQ_VECTOR_EVENT(reschedule);
+DEFINE_RESCHED_IPI_EVENT(reschedule);
+#endif
 
 /*
  * spurious_apic - called when entering/exiting a spurious apic vector handler
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -262,7 +262,7 @@ static void native_stop_other_cpus(int w
 	ack_APIC_irq();
 	inc_irq_stat(irq_resched_count);
 
-	if (trace_irqvectors_enabled()) {
+	if (trace_resched_ipi_enabled()) {
 		/*
 		 * scheduler_ipi() might call irq_enter() as well, but
 		 * nested calls are fine.
--- a/arch/x86/kernel/tracepoint.c
+++ b/arch/x86/kernel/tracepoint.c
@@ -10,15 +10,32 @@
 #include <asm/hw_irq.h>
 #include <asm/desc.h>
 
-DEFINE_STATIC_KEY_FALSE(trace_irqvectors_key);
+DEFINE_STATIC_KEY_FALSE(trace_pagefault_key);
 
-int trace_irq_vector_regfunc(void)
+int trace_pagefault_reg(void)
 {
-	static_branch_inc(&trace_irqvectors_key);
+	static_branch_inc(&trace_pagefault_key);
 	return 0;
 }
 
-void trace_irq_vector_unregfunc(void)
+void trace_pagefault_unreg(void)
 {
-	static_branch_dec(&trace_irqvectors_key);
+	static_branch_dec(&trace_pagefault_key);
 }
+
+#ifdef CONFIG_SMP
+
+DEFINE_STATIC_KEY_FALSE(trace_resched_ipi_key);
+
+int trace_resched_ipi_reg(void)
+{
+	static_branch_inc(&trace_resched_ipi_key);
+	return 0;
+}
+
+void trace_resched_ipi_unreg(void)
+{
+	static_branch_dec(&trace_resched_ipi_key);
+}
+
+#endif
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1510,7 +1510,7 @@ do_page_fault(struct pt_regs *regs, unsi
 	enum ctx_state prev_state;
 
 	prev_state = exception_enter();
-	if (trace_irqvectors_enabled())
+	if (trace_pagefault_enabled())
 		trace_page_fault_entries(address, regs, error_code);
 
 	__do_page_fault(regs, error_code, address);

  parent reply	other threads:[~2017-08-25 22:05 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 21:46 [patch V2 00/44] x86: Cleanup IDT code Thomas Gleixner
2017-08-25 21:46 ` [patch V2 01/44] x86/irq: Remove vector_used_by_percpu_irq() Thomas Gleixner
2017-08-25 21:46 ` [patch V2 02/44] x86/irq: Unexport used_vectors Thomas Gleixner
2017-08-25 21:46 ` [patch V2 03/44] x86/irq: Get rid of the first_system_vector bogisity Thomas Gleixner
2017-08-25 21:46 ` [patch V2 04/44] x86/irq: Remove duplicated used_vectors definition Thomas Gleixner
2017-08-25 21:46 ` [patch V2 05/44] x86/boot: Move EISA setup to a proper place Thomas Gleixner
2017-08-25 21:46 ` [patch V2 06/44] x86/tracing: Introduce a static key for exception tracing Thomas Gleixner
2017-08-25 21:46 ` [patch V2 07/44] x86/traps: Simplify pagefault tracing logic Thomas Gleixner
2017-08-25 21:46 ` [patch V2 08/44] x86/apic: Remove the duplicated tracing version of local_timer_interrupt Thomas Gleixner
2017-08-25 21:46 ` [patch V2 09/44] x86/apic: Use this_cpu_ptr in local_timer_interrupt Thomas Gleixner
2017-08-25 21:46 ` [patch V2 10/44] x86/irq: Get rid of duplicated trace_x86_platform_ipi() code Thomas Gleixner
2017-08-25 21:46 ` [patch V2 11/44] x86/apic: Remove the duplicated tracing versions of interrupts Thomas Gleixner
2017-08-25 21:47 ` [patch V2 12/44] x86/irqwork: Get rid of duplicated tracing interrupt code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 13/44] x86/mce: Remove " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 14/44] x86/smp: Remove pointless duplicated " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 15/44] x86/smp: Use static key for reschedule interrupt tracing Thomas Gleixner
2017-08-25 21:47 ` [patch V2 16/44] x86/idt: Remove tracing idt completely Thomas Gleixner
2017-08-25 21:47 ` [patch V2 17/44] x86/idt: Cleanup the i386 low level entry macros Thomas Gleixner
2017-08-25 21:47 ` Thomas Gleixner [this message]
2017-08-25 21:47 ` [patch V2 19/44] x86/ipi: Make platform IPI depend on APIC Thomas Gleixner
2017-08-25 21:47 ` [patch V2 20/44] x86/irq_work: Make it " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 21/44] x86/tracing: Build tracepoints only when they are used Thomas Gleixner
2017-08-25 21:47 ` [patch V2 22/44] x86/idt: Unify gate_struct handling for 32/64bit Thomas Gleixner
2017-08-25 21:47 ` [patch V2 23/44] x86/percpu: Use static initializer for GDT entry Thomas Gleixner
2017-08-25 21:47 ` [patch V2 24/44] x86/fpu: Use bitfield accessors for desc_struct Thomas Gleixner
2017-08-25 21:47 ` [patch V2 25/44] x86: Replace access to desc_struct:a/b fields Thomas Gleixner
2017-08-26  2:16   ` Boris Ostrovsky
2017-08-25 21:47 ` [patch V2 26/44] x86/gdt: Use bitfields for initialization Thomas Gleixner
2017-08-25 21:47 ` [patch V2 27/44] x86/ldttss: Cleanup 32bit descriptors Thomas Gleixner
2017-08-25 21:47 ` [patch V2 28/44] x86/idt: Create file for IDT related code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 29/44] x86/idt: Move 32bit idt_descr to C code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 30/44] x86/idt: Remove unused set_trap_gate() Thomas Gleixner
2017-08-25 21:47 ` [patch V2 31/44] x86/idt: Consolidate IDT invalidation Thomas Gleixner
2017-08-25 21:47 ` [patch V2 32/44] x86/idt: Move early IDT handler setup to IDT code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 33/44] x86/idt: Move early IDT setup out of 32bit asm Thomas Gleixner
2017-08-25 21:47 ` [patch V2 34/44] x86/idt: Prepare for table based init Thomas Gleixner
2017-08-25 21:47 ` [patch V2 35/44] x86/idt: Switch early trap init to IDT tables Thomas Gleixner
2017-08-26  2:24   ` Boris Ostrovsky
2017-08-26  8:16     ` Thomas Gleixner
2017-08-26 10:59       ` Juergen Gross
2017-08-26 13:05         ` Thomas Gleixner
2017-08-26 15:07           ` Boris Ostrovsky
2017-08-25 21:47 ` [patch V2 36/44] x86/idt: Move debug stack init to table based Thomas Gleixner
2017-08-25 21:47 ` [patch V2 37/44] x86/idt: Move ist stack based traps to table init Thomas Gleixner
2017-08-25 21:47 ` [patch V2 38/44] x86/idt: Move regular trap init to tables Thomas Gleixner
2017-08-25 21:47 ` [patch V2 39/44] x86/idt: Move APIC gate initialization " Thomas Gleixner
2017-08-25 21:47 ` [patch V2 40/44] x86/idt: Move interrupt gate initialization to IDT code Thomas Gleixner
2017-08-25 21:47 ` [patch V2 41/44] x86/idt: Remove unused functions/inlines Thomas Gleixner
2017-08-25 21:47 ` [patch V2 42/44] x86/idt: Deinline setup functions Thomas Gleixner
2017-08-25 21:47 ` [patch V2 43/44] x86/idt: Simplify alloc_intr_gate Thomas Gleixner
2017-08-25 21:47 ` [patch V2 44/44] x86/idt: Hide set_intr_gate() Thomas Gleixner

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=20170825214941.648618593@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.