Hi all,
Simple, untested patch. Any objections?
Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Include All Functions in kallsyms
Author: Rusty Russell
Status: Experimental
D: Do not discard functions outside _stext and _etext, but include all
D: 't' or 'T' functions. This means __init functions are included (in my
D: config this means an increas from 5691 to 6442 functions.
D:
D: TODO: Allow multiple kallsym tables, discard init one after init.
D: TODO: Use huffman name compression and 16-bit offsets (see IDE
D: oopser patch)
--- working-2.5.66-uml/scripts/kallsyms.c.~1~ 2003-02-07 19:22:29.000000000 +1100
+++ working-2.5.66-uml/scripts/kallsyms.c 2003-03-31 18:08:41.000000000 +1000
@@ -14,14 +14,12 @@
struct sym_entry {
unsigned long long addr;
- char type;
char *sym;
};
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext;
static void
usage(void)
@@ -35,8 +33,9 @@
{
char str[500];
int rc;
+ char type;
- rc = fscanf(in, "%llx %c %499s\n", &s->addr, &s->type, str);
+ rc = fscanf(in, "%llx %c %499s\n", &s->addr, &type, str);
if (rc != 3) {
if (rc != EOF) {
/* skip line */
@@ -44,19 +43,18 @@
}
return -1;
}
+
+ /* Only interested in functions. */
+ if (type != 't' && type != 'T')
+ return -1;
+
s->sym = strdup(str);
return 0;
}
-static int
+static inline int
symbol_valid(struct sym_entry *s)
{
- if (s->addr < _stext)
- return 0;
-
- if (s->addr > _etext)
- return 0;
-
if (strstr(s->sym, "_compiled."))
return 0;
@@ -80,12 +78,6 @@
if (read_symbol(in, &table[cnt]) == 0)
cnt++;
}
- for (i = 0; i < cnt; i++) {
- if (strcmp(table[i].sym, "_stext") == 0)
- _stext = table[i].addr;
- if (strcmp(table[i].sym, "_etext") == 0)
- _etext = table[i].addr;
- }
}
static void
Rusty Russell <[email protected]> wrote:
>
> Hi all,
>
> Simple, untested patch. Any objections?
Seems OK to me. The only people who are likely to have large numbers of
__init symbols are those who compile their own kernels. They know how to
strip stuff down and they know to turn kallsyms off altogether if they have a
space problem.
And initcalls are a popular place to go oops.
On Mon, 31 Mar 2003, Rusty Russell wrote:
> Simple, untested patch. Any objections?
No objection, but you need to adapt the test in
kernel/kallsyms.c:
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) {
and in kernel/extable.c:
if (addr >= (unsigned long)_stext &&
addr <= (unsigned long)_etext)
Otherwise, you'd just add bloat with no gain at all ;)
--Kai
On Mon, 31 Mar 2003 18:14:03 +1000,
Rusty Russell <[email protected]> wrote:
>D: TODO: Allow multiple kallsym tables, discard init one after init.
Don't. Almost all kernel threads have a backtrace that goes through
__init code, even though that code no longer exists. The symbols are
still needed to get a decent backtrace and the overhead is minimal.
In message <[email protected]> you write:
> On Mon, 31 Mar 2003 18:14:03 +1000,
> Rusty Russell <[email protected]> wrote:
> >D: TODO: Allow multiple kallsym tables, discard init one after init.
>
> Don't. Almost all kernel threads have a backtrace that goes through
> __init code, even though that code no longer exists. The symbols are
> still needed to get a decent backtrace and the overhead is minimal.
Hi Keith,
Excellent point. Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.