Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1464502

Re: [RFC] ftrace / perf 'recursion'

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC] ftrace / perf 'recursion'
Date 2016-08-17 13:00 +0200
Message-ID <s76JH-8kQ-1@gated-at.bofh.it> (permalink)
References <s75kB-7vR-13@gated-at.bofh.it> <s76qm-8dD-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] ftrace / perf 'recursion' Peter Zijlstra <peterz@infradead.org> - 2016-08-17 11:30 +0200
  Re: [RFC] ftrace / perf 'recursion' Peter Zijlstra <peterz@infradead.org> - 2016-08-17 12:40 +0200
    Re: [RFC] ftrace / perf 'recursion' Peter Zijlstra <peterz@infradead.org> - 2016-08-17 13:00 +0200
      Re: [RFC] ftrace / perf 'recursion' Steven Rostedt <rostedt@goodmis.org> - 2016-08-17 15:50 +0200
        Re: [RFC] ftrace / perf 'recursion' Peter Zijlstra <peterz@infradead.org> - 2016-08-17 16:10 +0200
          Re: [RFC] ftrace / perf 'recursion' Steven Rostedt <rostedt@goodmis.org> - 2016-08-17 16:30 +0200
            Re: [RFC] ftrace / perf 'recursion' Peter Zijlstra <peterz@infradead.org> - 2016-08-17 17:00 +0200
              Re: [RFC] ftrace / perf 'recursion' Steven Rostedt <rostedt@goodmis.org> - 2016-08-17 17:10 +0200

csiph-web