From patchwork Sat Jul 11 00:29:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 35128 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6B0TXGR022218 for ; Sat, 11 Jul 2009 00:29:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757426AbZGKA3d (ORCPT ); Fri, 10 Jul 2009 20:29:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757429AbZGKA3c (ORCPT ); Fri, 10 Jul 2009 20:29:32 -0400 Received: from cs20.apochromatic.org ([204.152.189.161]:63122 "EHLO cs20.apochromatic.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757426AbZGKA3c (ORCPT ); Fri, 10 Jul 2009 20:29:32 -0400 Received: from localhost (localhost [127.0.0.1]) by cs20.apochromatic.org (Postfix) with ESMTP id 837E0AD7B4; Fri, 10 Jul 2009 17:29:31 -0700 (PDT) From: Matt Fleming To: linux-sh@vger.kernel.org Cc: lethal@linux-sh.org, Matt Fleming Subject: [PATCH 3/3] sh: Mark __switch_to() as __notrace_funcgraph Date: Sat, 11 Jul 2009 01:29:04 +0100 Message-Id: X-Mailer: git-send-email 1.6.3.2.316.gda4e In-Reply-To: References: <194c0b5363680cc9a1ff59bf2784e09574fbaa99.1247272091.git.matt@console-pimps.org> In-Reply-To: <194c0b5363680cc9a1ff59bf2784e09574fbaa99.1247272091.git.matt@console-pimps.org> References: <194c0b5363680cc9a1ff59bf2784e09574fbaa99.1247272091.git.matt@console-pimps.org> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Annotate __switch_to() so that the function graph tracer does not try to trace it. Use __notrace_funcgraph, as opposed to notrace, so that other tracers can continue to trace __switch_to(). The reason that we don't want to trace __switch_to() with the function graph tracer is because of how the return address stack in task_struct is implemented. When we enter __switch_to we store the real return address on prev's ret_stack. When we return from __switch_to() we've patched the return address on the kernel stack to be return_to_handler. Calling return_to_handler we do, -> ftrace_return_to_handler() -> ftrace_pop_return_ftrace() Which tries to pop the real return address from current->ret_stack. The problem being that we stored the return address on prev->ret_stack, but current now points to next, and next->ret_stack doesn't contain the correct return address (and is possibly even empty). Signed-off-by: Matt Fleming --- arch/sh/kernel/process_32.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 92d7740..9fee977 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -264,8 +265,8 @@ static void ubc_set_tracing(int asid, unsigned long pc) * switch_to(x,y) should switch tasks from x to y. * */ -struct task_struct *__switch_to(struct task_struct *prev, - struct task_struct *next) +__notrace_funcgraph struct task_struct * +__switch_to(struct task_struct *prev, struct task_struct *next) { #if defined(CONFIG_SH_FPU) unlazy_fpu(prev, task_pt_regs(prev));