Skip to contentSkip to conversation

kallsyms: add kallsyms_seqs_of_names to list of special symbols

PATCH In review Arnd Bergmann 3 participants 5 messages Mar 6, 2023 – Mar 7, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kallsyms: add kallsyms_seqs_of_names to list of special symbols

From: Arnd Bergmann <[email protected]>

My randconfig build setup ran into another kallsyms warning:

Inconsistent kallsyms data
Try make KALLSYMS_EXTRA_PASS=1 as a workaround

After adding some debugging code to kallsyms.c, I saw that the recently added kallsyms_seqs_of_names symbol can sometimes cause the second stage table to be slightly longer than the first stage, which makes the build inconsistent.

Add it to the exception table that contains all other kallsyms-generated symbols.

Fixes 60443c88f3a8 ("kallsyms: Improve the performance of kallsyms_lookup_name()")
---
 scripts/kallsyms.c | 1 +
 1 file changed, 1 insertion(+)
scripts/kallsyms.c +1 -0
index 8a68179a98a3..a239a87e7bec 100644
@@ -119,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
 		"kallsyms_markers",
 		"kallsyms_token_table",
 		"kallsyms_token_index",
+		"kallsyms_seqs_of_names",
 		/* Exclude linker generated symbols which vary between passes */
 		"_SDA_BASE_",		/* ppc */
 		"_SDA2_BASE_",		/* ppc */
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 kallsyms: expand symbol name into comment for debugging

From: Arnd Bergmann <[email protected]>

The assembler output of kallsyms.c is not meant for people to understand, and is generally not helpful when debugging "Inconsistent kallsyms data" warnings. I have previously struggled with these, but found it helpful to list which symbols changed between the first and second pass in the .tmp_vmlinux.kallsyms*.S files.

As this file is preprocessed, it's possible to add a C-style multiline comment with the full type/name tuple.

---
No idea if there is already a better way to debug this kind of problem, or if this causes a notable slowdown.

---
 scripts/kallsyms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kallsyms.c +2 -1
index a239a87e7bec..ea1e3d3aaa6b 100644
@@ -525,7 +525,8 @@ static void write_src(void)
 					table[i]->addr);
 				exit(EXIT_FAILURE);
 			}
-			printf("\t.long\t%#x\n", (int)offset);
+			expand_symbol(table[i]->sym, table[i]->len, buf);
+			printf("\t.long\t%#x	/* %s */\n", (int)offset, buf);
 		} else if (!symbol_absolute(table[i])) {
 			output_address(table[i]->addr);
 		} else {
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 2/2] kallsyms: expand symbol name into comment for debugging

Quoted 25 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The assembler output of kallsyms.c is not meant for people to understand, and is generally not helpful when debugging "Inconsistent kallsyms data" warnings. I have previously struggled with these, but found it helpful to list which symbols changed between the first and second pass in the .tmp_vmlinux.kallsyms*.S files.

As this file is preprocessed, it's possible to add a C-style multiline comment with the full type/name tuple.

---
No idea if there is already a better way to debug this kind of problem, or if this causes a notable slowdown.

---
 scripts/kallsyms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kallsyms.c +0 -0
index a239a87e7bec..ea1e3d3aaa6b 100644

scripts/kallsyms.c static void write_src(void) · line 529

Quoted 6 lines
scripts/kallsyms.c +2 -1
@@ -525,7 +525,8 @@ static void write_src(void)
                                        table[i]->addr);
                                exit(EXIT_FAILURE);
                        }
-                       printf("\t.long\t%#x\n", (int)offset);
+                       expand_symbol(table[i]->sym, table[i]->len, buf);
+                       printf("\t.long\t%#x    /* %s */\n", (int)offset, buf);

This is printed only for base_relative,
but ia64 will go away sooner or later,
so this seems good to me.

Applied to linux-kbuild. Thanks.

Quoted 6 lines
scripts/kallsyms.c +0 -1
                } else if (!symbol_absolute(table[i])) {
                        output_address(table[i]->addr);
                } else {
--

2.39.2

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by on v1 1/2
#3 lore raw
In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

My randconfig build setup ran into another kallsyms warning:

Inconsistent kallsyms data
Try make KALLSYMS_EXTRA_PASS=1 as a workaround

Quoted 7 lines

After adding some debugging code to kallsyms.c, I saw that the recently added kallsyms_seqs_of_names symbol can sometimes cause the second stage table to be slightly longer than the first stage, which makes the build inconsistent.

Add it to the exception table that contains all other kallsyms-generated symbols.

Maybe we can do a sanity check in output_label(). Or dynamically add the new symbol into ignored_symbols[], in this way, manual maintenance is not required.

Quoted 20 lines
Fixes 60443c88f3a8 ("kallsyms: Improve the performance of kallsyms_lookup_name()")
---
 scripts/kallsyms.c | 1 +
 1 file changed, 1 insertion(+)
scripts/kallsyms.c +1 -0
index 8a68179a98a3..a239a87e7bec 100644
@@ -119,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
 		"kallsyms_markers",
 		"kallsyms_token_table",
 		"kallsyms_token_index",
+		"kallsyms_seqs_of_names",
 		/* Exclude linker generated symbols which vary between passes */
 		"_SDA_BASE_",		/* ppc */
 		"_SDA2_BASE_",		/* ppc */
Signature · 2 lines
Regards,
  Zhen Lei
#4 lore raw
In reply to Arnd Bergmann
Quoted 35 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

My randconfig build setup ran into another kallsyms warning:

Inconsistent kallsyms data
Try make KALLSYMS_EXTRA_PASS=1 as a workaround

After adding some debugging code to kallsyms.c, I saw that the recently added kallsyms_seqs_of_names symbol can sometimes cause the second stage table to be slightly longer than the first stage, which makes the build inconsistent.

Add it to the exception table that contains all other kallsyms-generated symbols.

Fixes 60443c88f3a8 ("kallsyms: Improve the performance of kallsyms_lookup_name()")
---
 scripts/kallsyms.c | 1 +
 1 file changed, 1 insertion(+)
scripts/kallsyms.c +1 -1
index 8a68179a98a3..a239a87e7bec 100644
@@ -119,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
                "kallsyms_markers",
                "kallsyms_token_table",
                "kallsyms_token_index",
+               "kallsyms_seqs_of_names",
                /* Exclude linker generated symbols which vary between passes */
                "_SDA_BASE_",           /* ppc */
                "_SDA2_BASE_",          /* ppc */
--
Quoted 2 lines

2.39.2

Applied to linux-kbuild/fixes.
Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada