From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbcHQK5T (ORCPT ); Wed, 17 Aug 2016 06:57:19 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40984 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbcHQK5T (ORCPT ); Wed, 17 Aug 2016 06:57:19 -0400 Date: Wed, 17 Aug 2016 12:57:16 +0200 From: Peter Zijlstra To: Steven Rostedt , Thomas Gleixner , Ingo Molnar , Alexander Shishkin Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC] ftrace / perf 'recursion' Message-ID: <20160817105716.GJ7141@twins.programming.kicks-ass.net> References: <20160817091953.GH7141@twins.programming.kicks-ass.net> <20160817103306.GI7141@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160817103306.GI7141@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 #include -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)