All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Jungseok Lee <jungseoklee85@gmail.com>
To: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"david.griego@linaro.org" <david.griego@linaro.org>,
	"olof@lixom.net" <olof@lixom.net>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC 2/3] arm64: refactor save_stack_trace()
Date: Tue, 21 Jul 2015 23:34:21 +0900	[thread overview]
Message-ID: <39628AC3-A593-4E48-89A5-D95F22734009@gmail.com> (raw)
In-Reply-To: <55AE1E5F.6060407@linaro.org>

On Jul 21, 2015, at 7:26 PM, AKASHI Takahiro wrote:
> 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.
>>  <reported size> = <its own dynamic local variables>
>>                         + <child's local variables>
>> and
>>  <real size> = <reported size> + <its local variables>
>>                                - <child's local variables>
>> 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 <reported size> is
>> likely equal to <child's local variables>. In other words, we will
>> see one-line *displacement* in most cases.
> 
> Well, I have a quick fix now, but it looks ugly.

AFAIU, stack_max_size would be more accurate if a separate stack
is introduced for interrupt context. However, it might be unnecessary
at this point due to complexity.

> 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().

I should have run it with function_graph. The issue is reproduced easily
on my environment. I don't see other issues yet when enabling other tracers.

Best Regards
Jungseok Lee

WARNING: multiple messages have this Message-ID (diff)
From: jungseoklee85@gmail.com (Jungseok Lee)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/3] arm64: refactor save_stack_trace()
Date: Tue, 21 Jul 2015 23:34:21 +0900	[thread overview]
Message-ID: <39628AC3-A593-4E48-89A5-D95F22734009@gmail.com> (raw)
In-Reply-To: <55AE1E5F.6060407@linaro.org>

On Jul 21, 2015, at 7:26 PM, AKASHI Takahiro wrote:
> 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.
>>  <reported size> = <its own dynamic local variables>
>>                         + <child's local variables>
>> and
>>  <real size> = <reported size> + <its local variables>
>>                                - <child's local variables>
>> 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 <reported size> is
>> likely equal to <child's local variables>. In other words, we will
>> see one-line *displacement* in most cases.
> 
> Well, I have a quick fix now, but it looks ugly.

AFAIU, stack_max_size would be more accurate if a separate stack
is introduced for interrupt context. However, it might be unnecessary
at this point due to complexity.

> 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().

I should have run it with function_graph. The issue is reproduced easily
on my environment. I don't see other issues yet when enabling other tracers.

Best Regards
Jungseok Lee

  reply	other threads:[~2015-07-21 14:34 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  5:29 [RFC 0/3] arm64: ftrace: fix incorrect output from stack tracer AKASHI Takahiro
2015-07-13  5:29 ` AKASHI Takahiro
2015-07-13  5:29 ` [RFC 1/3] ftrace: adjust a function's pc to search for in check_stack() for arm64 AKASHI Takahiro
2015-07-13  5:29   ` AKASHI Takahiro
2015-07-13 15:24   ` Steven Rostedt
2015-07-13 15:24     ` Steven Rostedt
2015-07-15  0:22     ` AKASHI Takahiro
2015-07-15  0:22       ` AKASHI Takahiro
2015-07-13  5:29 ` [RFC 2/3] arm64: refactor save_stack_trace() AKASHI Takahiro
2015-07-13  5:29   ` AKASHI Takahiro
2015-07-14 12:47   ` Jungseok Lee
2015-07-14 12:47     ` Jungseok Lee
2015-07-14 13:31     ` Steven Rostedt
2015-07-14 13:31       ` Steven Rostedt
2015-07-15  0:20       ` AKASHI Takahiro
2015-07-15  0:20         ` AKASHI Takahiro
2015-07-15  2:51         ` Steven Rostedt
2015-07-15  2:51           ` Steven Rostedt
2015-07-15 11:41           ` AKASHI Takahiro
2015-07-15 11:41             ` AKASHI Takahiro
2015-07-15 14:55             ` Steven Rostedt
2015-07-15 14:55               ` Steven Rostedt
2015-07-15 16:13               ` Steven Rostedt
2015-07-15 16:13                 ` Steven Rostedt
2015-07-16  0:27                 ` AKASHI Takahiro
2015-07-16  0:27                   ` AKASHI Takahiro
2015-07-16  1:08                   ` AKASHI Takahiro
2015-07-16  1:08                     ` AKASHI Takahiro
2015-07-16  1:38                     ` Steven Rostedt
2015-07-16  1:38                       ` Steven Rostedt
2015-07-17 10:46                       ` Will Deacon
2015-07-17 10:46                         ` Will Deacon
2015-07-16 13:29                     ` Jungseok Lee
2015-07-16 13:29                       ` Jungseok Lee
2015-07-16 13:54                       ` Jungseok Lee
2015-07-16 13:54                         ` Jungseok Lee
2015-07-16 14:24                       ` Steven Rostedt
2015-07-16 14:24                         ` Steven Rostedt
2015-07-16 15:01                         ` Jungseok Lee
2015-07-16 15:01                           ` Jungseok Lee
2015-07-16 15:31                           ` Steven Rostedt
2015-07-16 15:31                             ` Steven Rostedt
2015-07-16 15:52                             ` Jungseok Lee
2015-07-16 15:52                               ` Jungseok Lee
2015-07-16 20:22                               ` Steven Rostedt
2015-07-16 20:22                                 ` Steven Rostedt
2015-07-17  2:49                                 ` AKASHI Takahiro
2015-07-17  2:49                                   ` AKASHI Takahiro
2015-07-17  3:21                                   ` Steven Rostedt
2015-07-17  3:21                                     ` Steven Rostedt
2015-07-16 16:16                             ` Steven Rostedt
2015-07-16 16:16                               ` Steven Rostedt
2015-07-17 12:40                               ` Mark Rutland
2015-07-17 12:40                                 ` Mark Rutland
2015-07-17 12:51                                 ` Steven Rostedt
2015-07-17 12:51                                   ` Steven Rostedt
2015-07-17 13:00                                 ` Steven Rostedt
2015-07-17 13:00                                   ` Steven Rostedt
2015-07-17 14:28                                   ` Jungseok Lee
2015-07-17 14:28                                     ` Jungseok Lee
2015-07-17 14:41                                     ` Steven Rostedt
2015-07-17 14:41                                       ` Steven Rostedt
2015-07-17 14:59                                       ` Jungseok Lee
2015-07-17 14:59                                         ` Jungseok Lee
2015-07-17 15:34                                         ` Jungseok Lee
2015-07-17 15:34                                           ` Jungseok Lee
2015-07-17 16:01                                           ` Steven Rostedt
2015-07-17 16:01                                             ` Steven Rostedt
2015-07-20 16:20                                           ` Will Deacon
2015-07-20 16:20                                             ` Will Deacon
2015-07-20 23:53                                             ` AKASHI Takahiro
2015-07-20 23:53                                               ` AKASHI Takahiro
2015-07-21 10:26                                               ` AKASHI Takahiro
2015-07-21 10:26                                                 ` AKASHI Takahiro
2015-07-21 14:34                                                 ` Jungseok Lee [this message]
2015-07-21 14:34                                                   ` Jungseok Lee
2015-08-03  9:09                                             ` Will Deacon
2015-08-03  9:09                                               ` Will Deacon
2015-08-03 14:01                                               ` Steven Rostedt
2015-08-03 14:01                                                 ` Steven Rostedt
2015-08-03 14:04                                                 ` Will Deacon
2015-08-03 14:04                                                   ` Will Deacon
2015-08-03 16:30                                               ` Jungseok Lee
2015-08-03 16:30                                                 ` Jungseok Lee
2015-08-03 16:57                                                 ` Steven Rostedt
2015-08-03 16:57                                                   ` Steven Rostedt
2015-08-03 17:22                                                   ` Jungseok Lee
2015-08-03 17:22                                                     ` Jungseok Lee
2015-08-03 17:32                                                     ` Steven Rostedt
2015-08-03 17:32                                                       ` Steven Rostedt
2015-08-04  7:41                                                       ` AKASHI Takahiro
2015-08-04  7:41                                                         ` AKASHI Takahiro
2015-07-17  2:04                       ` AKASHI Takahiro
2015-07-17  2:04                         ` AKASHI Takahiro
2015-07-17 14:38                         ` Jungseok Lee
2015-07-17 14:38                           ` Jungseok Lee
2015-07-16 14:28                     ` Mark Rutland
2015-07-16 14:28                       ` Mark Rutland
2015-07-16 14:34                       ` Steven Rostedt
2015-07-16 14:34                         ` Steven Rostedt
2015-07-17  2:09                         ` AKASHI Takahiro
2015-07-17  2:09                           ` AKASHI Takahiro
2015-07-13  5:29 ` [RFC 3/3] arm64: ftrace: mcount() should not create a stack frame AKASHI Takahiro
2015-07-13  5:29   ` AKASHI Takahiro
2015-07-13 15:01 ` [RFC 0/3] arm64: ftrace: fix incorrect output from stack tracer Jungseok Lee
2015-07-13 15:01   ` Jungseok Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39628AC3-A593-4E48-89A5-D95F22734009@gmail.com \
    --to=jungseoklee85@gmail.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Mark.Rutland@arm.com \
    --cc=broonie@kernel.org \
    --cc=david.griego@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=rostedt@goodmis.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.