From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbbJNFJf (ORCPT ); Wed, 14 Oct 2015 01:09:35 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36001 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbbJNFJe (ORCPT ); Wed, 14 Oct 2015 01:09:34 -0400 Subject: Re: [PATCH v3 1/7] arm64: ftrace: adjust callsite addresses examined by stack tracer To: Steven Rostedt References: <1444298504-10392-1-git-send-email-takahiro.akashi@linaro.org> <1444298504-10392-2-git-send-email-takahiro.akashi@linaro.org> <20151013113750.0fdecd33@gandalf.local.home> Cc: catalin.marinas@arm.com, will.deacon@arm.com, jungseoklee85@gmail.com, olof@lixom.net, broonie@kernel.org, david.griego@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: AKASHI Takahiro Message-ID: <561DE385.1040005@linaro.org> Date: Wed, 14 Oct 2015 14:09:25 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20151013113750.0fdecd33@gandalf.local.home> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/14/2015 12:37 AM, Steven Rostedt wrote: > On Thu, 8 Oct 2015 19:01:38 +0900 > AKASHI Takahiro wrote: > >> 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 b746399..30521ea 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; >> } >> >> @@ -133,7 +133,8 @@ check_stack(unsigned long ip, unsigned long *stack) >> for (; p < top && i < max_stack_trace.nr_entries; p++) { >> if (stack_dump_trace[i] == ULONG_MAX) >> break; >> - if (*p == stack_dump_trace[i]) { >> + if (*p == (stack_dump_trace[i] >> + + FTRACE_STACK_FRAME_OFFSET)) { > > I'm fine with the patch, but this is one of those cases that I think > the 80 column max limit produces uglier code than just going a little > over. > > Or, we can add a helper variable in both locations: > > addr = stack_dump_trace[i] + FTRACE_STACK_FRAME_OFFSET; > if (*p == addr) { > > gcc should be smart enough to optimize out the addr variable. Thanks, I will take this. (please note that this patch won't be necessary if my patch5,6 and 7 are accepted.) -Takahiro AKASHI > -- Steve > >> stack_dump_trace[x] = stack_dump_trace[i++]; >> this_size = stack_dump_index[x++] = >> (top - p) * sizeof(unsigned long); >