Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762258AbcLUWpc (ORCPT ); Wed, 21 Dec 2016 17:45:32 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:35924 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762128AbcLUWpA (ORCPT ); Wed, 21 Dec 2016 17:45:00 -0500 From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: Joel Fernandes , Todd Kjos , Steven Rostedt , Will Deacon , Mark Rutland , Catalin Marinas , James Morse , Andrew Morton , Kees Cook , Jason Cooper , Jiri Slaby , linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)) Subject: [PATCH] arm64: Don't trace __switch_to if function graph tracer is enabled Date: Wed, 21 Dec 2016 14:44:46 -0800 Message-Id: <1482360288-124624-1-git-send-email-joelaf@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 41 Function graph tracer shows negative time (wrap around) when tracing __switch_to if the nosleep-time trace option is enabled. Time compensation for nosleep-time is done by an ftrace probe on sched_switch. This doesn't work well for the following events (with letters representing timestamps): A - sched switch probe called for task T switch out B - __switch_to calltime is recorded C - sched_switch probe called for task T switch in D - __switch_to rettime is recorded If C - A > D - B, then we end up over compensating for the time spent in __switch_to giving rise to negative times in the trace output. On x86, __switch_to is not traced if function graph tracer is enabled. Do the same for arm64 as well. Cc: Todd Kjos Cc: Steven Rostedt Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Joel Fernandes --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 01753cd..e84ee27 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -324,7 +324,7 @@ void uao_thread_switch(struct task_struct *next) /* * Thread switching. */ -struct task_struct *__switch_to(struct task_struct *prev, +__notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) { struct task_struct *last; -- 2.8.0.rc3.226.g39d4020