* [PATCH] Put all functions in kallsyms
@ 2003-03-31 8:14 Rusty Russell
2003-03-31 22:51 ` Andrew Morton
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Rusty Russell @ 2003-03-31 8:14 UTC (permalink / raw)
To: akpm, Kai Germaschewski; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-03-31 8:14 [PATCH] Put all functions in kallsyms Rusty Russell
@ 2003-03-31 22:51 ` Andrew Morton
2003-03-31 23:40 ` Kai Germaschewski
2003-04-01 0:46 ` Keith Owens
2 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2003-03-31 22:51 UTC (permalink / raw)
To: Rusty Russell; +Cc: kai, linux-kernel
Rusty Russell <rusty@rustcorp.com.au> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-03-31 8:14 [PATCH] Put all functions in kallsyms Rusty Russell
2003-03-31 22:51 ` Andrew Morton
@ 2003-03-31 23:40 ` Kai Germaschewski
2003-04-01 5:40 ` Rusty Russell
2003-04-01 0:46 ` Keith Owens
2 siblings, 1 reply; 7+ messages in thread
From: Kai Germaschewski @ 2003-03-31 23:40 UTC (permalink / raw)
To: Rusty Russell; +Cc: akpm, linux-kernel
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-03-31 8:14 [PATCH] Put all functions in kallsyms Rusty Russell
2003-03-31 22:51 ` Andrew Morton
2003-03-31 23:40 ` Kai Germaschewski
@ 2003-04-01 0:46 ` Keith Owens
2003-04-01 1:59 ` Rusty Russell
2003-04-02 12:11 ` Roman Zippel
2 siblings, 2 replies; 7+ messages in thread
From: Keith Owens @ 2003-04-01 0:46 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel
On Mon, 31 Mar 2003 18:14:03 +1000,
Rusty Russell <rusty@rustcorp.com.au> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-04-01 0:46 ` Keith Owens
@ 2003-04-01 1:59 ` Rusty Russell
2003-04-02 12:11 ` Roman Zippel
1 sibling, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2003-04-01 1:59 UTC (permalink / raw)
To: Keith Owens; +Cc: linux-kernel
In message <6572.1049158014@ocs3.intra.ocs.com.au> you write:
> On Mon, 31 Mar 2003 18:14:03 +1000,
> Rusty Russell <rusty@rustcorp.com.au> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-03-31 23:40 ` Kai Germaschewski
@ 2003-04-01 5:40 ` Rusty Russell
0 siblings, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2003-04-01 5:40 UTC (permalink / raw)
To: Kai Germaschewski; +Cc: akpm, linux-kernel
In message <Pine.LNX.4.44.0303311736440.10623-100000@chaos.physics.uiowa.edu> y
ou write:
> 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 ;)
Ick. Yes, the extable.c one is the killer. OK, let's do it the other
way.
How's this? (Actually tested this time).
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Include All Functions in kallsyms
Author: Rusty Russell
Status: Tested on 2.5.66-bk6
D: Introduce _sinittext and _einittext (cf. _stext and _etext), so kallsyms
D: includes __init functions.
D:
D: TODO: Use huffman name compression and 16-bit offsets (see IDE
D: oopser patch)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/alpha/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/alpha/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/alpha/vmlinux.lds.S 2003-03-18 12:21:30.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/alpha/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -32,7 +32,11 @@ SECTIONS
/* Will be freed after init */
. = ALIGN(8192); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/arm/vmlinux-armo.lds.in working-2.5.66-bk6-kallsyms-all/arch/arm/vmlinux-armo.lds.in
--- linux-2.5.66-bk6/arch/arm/vmlinux-armo.lds.in 2003-03-18 12:21:30.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/arm/vmlinux-armo.lds.in 2003-04-01 12:30:50.000000000 +1000
@@ -14,7 +14,9 @@ SECTIONS
.init : { /* Init code and data */
_stext = .;
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
__proc_info_begin = .;
*(.proc.info)
__proc_info_end = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/arm/vmlinux-armv.lds.in working-2.5.66-bk6-kallsyms-all/arch/arm/vmlinux-armv.lds.in
--- linux-2.5.66-bk6/arch/arm/vmlinux-armv.lds.in 2003-03-18 12:21:30.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/arm/vmlinux-armv.lds.in 2003-04-01 12:30:50.000000000 +1000
@@ -18,7 +18,9 @@ SECTIONS
.init : { /* Init code and data */
_stext = .;
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
__proc_info_begin = .;
*(.proc.info)
__proc_info_end = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/i386/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/i386/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/i386/vmlinux.lds.S 2003-03-18 12:21:31.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/i386/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -54,7 +54,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/ia64/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/ia64/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/ia64/vmlinux.lds.S 2003-03-18 12:21:31.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/ia64/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -96,7 +96,11 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
__init_begin = .;
.init.text : AT(ADDR(.init.text) - PAGE_OFFSET)
- { *(.init.text) }
+ {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : AT(ADDR(.init.data) - PAGE_OFFSET)
{ *(.init.data) }
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/m68k/vmlinux-std.lds working-2.5.66-bk6-kallsyms-all/arch/m68k/vmlinux-std.lds
--- linux-2.5.66-bk6/arch/m68k/vmlinux-std.lds 2003-03-18 12:21:31.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/m68k/vmlinux-std.lds 2003-04-01 12:30:50.000000000 +1000
@@ -40,7 +40,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/m68k/vmlinux-sun3.lds working-2.5.66-bk6-kallsyms-all/arch/m68k/vmlinux-sun3.lds
--- linux-2.5.66-bk6/arch/m68k/vmlinux-sun3.lds 2003-03-25 12:16:57.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/m68k/vmlinux-sun3.lds 2003-04-01 12:30:50.000000000 +1000
@@ -34,7 +34,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(8192); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/m68knommu/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/m68knommu/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/m68knommu/vmlinux.lds.S 2003-03-18 12:21:31.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/m68knommu/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -282,7 +282,9 @@ SECTIONS {
.init : {
. = ALIGN(4096);
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
*(.init.data)
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/parisc/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/parisc/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/parisc/vmlinux.lds.S 2003-03-18 12:21:32.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/parisc/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -53,7 +53,11 @@ SECTIONS
. = ALIGN(16384);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/ppc/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/ppc/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/ppc/vmlinux.lds.S 2003-03-18 12:21:32.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/ppc/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -78,7 +78,11 @@ SECTIONS
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : {
*(.init.data);
__vtop_table_begin = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/ppc64/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/ppc64/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/ppc64/vmlinux.lds.S 2003-03-18 12:21:32.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/ppc64/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -77,7 +77,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/s390/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/s390/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/s390/vmlinux.lds.S 2003-03-18 12:21:32.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/s390/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -58,7 +58,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(256);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/s390x/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/s390x/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/s390x/vmlinux.lds.S 2003-03-18 12:21:32.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/s390x/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -58,7 +58,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(256);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/sparc/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/sparc/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/sparc/vmlinux.lds.S 2003-03-18 12:21:33.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/sparc/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -34,7 +34,11 @@ SECTIONS
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
__init_text_end = .;
.init.data : { *(.init.data) }
. = ALIGN(16);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/sparc64/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/sparc64/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/sparc64/vmlinux.lds.S 2003-03-18 12:21:33.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/sparc64/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -41,7 +41,11 @@ SECTIONS
. = ALIGN(8192);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/v850/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/v850/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/v850/vmlinux.lds.S 2003-02-25 10:10:52.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/v850/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -105,7 +105,9 @@
#define RAMK_INIT_CONTENTS_NO_END \
. = ALIGN (4096) ; \
__init_start = . ; \
+ _sinittext = .; \
*(.init.text) /* 2.5 convention */ \
+ _einittext = .; \
*(.init.data) \
*(.text.init) /* 2.4 convention */ \
*(.data.init) \
@@ -125,7 +127,9 @@
/* The contents of `init' section for a ROM-resident kernel which
should go into ROM. */
#define ROMK_INIT_ROM_CONTENTS \
+ _sinittext = .; \
*(.init.text) /* 2.5 convention */ \
+ _einittext = .; \
*(.text.init) /* 2.4 convention */ \
INITCALL_CONTENTS \
INITRAMFS_CONTENTS
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/arch/x86_64/vmlinux.lds.S working-2.5.66-bk6-kallsyms-all/arch/x86_64/vmlinux.lds.S
--- linux-2.5.66-bk6/arch/x86_64/vmlinux.lds.S 2003-03-18 12:21:33.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/arch/x86_64/vmlinux.lds.S 2003-04-01 12:30:50.000000000 +1000
@@ -78,7 +78,11 @@ SECTIONS
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/kernel/extable.c working-2.5.66-bk6-kallsyms-all/kernel/extable.c
--- linux-2.5.66-bk6/kernel/extable.c 2003-02-07 19:20:44.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/kernel/extable.c 2003-04-01 12:30:50.000000000 +1000
@@ -19,7 +19,7 @@
extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];
-extern char _stext[], _etext[];
+extern char _stext[], _etext[], _sinittext[], _einittext[];
/* Given an address, look for it in the exception tables. */
const struct exception_table_entry *search_exception_tables(unsigned long addr)
@@ -38,5 +38,9 @@ int kernel_text_address(unsigned long ad
addr <= (unsigned long)_etext)
return 1;
+ if (addr >= (unsigned long)_sinittext &&
+ addr <= (unsigned long)_einittext)
+ return 1;
+
return module_text_address(addr);
}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/kernel/kallsyms.c working-2.5.66-bk6-kallsyms-all/kernel/kallsyms.c
--- linux-2.5.66-bk6/kernel/kallsyms.c 2003-02-07 19:22:28.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/kernel/kallsyms.c 2003-04-01 12:30:50.000000000 +1000
@@ -15,7 +15,22 @@ extern unsigned long kallsyms_num_syms _
extern char kallsyms_names[] __attribute__((weak));
/* Defined by the linker script. */
-extern char _stext[], _etext[];
+extern char _stext[], _etext[], _sinittext[], _einittext[];
+
+static inline int is_kernel_inittext(unsigned long addr)
+{
+ if (addr >= (unsigned long)_sinittext
+ && addr <= (unsigned long)_einittext)
+ return 1;
+ return 0;
+}
+
+static inline int is_kernel_text(unsigned long addr)
+{
+ if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
+ return 1;
+ return 0;
+}
/* Lookup an address. modname is set to NULL if it's in the kernel. */
const char *kallsyms_lookup(unsigned long addr,
@@ -31,7 +46,7 @@ const char *kallsyms_lookup(unsigned lon
namebuf[127] = 0;
namebuf[0] = 0;
- if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) {
+ if (is_kernel_text(addr) || is_kernel_inittext(addr)) {
unsigned long symbol_end;
char *name = kallsyms_names;
@@ -52,6 +67,8 @@ const char *kallsyms_lookup(unsigned lon
/* Base symbol size on next symbol. */
if (best + 1 < kallsyms_num_syms)
symbol_end = kallsyms_addresses[best + 1];
+ else if (is_kernel_inittext(addr))
+ symbol_end = (unsigned long)_einittext;
else
symbol_end = (unsigned long)_etext;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk6/scripts/kallsyms.c working-2.5.66-bk6-kallsyms-all/scripts/kallsyms.c
--- linux-2.5.66-bk6/scripts/kallsyms.c 2003-02-07 19:22:29.000000000 +1100
+++ working-2.5.66-bk6-kallsyms-all/scripts/kallsyms.c 2003-04-01 12:30:50.000000000 +1000
@@ -21,7 +21,7 @@ struct sym_entry {
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext;
+static unsigned long long _stext, _etext, _sinittext, _einittext;
static void
usage(void)
@@ -51,10 +51,8 @@ read_symbol(FILE *in, struct sym_entry *
static int
symbol_valid(struct sym_entry *s)
{
- if (s->addr < _stext)
- return 0;
-
- if (s->addr > _etext)
+ if ((s->addr < _stext || s->addr > _etext)
+ && (s->addr < _sinittext || s->addr > _einittext))
return 0;
if (strstr(s->sym, "_compiled."))
@@ -85,6 +83,10 @@ read_map(FILE *in)
_stext = table[i].addr;
if (strcmp(table[i].sym, "_etext") == 0)
_etext = table[i].addr;
+ if (strcmp(table[i].sym, "_sinittext") == 0)
+ _sinittext = table[i].addr;
+ if (strcmp(table[i].sym, "_einittext") == 0)
+ _einittext = table[i].addr;
}
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Put all functions in kallsyms
2003-04-01 0:46 ` Keith Owens
2003-04-01 1:59 ` Rusty Russell
@ 2003-04-02 12:11 ` Roman Zippel
1 sibling, 0 replies; 7+ messages in thread
From: Roman Zippel @ 2003-04-02 12:11 UTC (permalink / raw)
To: Keith Owens; +Cc: Rusty Russell, linux-kernel
Hi,
On Tue, 1 Apr 2003, Keith Owens wrote:
> 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.
Are you sure, this is still the case? I remember, that this was the main
reason that kernel_thread() is not an inline function anymore, so AFAICT
there should be no relevant data on the stack anymore which points to init
code.
bye, Roman
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-04-02 12:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31 8:14 [PATCH] Put all functions in kallsyms Rusty Russell
2003-03-31 22:51 ` Andrew Morton
2003-03-31 23:40 ` Kai Germaschewski
2003-04-01 5:40 ` Rusty Russell
2003-04-01 0:46 ` Keith Owens
2003-04-01 1:59 ` Rusty Russell
2003-04-02 12:11 ` Roman Zippel
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®