From patchwork Thu Jul 16 01:08:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 51132 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28BC522A28 for ; Thu, 16 Jul 2015 01:08:19 +0000 (UTC) Received: by laef2 with SMTP id f2sf14783841lae.0 for ; Wed, 15 Jul 2015 18:08:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=J06+oWqJjwKKlyoLp1lFSPcyylAvQ33oFmE1Er5SE7A=; b=Lp4vV126ERf9uPYZKOZ3/g3DFsmKS9jDJb2Li/RyxrqG8CQbpN7SGEfsbW3rOHNNqv 5OmxpmfNgXq8bAbMlYMYJNFG0z5XLipf5kwsegi7KNlUAINYsL8JLiWhmBmfyPJHF27n ofPAQlvugYJIlCdftPfJ5pzXHpzGU4kx62anltEFom4lEyrAg/jj590xKD4bIxsB/yaA Rr3NRnUpkGcRU87yyUKt8NIYz1xKL6zgge7SZVi1tVphFj0bipEFTQCqslYcmncsiYD6 NwutxhzYgz0WPXETBZEqUGcnRfJ++Zzhqbt9GBzEI99x4x6tZjus+W4q3Ve+wYQHhLKu 8WDg== X-Gm-Message-State: ALoCoQnsT6A2o4j5aEdsP5hd6IHbahpoqP6t5+hRNtFkhmYqxVG0Oa8NrEr6Pj3+nHn13UleW5ha X-Received: by 10.112.98.42 with SMTP id ef10mr3486223lbb.18.1437008898031; Wed, 15 Jul 2015 18:08:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.196 with SMTP id a4ls253253lak.27.gmail; Wed, 15 Jul 2015 18:08:17 -0700 (PDT) X-Received: by 10.152.22.168 with SMTP id e8mr6948553laf.40.1437008897822; Wed, 15 Jul 2015 18:08:17 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id z7si5489851laj.139.2015.07.15.18.08.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jul 2015 18:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbzr7 with SMTP id zr7so34861939lbb.1 for ; Wed, 15 Jul 2015 18:08:17 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr6900326laj.19.1437008897396; Wed, 15 Jul 2015 18:08:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3429533lbb; Wed, 15 Jul 2015 18:08:16 -0700 (PDT) X-Received: by 10.68.139.225 with SMTP id rb1mr13118817pbb.68.1437008895543; Wed, 15 Jul 2015 18:08:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si10104138pdn.226.2015.07.15.18.08.14; Wed, 15 Jul 2015 18:08:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753602AbbGPBIN (ORCPT + 24 others); Wed, 15 Jul 2015 21:08:13 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34723 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752149AbbGPBIL (ORCPT ); Wed, 15 Jul 2015 21:08:11 -0400 Received: by pacan13 with SMTP id an13so33204474pac.1 for ; Wed, 15 Jul 2015 18:08:11 -0700 (PDT) X-Received: by 10.66.142.42 with SMTP id rt10mr13196783pab.142.1437008891038; Wed, 15 Jul 2015 18:08:11 -0700 (PDT) Received: from [192.168.1.225] (61-205-7-98m5.grp1.mineo.jp. [61.205.7.98]) by smtp.googlemail.com with ESMTPSA id ph4sm5927671pdb.43.2015.07.15.18.08.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jul 2015 18:08:09 -0700 (PDT) Message-ID: <55A703F3.8050203@linaro.org> Date: Thu, 16 Jul 2015 10:08:03 +0900 From: AKASHI Takahiro User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Steven Rostedt CC: Jungseok Lee , catalin.marinas@arm.com, will.deacon@arm.com, olof@lixom.net, broonie@kernel.org, david.griego@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 2/3] arm64: refactor save_stack_trace() References: <1436765375-7119-1-git-send-email-takahiro.akashi@linaro.org> <1436765375-7119-3-git-send-email-takahiro.akashi@linaro.org> <20150714093154.4d73e551@gandalf.local.home> <55A5A75A.1060401@linaro.org> <20150714225105.6c1e4f15@gandalf.local.home> <55A646EE.6030402@linaro.org> <20150715105536.42949ea9@gandalf.local.home> <20150715121337.3b31aa84@gandalf.local.home> <55A6FA82.9000901@linaro.org> In-Reply-To: <55A6FA82.9000901@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: takahiro.akashi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 07/16/2015 09:27 AM, AKASHI Takahiro wrote: > On 07/16/2015 01:13 AM, Steven Rostedt wrote: >> On Wed, 15 Jul 2015 10:55:36 -0400 >> Steven Rostedt wrote: >> >> >>> I'll take a look at it and try to clean up the code. >> >> Does the following patch make sense for you? > > Looks nice. The patch greatly simplifies changes on arm64 side. As follows: - Takahiro AKASHI diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h index c5534fa..868d6f1 100644 --- a/arch/arm64/include/asm/ftrace.h +++ b/arch/arm64/include/asm/ftrace.h @@ -15,6 +15,7 @@ #define MCOUNT_ADDR ((unsigned long)_mcount) #define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE +#define FTRACE_STACK_FRAME_OFFSET 4 /* sync it up with stacktrace.c */ #ifndef __ASSEMBLY__ #include diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 1da6029..2c1bf7d 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -260,6 +260,13 @@ static inline void ftrace_kill(void) { } #endif /* CONFIG_FUNCTION_TRACER */ #ifdef CONFIG_STACK_TRACER +/* + * the offset value to add to return address from save_stack_trace() + */ +#ifndef FTRACE_STACK_FRAME_OFFSET +#define FTRACE_STACK_FRAME_OFFSET 0 +#endif + extern int stack_tracer_enabled; int stack_trace_sysctl(struct ctl_table *table, int write, diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 9384647..c5b9748 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -105,7 +105,7 @@ check_stack(unsigned long ip, unsigned long *stack) /* Skip over the overhead of the stack tracer itself */ for (i = 0; i < max_stack_trace.nr_entries; i++) { - if (stack_dump_trace[i] == ip) + if ((stack_dump_trace[i] + FTRACE_STACK_FRAME_OFFSET) == ip) break; } @@ -131,7 +131,8 @@ check_stack(unsigned long ip, unsigned long *stack) p = start; for (; p < top && i < max_stack_trace.nr_entries; p++) { - if (*p == stack_dump_trace[i]) { + if (*p == (stack_dump_trace[i] + + FTRACE_STACK_FRAME_OFFSET)) { stack_dump_trace[x] = stack_dump_trace[i++]; this_size = stack_dump_index[x++] = (top - p) * sizeof(unsigned long);