mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mike Snitzer" <snitzer@gmail.com>
To: "Eric Sandeen" <sandeen@redhat.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Jesper Juhl" <jesper.juhl@gmail.com>
Subject: Re: 4KSTACKS + DEBUG_STACKOVERFLOW harmful
Date: Wed, 28 May 2008 10:36:07 -0400	[thread overview]
Message-ID: <170fa0d20805280736hfe19c3m790c435ff3949441@mail.gmail.com> (raw)
In-Reply-To: <46D5F462.9010401@redhat.com>

On Wed, Aug 29, 2007 at 6:34 PM, Eric Sandeen <sandeen@redhat.com> wrote:
> Noticed today that the combination of 4KSTACKS and DEBUG_STACKOVERFLOW
> config options is a bit deadly.
>
> DEBUG_STACKOVERFLOW warns in do_IRQ if we're within THREAD_SIZE/8 of the
> end of useable stack space, or 512 bytes on a 4k stack.
>
> If we are, then it goes down the dump_stack path, which uses most, if
> not all, of the remaining stack, thereby turning a well-intentioned
> warning into a full-blown catastrophe.
>
> The callchain from the warning looks something like this, with stack
> usage shown as found on my x86 box:
>
> 4 dump_stack
> 4   show_trace
> 8     show_trace_log_lvl
> 4       dump_trace
>          print_context_stack
> 12          print_trace_address
>              print_symbol
> 232             __print_symbol
> 164               sprint_symbol
> 20                  printk
> ___
> 448
>
> 448 bytes to tell us that we're within 512 bytes (or less) of certain
> doom... and I think there's call overhead on top of that?
>
> The large stack usage in those 2 functions is due to big char arrays, of
> size KSYM_NAME_LEN (128 bytes) and KSYM_SYMBOL_LEN (223 bytes).
>
> IOW, the stack warning effectively reduces useful stack left in our itty
> bitty 4k stacks by over 10%.

Hi Eric,

Did you happen to get a patch together that reduces the stack usage of
dump_stack?

Also, what did you use to print your (above) indented callchain stack
usage of dump_stack?

I'd like to be able to audit the worst case stack usage of _all_ call
chains that originate from a given thread. This would effectively be
like DEBUG_STACK_USAGE except with finer grained (per call-chain)
statistics.  One crude way of doing this is to dump_stack() whenever a
task's call-chain is the new "winner" as the biggest stack hog.

To do this safely it would seem to me that a leaner dump_stack() is needed...

Lastly, would it be reasonable to utilize systemtap to implement what
I described above?  I'm actually looking to debug 4KSTACKS as
unobtrusively as possible so as to not alter the underlying kernel (in
this case it happens to be a RHEL5 kernel but this could apply to any
kernel).

please advise, thanks.

  parent reply	other threads:[~2008-05-28 14:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-29 22:34 Eric Sandeen
2007-08-29 22:53 ` Jesper Juhl
2007-08-29 23:01   ` Eric Sandeen
2007-08-29 23:55     ` Kyle Moffett
2007-08-31 11:11 ` Denys Vlasenko
2007-08-31 14:35   ` Jörn Engel
2007-08-31 17:16     ` Denys Vlasenko
2008-05-28 14:36 ` Mike Snitzer [this message]
2008-05-28 15:13   ` Eric Sandeen

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=170fa0d20805280736hfe19c3m790c435ff3949441@mail.gmail.com \
    --to=snitzer@gmail.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®