From: Gilboa Davara <gilboad@gmail.com>
To: Paulo Marques <pmarques@grupopie.com>
Cc: linux-kernel@vger.kernel.org, Satyam Sharma <satyam.sharma@gmail.com>
Subject: Re: [PATCH] Reduce __print_symbol/sprint_symbol stack usage. (v3)
Date: Fri, 21 Sep 2007 18:19:08 +0200 [thread overview]
Message-ID: <1190391548.30016.99.camel@gilboa-home-dev.localdomain> (raw)
In-Reply-To: <46F3EB15.3050706@grupopie.com>
On Fri, 2007-09-21 at 17:02 +0100, Paulo Marques wrote:
> Gilboa Davara wrote:
> > Hello all,
>
> Hi, Gilboa
>
> > (1) Problem:
> > I. When CONFIG_4KSTACKS and CONFIG_DEBUG_STACKOVERFLOW are enabled on
> > i386 kernels, do_IRQ calls dump_stack which, down the path, uses
> > print_symbol (display) and sprint_symbol (format) to format and display
> > the function name/address/module.
> > Both function use stack based char array (~350 bytes) that, given the
> > initial state (<512 bytes of stack space) may overrun the stack.
> > II. (Comments - previous patches) Using spinlock protected static
> > storage within these functions might block or even deadlock dump_stack
> > (E.g. Crash within dump_stack itself)
> >
> > (2) Solution:
> > I. Break sprint_symbol into sprint_symbol (API functions; keeps the
> > current interface) and sprint_symbol_helper (helper function with
> > minimal local storage).
> > II. Replace the char array in __print_symbol with two spinlock protected
> > static char arrays; call the __sprint_symbol helper function instead of
> > sprint_symbol.
> > III. Ignore the spinlock if oops_in_progress is set.
>
> This is getting more and more convoluted :(
>
> The problem with the spinlock isn't just that during a panic, we can not
> trust the kernel structures enough to use spinlocks. It might well
> happen that lockdep code might want to use print_symbol (and I think it
> does, so this is not just theoretical) to dump the stack when someone
> calls spin_lock_irqsave.
> But now, because print_symbol itself uses spin_lock_irqsave, we might
> get into a recursive situation and a produce a deadlock.
>
> On the other hand, if you take the other approach of reducing the stack
> usage by creating a printk_symbol interface, the stack usage would drop
> from 350 bytes to 128 bytes and your problem would go away entirely.
>
OK. I'll wait for additional comments while thinking about a third
route. (Following your suggestion)
- Gilboa
next prev parent reply other threads:[~2007-09-21 16:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-15 11:35 [Minor patch] Reduce __print_symbol/sprint_symbol stack usage Gilboa Davara
2007-09-15 13:02 ` Satyam Sharma
2007-09-15 15:15 ` Gilboa Davara
2007-09-15 18:08 ` [PATCH] " Gilboa Davara
2007-09-19 1:00 ` Satyam Sharma
2007-09-19 14:25 ` Paulo Marques
2007-09-21 12:45 ` Gilboa Davara
2007-09-21 14:21 ` Paulo Marques
2007-09-21 14:57 ` Gilboa Davara
2007-09-21 14:56 ` Steven Rostedt
2007-09-21 15:47 ` Paulo Marques
2007-09-21 12:31 ` Gilboa Davara
2007-09-21 14:28 ` [PATCH] Reduce __print_symbol/sprint_symbol stack usage. (v3) Gilboa Davara
2007-09-21 16:02 ` Paulo Marques
2007-09-21 16:19 ` Gilboa Davara [this message]
2007-09-21 14:47 ` [Minor patch] Reduce __print_symbol/sprint_symbol stack usage Steven Rostedt
2007-09-21 14:53 ` Gilboa Davara
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=1190391548.30016.99.camel@gilboa-home-dev.localdomain \
--to=gilboad@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmarques@grupopie.com \
--cc=satyam.sharma@gmail.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®