From: Gilboa Davara <gilboad@gmail.com>
To: Satyam Sharma <satyam.sharma@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Reduce __print_symbol/sprint_symbol stack usage.
Date: Sat, 15 Sep 2007 21:08:01 +0300 [thread overview]
Message-ID: <1189879681.18191.93.camel@gilboa-home-dev.localdomain> (raw)
In-Reply-To: <1189869329.18191.77.camel@gilboa-home-dev.localdomain>
Hello all, Satyam,
This is my second stab at solving the "stack over flow due to
dump_strace when close to stack-overflow is detected by do_IRQ" problem.
(Hopefully) this patch is creates less noise then the previous one.
[snip]
> I'll try and create an option 2 (static allocation, minimal locking)
> patch and post ASAP.
> Hopefully it'll fare better. (While keeping the current interface intact
> and reducing the damage/noise)
>
> - Gilboa
- Gilboa
--- linux-2.6/kernel/kallsyms.orig 2007-09-15 11:46:54.000000000 +0300
+++ linux-2.6/kernel/kallsyms.c 2007-09-15 21:06:55.000000000 +0300
@@ -306,13 +306,14 @@ int lookup_symbol_attrs(unsigned long ad
return lookup_module_symbol_attrs(addr, size, offset, modname, name);
}
-/* Look up a kernel symbol and return it in a text buffer. */
-int sprint_symbol(char *buffer, unsigned long address)
+/* Internal version:
+ Look up a kernel symbol and module name and return them to the
+ caller's buffer/namebuf buffers. */
+int __sprint_symbol(char *buffer, char *namebuf, unsigned long address)
{
- char *modname;
- const char *name;
unsigned long offset, size;
- char namebuf[KSYM_NAME_LEN];
+ const char *name;
+ char *modname;
name = kallsyms_lookup(address, &size, &offset, &modname, namebuf);
if (!name)
@@ -325,14 +326,35 @@ int sprint_symbol(char *buffer, unsigned
return sprintf(buffer, "%s+%#lx/%#lx", name, offset, size);
}
+/* Exported version:
+ Look up a kernel symbol and return it in a text buffer. */
+int sprint_symbol(char *buffer, unsigned long address)
+{
+ char namebuf[KSYM_NAME_LEN];
+
+ return __sprint_symbol(buffer, namebuf, address);
+}
+
+static DEFINE_SPINLOCK(symbol_lock);
+
/* Look up a kernel symbol and print it to the kernel messages. */
void __print_symbol(const char *fmt, unsigned long address)
{
- char buffer[KSYM_SYMBOL_LEN];
+ /* Use static buffers instead of char array to reduce
+ stack footprint in i386/4KSTACKS.
+ Buffers must be protected against re-entry. */
+ static char namebuf[KSYM_NAME_LEN];
+ static char buffer[KSYM_SYMBOL_LEN];
+ unsigned long flags;
+
- sprint_symbol(buffer, address);
+ spin_lock_irqsave(&symbol_lock, flags);
+
+ __sprint_symbol(buffer, namebuf, address);
printk(fmt, buffer);
+
+ spin_unlock_irqrestore(&symbol_lock, flags);
}
/* To avoid using get_symbol_offset for every symbol, we carry prefix
along. */
next prev parent reply other threads:[~2007-09-15 18:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-15 11:35 [Minor patch] " Gilboa Davara
2007-09-15 13:02 ` Satyam Sharma
2007-09-15 15:15 ` Gilboa Davara
2007-09-15 18:08 ` Gilboa Davara [this message]
2007-09-19 1:00 ` [PATCH] " 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
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=1189879681.18191.93.camel@gilboa-home-dev.localdomain \
--to=gilboad@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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®