public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] ftrace / perf 'recursion'
Date: Wed, 17 Aug 2016 12:57:16 +0200	[thread overview]
Message-ID: <20160817105716.GJ7141@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160817103306.GI7141@twins.programming.kicks-ass.net>

On Wed, Aug 17, 2016 at 12:33:06PM +0200, Peter Zijlstra wrote:

> So how to extend the same to function tracer .... we'd have to mark
> exiting_irq() -> irq_exit() and everything from that as notrace, which
> seems somewhat excessive, fragile and undesired because tracing those
> functions is useful in other context :/

Steve, would something like so work? It would completely kill function
tracing for the irq_work exit path, but that seems fairly sane over-all.
After all, all the common irq_work code is already notrace as well.

 arch/x86/kernel/irq_work.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index 3512ba607361..24de793c35c6 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -10,17 +10,34 @@
 #include <asm/apic.h>
 #include <asm/trace/irq_vectors.h>
 
-static inline void __smp_irq_work_interrupt(void)
+static inline notrace void __smp_irq_work_interrupt(void)
 {
 	inc_irq_stat(apic_irq_work_irqs);
 	irq_work_run();
 }
 
+static inline notrace void exiting_irq_work(void)
+{
+#ifdef CONFIG_TRACING
+	if (unlikely(1 /* function_tracing_enabled() */)) {
+		unsigned long trace_recursion = current->trace_recursion;
+
+		current->trace_recursion |= 1 << 10; /* TRACE_INTERNAL_IRQ_BIT */
+		barrier();
+		exiting_irq();
+		barrier();
+		current->trace_recursion = trace_recursion;
+		return;
+	}
+#endif
+	exiting_irq();
+}
+
 __visible void smp_irq_work_interrupt(struct pt_regs *regs)
 {
 	ipi_entering_ack_irq();
 	__smp_irq_work_interrupt();
-	exiting_irq();
+	exiting_irq_work();
 }
 
 __visible void smp_trace_irq_work_interrupt(struct pt_regs *regs)
@@ -29,7 +46,7 @@ __visible void smp_trace_irq_work_interrupt(struct pt_regs *regs)
 	trace_irq_work_entry(IRQ_WORK_VECTOR);
 	__smp_irq_work_interrupt();
 	trace_irq_work_exit(IRQ_WORK_VECTOR);
-	exiting_irq();
+	exiting_irq_work();
 }
 
 void arch_irq_work_raise(void)

  reply	other threads:[~2016-08-17 10:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17  9:19 [RFC] ftrace / perf 'recursion' Peter Zijlstra
2016-08-17 10:33 ` Peter Zijlstra
2016-08-17 10:57   ` Peter Zijlstra [this message]
2016-08-17 13:49     ` Steven Rostedt
2016-08-17 14:06       ` Peter Zijlstra
2016-08-17 14:25         ` Steven Rostedt
2016-08-17 14:57           ` Peter Zijlstra
2016-08-17 15:04             ` Steven Rostedt

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=20160817105716.GJ7141@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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