From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754130AbbGUK0t (ORCPT ); Tue, 21 Jul 2015 06:26:49 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36512 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753897AbbGUK0s (ORCPT ); Tue, 21 Jul 2015 06:26:48 -0400 Message-ID: <55AE1E5F.6060407@linaro.org> Date: Tue, 21 Jul 2015 19:26:39 +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: Will Deacon , Jungseok Lee CC: Steven Rostedt , Mark Rutland , Catalin Marinas , "linux-kernel@vger.kernel.org" , "broonie@kernel.org" , "david.griego@linaro.org" , "olof@lixom.net" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [RFC 2/3] arm64: refactor save_stack_trace() References: <20150716102405.2cc8c406@gandalf.local.home> <12F47692-3010-4886-B87D-3D7820609177@gmail.com> <20150716113115.45a17f17@gandalf.local.home> <20150716121658.7982fdf5@gandalf.local.home> <20150717124054.GE26091@leverpostej> <20150717090009.720f6bd0@gandalf.local.home> <77EA0F10-D5F6-48BD-8652-3B979A978659@gmail.com> <20150717104144.6588b2f7@gandalf.local.home> <0886A996-40E1-49E9-823C-85E55A858716@gmail.com> <1357EA74-B972-4B99-ADB0-BC7E8F06DDB5@gmail.com> <20150720162004.GL9908@arm.com> <55AD89FE.1010706@linaro.org> In-Reply-To: <55AD89FE.1010706@linaro.org> 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 07/21/2015 08:53 AM, AKASHI Takahiro wrote: > Hi > > So i don't have to repost my patch here. Please use the original > commit log message[1/3] as is. > But please keep in mind that there is still an issue that I mentioned > in the cover letter; 'Size' field is inaccurate. > = > + > and > = + > - > where "dynamic" means, for example, a variable allocated like the below: > int foo(int num) { > int array[num]; > ... > } > (See more details in my ascii art.) > > Such usage is seldom seen in the kernel, and is > likely equal to . In other words, we will > see one-line *displacement* in most cases. Well, I have a quick fix now, but it looks ugly. In addition, I found another issue; With function_graph tracer, the output is like: # cat /sys/kernel/tracing/stack_trace Depth Size Location (78 entries) ----- ---- -------- 0) 6184 32 update_min_vruntime+0x14/0x74 1) 6152 48 update_curr+0x6c/0x150 2) 6104 128 enqueue_task_fair+0x2f4/0xb9c 3) 5976 48 enqueue_task+0x48/0x90 ... 18) 5160 112 hrtimer_interrupt+0xa0/0x214 19) 5048 32 arch_timer_handler_phys+0x38/0x48 20) 5016 0 ftrace_graph_caller+0x2c/0x30 21) 5016 64 ftrace_graph_caller+0x2c/0x30 22) 4952 32 ftrace_graph_caller+0x2c/0x30 23) 4920 64 ftrace_graph_caller+0x2c/0x30 ... Since, with function_graph tracer, we modify LR register in a stack frame when we enter into a function, we have to manage such special cases in save_stack_trace() or check_stack() as x86 does in print_ftrace_graph_addr(). Thanks, -Takahiro AKASHI > (We'd better mention it explicitly in the commmit?) > > Thanks, > -Takahiro AKASHI > > > On 07/21/2015 01:20 AM, Will Deacon wrote: >> Hi all, >> >> On Fri, Jul 17, 2015 at 04:34:21PM +0100, Jungseok Lee wrote: >>> On Jul 17, 2015, at 11:59 PM, Jungseok Lee wrote: >>>> On Jul 17, 2015, at 11:41 PM, Steven Rostedt wrote: >>>>> Thanks! Can you repost patch 1 with the changes I recommended, so that >>>>> I can get an Acked-by from the arm64 maintainers and pull all the >>>>> changes in together. This is fine for a 4.3 release, right? That is, it >>>>> doesn't need to go into 4.2-rcs. >>>>> >>>> >>>> It's not hard to repost a patch, but I feel like we have to wait for Akashi's response. >>>> Also, it might be needed to consider Mark's comment on arch part. >>>> >>>> If they are okay, I will proceed. >>> >>> The [RFC 1/3] patch used in my environment is shaped as follows. >>> I leave the hunk for *only* clear synchronization. This is why I choose this format >>> instead of reposting a patch. I hope it would help to track down this thread. >>> >>> I think this is my best at this point. >>> >>> ----8<---- >>> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h >>> index c5534fa..2b43e20 100644 >>> --- a/arch/arm64/include/asm/ftrace.h >>> +++ b/arch/arm64/include/asm/ftrace.h >>> @@ -13,8 +13,9 @@ >>> >>> #include >>> >>> -#define MCOUNT_ADDR ((unsigned long)_mcount) >>> -#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE >>> +#define MCOUNT_ADDR ((unsigned long)_mcount) >>> +#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE >>> +#define FTRACE_STACK_FRAME_OFFSET AARCH64_INSN_SIZE >>> >>> #ifndef __ASSEMBLY__ >>> #include >>> diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c >>> index 407991b..9ab67af 100644 >>> --- a/arch/arm64/kernel/stacktrace.c >>> +++ b/arch/arm64/kernel/stacktrace.c >>> @@ -20,6 +20,7 @@ >>> #include >>> #include >>> >>> +#include >>> #include >>> >>> /* >>> @@ -52,7 +53,7 @@ int notrace unwind_frame(struct stackframe *frame) >>> * -4 here because we care about the PC at time of bl, >>> * not where the return will go. >>> */ >>> - frame->pc = *(unsigned long *)(fp + 8) - 4; >>> + frame->pc = *(unsigned long *)(fp + 8) - AARCH64_INSN_SIZE; >>> >>> return 0; >>> } >> >> The arm64 bits look fine to me: >> >> Acked-by: Will Deacon >> >> Steve: feel free to take this along with the other ftrace changes. I don't >> anticipate any conflicts, but if anything crops up in -next we can sort >> it out then. >> >> Thanks! >> >> Will >> From mboxrd@z Thu Jan 1 00:00:00 1970 From: takahiro.akashi@linaro.org (AKASHI Takahiro) Date: Tue, 21 Jul 2015 19:26:39 +0900 Subject: [RFC 2/3] arm64: refactor save_stack_trace() In-Reply-To: <55AD89FE.1010706@linaro.org> References: <20150716102405.2cc8c406@gandalf.local.home> <12F47692-3010-4886-B87D-3D7820609177@gmail.com> <20150716113115.45a17f17@gandalf.local.home> <20150716121658.7982fdf5@gandalf.local.home> <20150717124054.GE26091@leverpostej> <20150717090009.720f6bd0@gandalf.local.home> <77EA0F10-D5F6-48BD-8652-3B979A978659@gmail.com> <20150717104144.6588b2f7@gandalf.local.home> <0886A996-40E1-49E9-823C-85E55A858716@gmail.com> <1357EA74-B972-4B99-ADB0-BC7E8F06DDB5@gmail.com> <20150720162004.GL9908@arm.com> <55AD89FE.1010706@linaro.org> Message-ID: <55AE1E5F.6060407@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 07/21/2015 08:53 AM, AKASHI Takahiro wrote: > Hi > > So i don't have to repost my patch here. Please use the original > commit log message[1/3] as is. > But please keep in mind that there is still an issue that I mentioned > in the cover letter; 'Size' field is inaccurate. > = > + > and > = + > - > where "dynamic" means, for example, a variable allocated like the below: > int foo(int num) { > int array[num]; > ... > } > (See more details in my ascii art.) > > Such usage is seldom seen in the kernel, and is > likely equal to . In other words, we will > see one-line *displacement* in most cases. Well, I have a quick fix now, but it looks ugly. In addition, I found another issue; With function_graph tracer, the output is like: # cat /sys/kernel/tracing/stack_trace Depth Size Location (78 entries) ----- ---- -------- 0) 6184 32 update_min_vruntime+0x14/0x74 1) 6152 48 update_curr+0x6c/0x150 2) 6104 128 enqueue_task_fair+0x2f4/0xb9c 3) 5976 48 enqueue_task+0x48/0x90 ... 18) 5160 112 hrtimer_interrupt+0xa0/0x214 19) 5048 32 arch_timer_handler_phys+0x38/0x48 20) 5016 0 ftrace_graph_caller+0x2c/0x30 21) 5016 64 ftrace_graph_caller+0x2c/0x30 22) 4952 32 ftrace_graph_caller+0x2c/0x30 23) 4920 64 ftrace_graph_caller+0x2c/0x30 ... Since, with function_graph tracer, we modify LR register in a stack frame when we enter into a function, we have to manage such special cases in save_stack_trace() or check_stack() as x86 does in print_ftrace_graph_addr(). Thanks, -Takahiro AKASHI > (We'd better mention it explicitly in the commmit?) > > Thanks, > -Takahiro AKASHI > > > On 07/21/2015 01:20 AM, Will Deacon wrote: >> Hi all, >> >> On Fri, Jul 17, 2015 at 04:34:21PM +0100, Jungseok Lee wrote: >>> On Jul 17, 2015, at 11:59 PM, Jungseok Lee wrote: >>>> On Jul 17, 2015, at 11:41 PM, Steven Rostedt wrote: >>>>> Thanks! Can you repost patch 1 with the changes I recommended, so that >>>>> I can get an Acked-by from the arm64 maintainers and pull all the >>>>> changes in together. This is fine for a 4.3 release, right? That is, it >>>>> doesn't need to go into 4.2-rcs. >>>>> >>>> >>>> It's not hard to repost a patch, but I feel like we have to wait for Akashi's response. >>>> Also, it might be needed to consider Mark's comment on arch part. >>>> >>>> If they are okay, I will proceed. >>> >>> The [RFC 1/3] patch used in my environment is shaped as follows. >>> I leave the hunk for *only* clear synchronization. This is why I choose this format >>> instead of reposting a patch. I hope it would help to track down this thread. >>> >>> I think this is my best at this point. >>> >>> ----8<---- >>> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h >>> index c5534fa..2b43e20 100644 >>> --- a/arch/arm64/include/asm/ftrace.h >>> +++ b/arch/arm64/include/asm/ftrace.h >>> @@ -13,8 +13,9 @@ >>> >>> #include >>> >>> -#define MCOUNT_ADDR ((unsigned long)_mcount) >>> -#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE >>> +#define MCOUNT_ADDR ((unsigned long)_mcount) >>> +#define MCOUNT_INSN_SIZE AARCH64_INSN_SIZE >>> +#define FTRACE_STACK_FRAME_OFFSET AARCH64_INSN_SIZE >>> >>> #ifndef __ASSEMBLY__ >>> #include >>> diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c >>> index 407991b..9ab67af 100644 >>> --- a/arch/arm64/kernel/stacktrace.c >>> +++ b/arch/arm64/kernel/stacktrace.c >>> @@ -20,6 +20,7 @@ >>> #include >>> #include >>> >>> +#include >>> #include >>> >>> /* >>> @@ -52,7 +53,7 @@ int notrace unwind_frame(struct stackframe *frame) >>> * -4 here because we care about the PC at time of bl, >>> * not where the return will go. >>> */ >>> - frame->pc = *(unsigned long *)(fp + 8) - 4; >>> + frame->pc = *(unsigned long *)(fp + 8) - AARCH64_INSN_SIZE; >>> >>> return 0; >>> } >> >> The arm64 bits look fine to me: >> >> Acked-by: Will Deacon >> >> Steve: feel free to take this along with the other ftrace changes. I don't >> anticipate any conflicts, but if anything crops up in -next we can sort >> it out then. >> >> Thanks! >> >> Will >>