mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Subject: Re: doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots)
Date: Sun, 02 Mar 2003 17:12:19 +1100	[thread overview]
Message-ID: <22612.1046585539@ocs3.intra.ocs.com.au> (raw)
In-Reply-To: Your message of "Thu, 27 Feb 2003 10:50:56 -0800." <20030227105056.3fd76ac6.rddunlap@osdl.org>

Linus Torvalds <torvalds@transmeta.com> wrote:
> A sorted list of bad stack users (more than 256 bytes) in my default build
> follows. Anybody can create their own with something like
> 
> 	objdump -d linux/vmlinux |
> 		grep 'sub.*$0x...,.*esp' |
> 		awk '{ print $9,$1 }' |
> 		sort > bigstack
> 
> and a script to look up the addresses.
> 
> Yeah, and this assumes we don't have alloca() users or other dynamic 
> stack allocators (non-constant-size automatic arrays). I hope we don't 
> have that kind of crap anywhere..

We do.

kernel.stack identifies big offenders, dynamic stacks and tells you
which procedure is at fault.  This must be at least the fifth time I
have published this script.

#!/bin/bash
#
#	Run a compiled ix86 kernel and print large local stack usage.
#
#	/>:/{s/[<>:]*//g; h; }   On lines that contain '>:' (headings like
#	c0100000 <_stext>:), remove <, > and : and hold the line.  Identifies
#	the procedure and its start address.
#
#	/subl\?.*\$0x[^,][^,][^,].*,%esp/{    Select lines containing
#	subl\?...0x...,%esp but only if there are at least 3 digits between 0x and
#	,%esp.  These are local stacks of at least 0x100 bytes.
#
#	s/.*$0x\([^,]*\).*/\1/;   Extract just the stack adjustment
#	/^[89a-f].......$/d;   Ignore lines with 8 digit offsets that are 
#	negative.  Some compilers adjust the stack on exit, seems to be related
#	to goto statements
#	G;   Append the held line (procedure and start address).
#	s/\(.*\)\n.* \(.*\)/\1 \2/;  Remove the newline and procedure start 
#	address.  Leaves just stack size and procedure name.
#	p; };   Print stack size and procedure name.
#
#	/subl\?.*%.*,%esp/{   Selects adjustment of %esp by register, dynamic 
#	arrays on stack.
#	G;   Append the held line (procedure and start address).
#	s/\(.*\)\n\(.*\)/Dynamic \2 \1/;   Reformat to "Dynamic", procedure 
#	start address, procedure name and the instruction that adjusts the
#	stack, including its offset within the proc.
#	p; };   Print the dynamic line.
#
#
#	Leading spaces in the sed string are required.
#
objdump --disassemble "$@" | \
sed -ne '/>:/{s/[<>:]*//g; h; }
 /subl\?.*\$0x[^,][^,][^,].*,%esp/{
 s/.*\$0x\([^,]*\).*/\1/; /^[89a-f].......$/d; G; s/\(.*\)\n.* \(.*\)/\1 \2/; p; };
 /subl\?.*%.*,%esp/{ G; s/\(.*\)\n\(.*\)/Dynamic \2 \1/; p; }; ' | \
sort


  parent reply	other threads:[~2003-03-02  6:02 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-17 23:18 Linux v2.5.62 Linus Torvalds
2003-02-18  0:03 ` Linux v2.5.62 --- spontaneous reboots Chris Wedgwood
2003-02-18  0:44   ` Jeff Garzik
2003-02-18  0:46     ` Chris Wedgwood
2003-02-18  1:42   ` Linus Torvalds
2003-02-18  1:53     ` Chris Wedgwood
2003-02-18  2:02       ` Linus Torvalds
2003-02-18  2:16         ` Chris Wedgwood
2003-02-18  2:33           ` Linus Torvalds
2003-02-18  3:21         ` Martin J. Bligh
2003-02-19 11:02         ` David Ford
2003-02-18 21:44     ` Chris Wedgwood
2003-02-18 21:59       ` Chris Wedgwood
2003-02-18 22:13         ` Linus Torvalds
2003-02-18 22:34           ` Linus Torvalds
2003-02-18 23:01         ` Chris Wedgwood
2003-02-19 23:35           ` doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots) Linus Torvalds
2003-02-20  2:22             ` Zwane Mwaikambo
2003-02-20  2:26               ` William Lee Irwin III
2003-02-20  2:55                 ` Zwane Mwaikambo
2003-02-20  3:15                   ` William Lee Irwin III
2003-02-20  4:52               ` Linus Torvalds
2003-02-20  5:07                 ` William Lee Irwin III
2003-02-20  6:05                 ` Zwane Mwaikambo
2003-02-20 11:46                 ` Ingo Molnar
2003-02-20 12:12                   ` William Lee Irwin III
2003-02-20 12:33                     ` Ingo Molnar
2003-02-20 14:03                       ` Zwane Mwaikambo
2003-02-20 14:00                   ` Zwane Mwaikambo
2003-02-20 15:43                   ` Linus Torvalds
2003-02-20 15:52                     ` Ingo Molnar
2003-02-20 16:11                     ` Martin J. Bligh
2003-02-20 16:54                       ` Linus Torvalds
2003-02-20 17:24                         ` Jeff Garzik
2003-02-20 21:21                         ` Alan Cox
2003-02-20 20:20                           ` Linus Torvalds
2003-02-20 20:23                           ` Martin J. Bligh
2003-02-20 20:42                             ` William Lee Irwin III
2003-02-20 20:51                               ` Linus Torvalds
2003-02-21  7:39                         ` [PATCH] snd_pcm_oss_change_params is a stack offender Muli Ben-Yehuda
2003-02-21  7:58                           ` Andreas Dilger
2003-02-21  8:20                             ` Muli Ben-Yehuda
2003-02-27 18:50                         ` doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots) Randy.Dunlap
2003-02-27 19:39                           ` Muli Ben-Yehuda
2003-02-27 19:47                             ` Randy.Dunlap
2003-03-02  6:12                           ` Keith Owens [this message]
2003-02-27 23:32                         ` Randy.Dunlap
2003-02-20 23:09                       ` Chris Wedgwood
2003-02-20 16:44                     ` Ingo Molnar
2003-02-20 20:13                     ` Chris Wedgwood
2003-02-18 12:13   ` Linux v2.5.62 --- spontaneous reboots Pavel Machek
2003-02-19 10:53 ` Linux v2.5.62 David Ford
2003-02-19  6:49   ` Thomas Molina
2003-02-19 11:04   ` Duncan Sands
2003-02-19 11:07     ` William Lee Irwin III
2003-02-19 11:58       ` Duncan Sands
2003-02-19 12:04         ` William Lee Irwin III
2003-02-19 11:17   ` Hirling Endre
2003-02-19 11:24     ` Duncan Sands
2003-02-19 11:52       ` Hirling Endre
2003-02-19 18:50   ` Zilvinas Valinskas
2003-02-19 21:46     ` Remco Post
2003-02-19 22:23       ` Remco Post
2003-02-20  1:13         ` Tom Rini
2003-02-20 19:42           ` Remco Post
2003-02-20 19:46             ` Tom Rini
2003-02-20 20:05               ` Remco Post
2003-02-20 13:31     ` Dave Jones
2003-02-20 13:57       ` Zilvinas Valinskas
2003-02-20 14:31         ` Dave Jones
2003-02-21  3:58     ` Alexander Hoogerhuis
2003-02-22  5:34       ` Alexander Hoogerhuis
     [not found] <Pine.LNX.4.44.0302201830580.474-100000@localhost.localdomain>
2003-02-20 18:01 ` doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots) Linus Torvalds
2003-02-20 18:23   ` Linus Torvalds
2003-02-20 19:36     ` Ingo Molnar
2003-02-20 19:53       ` Ingo Molnar
2003-02-20 19:57         ` Ingo Molnar
2003-02-20 20:14           ` Ingo Molnar
2003-02-20 20:17           ` Linus Torvalds
2003-02-20 20:50             ` Andrew Morton
2003-02-20 22:04               ` Ingo Molnar
2003-02-20 22:42                 ` William Lee Irwin III
2003-02-21  7:05                   ` Ingo Molnar
2003-02-20 22:00             ` Ingo Molnar
2003-02-20 22:32               ` Linus Torvalds
2003-02-20 22:40                 ` Linus Torvalds
2003-02-20 22:45                   ` Linus Torvalds
2003-02-20 22:57                 ` John Levon
2003-02-20 23:21                 ` Ingo Molnar
2003-02-20 23:36                   ` Linus Torvalds
2003-02-21  7:00                     ` Ingo Molnar
2003-02-21 15:05                       ` Linus Torvalds
2003-02-20 19:00   ` Ingo Molnar

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=22612.1046585539@ocs3.intra.ocs.com.au \
    --to=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /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®