public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols
@ 2023-03-06 10:14 Arnd Bergmann
  2023-03-06 10:14 ` [PATCH 2/2] kallsyms: expand symbol name into comment for debugging Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-03-06 10:14 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, Greg Kroah-Hartman, Kees Cook, Miguel Ojeda,
	Zhen Lei, Boqun Feng, Luis Chamberlain, linux-kernel,
	Arnd Bergmann

From: Arnd Bergmann <arnd@arndb.de>

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()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/kallsyms.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 8a68179a98a3..a239a87e7bec 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -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 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] kallsyms: expand symbol name into comment for debugging
  2023-03-06 10:14 [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Arnd Bergmann
@ 2023-03-06 10:14 ` Arnd Bergmann
  2023-03-07  1:57   ` Masahiro Yamada
  2023-03-06 13:38 ` [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Leizhen (ThunderTown)
  2023-03-07  1:35 ` Masahiro Yamada
  2 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2023-03-06 10:14 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, Greg Kroah-Hartman, Kees Cook, Miguel Ojeda,
	Zhen Lei, Boqun Feng, Luis Chamberlain, linux-kernel,
	Arnd Bergmann

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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(-)

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index a239a87e7bec..ea1e3d3aaa6b 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -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 {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols
  2023-03-06 10:14 [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Arnd Bergmann
  2023-03-06 10:14 ` [PATCH 2/2] kallsyms: expand symbol name into comment for debugging Arnd Bergmann
@ 2023-03-06 13:38 ` Leizhen (ThunderTown)
  2023-03-07  1:35 ` Masahiro Yamada
  2 siblings, 0 replies; 5+ messages in thread
From: Leizhen (ThunderTown) @ 2023-03-06 13:38 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, Greg Kroah-Hartman, Kees Cook, Miguel Ojeda,
	Boqun Feng, Luis Chamberlain, linux-kernel, Arnd Bergmann



On 2023/3/6 18:14, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com>

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.


> 
> Fixes: 60443c88f3a8 ("kallsyms: Improve the performance of kallsyms_lookup_name()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  scripts/kallsyms.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 8a68179a98a3..a239a87e7bec 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -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 */
> 

-- 
Regards,
  Zhen Lei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols
  2023-03-06 10:14 [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Arnd Bergmann
  2023-03-06 10:14 ` [PATCH 2/2] kallsyms: expand symbol name into comment for debugging Arnd Bergmann
  2023-03-06 13:38 ` [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Leizhen (ThunderTown)
@ 2023-03-07  1:35 ` Masahiro Yamada
  2 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2023-03-07  1:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kbuild, Nathan Chancellor, Nick Desaulniers, Nicolas Schier,
	Greg Kroah-Hartman, Kees Cook, Miguel Ojeda, Zhen Lei, Boqun Feng,
	Luis Chamberlain, linux-kernel, Arnd Bergmann

On Mon, Mar 6, 2023 at 7:15 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  scripts/kallsyms.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 8a68179a98a3..a239a87e7bec 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -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 */
> --
> 2.39.2
>


Applied to linux-kbuild/fixes.
Thanks.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] kallsyms: expand symbol name into comment for debugging
  2023-03-06 10:14 ` [PATCH 2/2] kallsyms: expand symbol name into comment for debugging Arnd Bergmann
@ 2023-03-07  1:57   ` Masahiro Yamada
  0 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2023-03-07  1:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kbuild, Nathan Chancellor, Nick Desaulniers, Nicolas Schier,
	Greg Kroah-Hartman, Kees Cook, Miguel Ojeda, Zhen Lei, Boqun Feng,
	Luis Chamberlain, linux-kernel, Arnd Bergmann

On Mon, Mar 6, 2023 at 7:15 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 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(-)
>
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index a239a87e7bec..ea1e3d3aaa6b 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -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.











>                 } else if (!symbol_absolute(table[i])) {
>                         output_address(table[i]->addr);
>                 } else {
> --
> 2.39.2
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-07  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-06 10:14 [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Arnd Bergmann
2023-03-06 10:14 ` [PATCH 2/2] kallsyms: expand symbol name into comment for debugging Arnd Bergmann
2023-03-07  1:57   ` Masahiro Yamada
2023-03-06 13:38 ` [PATCH 1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols Leizhen (ThunderTown)
2023-03-07  1:35 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox