do not select KALLSYMS_ALL
cover do not select KALLSYMS_ALL
UBI and UBIFS have an option to compile-in debugging support. When we enable debugging, compile-in various assertions, self-check functions and test modes. We also compile in additional verbose error messages, flash dumps and stack dumps.
When we have debugging support enabled, we want to have nice stackdumps, so we selected KALLSYMS_ALL. But this causes various problems like unmet direct dependencies, reported by Randy:
warning: (UBIFS_FS_DEBUG && LOCKDEP && LATENCYTOP) selects KALLSYMS_ALL which has unmet direct dependencies (DEBUG_KERNEL && KALLSYMS)
I quickly looked at KALLSYMS_ALL and it is not immediately clear what exactly is the difference between KALLSYMS and KALLSYMS_ALL. And there is this CONFIG_KALLSYMS_EXTRA_PASS symbol, which is declared "temporary workaround" in the Kconfig help. This shows that this stuff is messy.
I personally think KALLSYMS_ALL should be just merged with KALLSYMS and disappear - we should have only one option. CONFIG_KALLSYMS_EXTRA_PASS should die as well.
But I don't want to delve into that, I choose to just forget about KALLSYMS_ALL and select KALLSYMS in UBI/UBIFS which seems to be enough for us.
Artem.
PATCH 1/2 UBIFS: do not select KALLSYMS_ALL
From: Artem Bityutskiy <[email protected]>
All UBIFS needs is to make sure we stacktraces when UBIFS debugging is enabled. It is enough to select KALLSYMS for this, KALLSYMS_ALL is not necessary. Moreover, Randy Dunlap reported that UBIFS causes the following Kconfig dependency warning:
warning: (UBIFS_FS_DEBUG && LOCKDEP && LATENCYTOP) selects KALLSYMS_ALL which has unmet direct dependencies (DEBUG_KERNEL && KALLSYMS)
The reason is that KALLSYMS_ALL requires DEBUG_KERNEL and KALLSYMS, so ideally, to select KALLSYMS_ALL we'd need to select DEBUG_KERNEL and KALLSYMS first.
This seems to be too much to select. The easiest way to go is to forget about KALLSYMS_ALL and just select KALLSYMS when UBIFS debugging is enabled - that should be enough for stackdumps.
--- fs/ubifs/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ubifs/Kconfig +1 -1
@@ -47,7 +47,7 @@ config UBIFS_FS_DEBUG bool "Enable debugging support" depends on UBIFS_FS select DEBUG_FS - select KALLSYMS_ALL + select KALLSYMS help This option enables UBIFS debugging support. It makes sure various assertions, self-checks, debugging messages and test modes are compiled
Signature · 1 line
1.7.2.3
PATCH 2/2 UBI: do not select KALLSYMS_ALL
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
All UBI needs is to make sure we stacktraces when UBI debugging is enabled. It is enough to select KALLSYMS for this, KALLSYMS_ALL is not necessary.
And the current Kconfig line we have:
select KALLSYMS_ALL if KALLSYMS && DEBUG_KERNEL
is just too complex to be sane and right. But this "if" part there is needed to prevent "unmet direct dependency" warnings, because KALLSYMS_ALL depends on KALLSYMS and DEBUG_KERNEL, so we cannot just select KALLSYMS_ALL.
Anyway, this feels messy, and we do not seem to really need KALLSYMS_ALL, so select KALLSYMS instead.
--- drivers/mtd/ubi/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/ubi/Kconfig +1 -1
@@ -56,7 +56,7 @@ config MTD_UBI_DEBUG bool "UBI debugging" depends on SYSFS select DEBUG_FS - select KALLSYMS_ALL if KALLSYMS && DEBUG_KERNEL + select KALLSYMS help This option enables UBI debugging.
Signature · 1 line
1.7.2.3
Re: [PATCH 1/2] UBIFS: do not select KALLSYMS_ALL
In reply to Artem BityutskiyQuoted 30 lines · On Wed, 30 Mar 2011 11:40:15 +0300 Artem Bityutskiy wrote:
From: Artem Bityutskiy <[email protected]>
All UBIFS needs is to make sure we stacktraces when UBIFS debugging is enabled. It is enough to select KALLSYMS for this,
KALLSYMS_ALLis not necessary. Moreover, Randy Dunlap reported that UBIFS causes the followingKconfigdependency warning:warning: (
UBIFS_FS_DEBUG&& LOCKDEP && LATENCYTOP) selectsKALLSYMS_ALLwhich has unmet direct dependencies (DEBUG_KERNEL&& KALLSYMS)The reason is that
KALLSYMS_ALLrequiresDEBUG_KERNELand KALLSYMS, so ideally, to selectKALLSYMS_ALLwe'd need to selectDEBUG_KERNELand KALLSYMS first.This seems to be too much to select. The easiest way to go is to forget about
KALLSYMS_ALLand just select KALLSYMS when UBIFS debugging is enabled - that should be enough for stackdumps.Reported-by Randy Dunlap <[email protected]>Signed-off-by Artem Bityutskiy <[email protected]>--- fs/ubifs/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)fs/ubifs/Kconfig +0
-0
fs/ubifs/Kconfig config UBIFS_FS_DEBUG · line 53
Quoted 8 lines
fs/ubifs/Kconfig +1
-1@@ -47,7 +47,7 @@ config UBIFS_FS_DEBUG bool "Enable debugging support" depends on UBIFS_FS select DEBUG_FS - select KALLSYMS_ALL + select KALLSYMS help This option enables UBIFS debugging support. It makes sure various assertions, self-checks, debugging messages and test modes are compiled
Thanks.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Re: [PATCH 2/2] UBI: do not select KALLSYMS_ALL
In reply to Artem BityutskiyQuoted 29 lines · On Wed, 30 Mar 2011 11:40:16 +0300 Artem Bityutskiy wrote:
From: Artem Bityutskiy <[email protected]>
All UBI needs is to make sure we stacktraces when UBI debugging is enabled. It is enough to select KALLSYMS for this,
KALLSYMS_ALLis not necessary.And the current
Kconfigline we have:select
KALLSYMS_ALLif KALLSYMS &&DEBUG_KERNELis just too complex to be sane and right. But this "if" part there is needed to prevent "unmet direct dependency" warnings, because
KALLSYMS_ALLdepends on KALLSYMS andDEBUG_KERNEL, so we cannot just selectKALLSYMS_ALL.Anyway, this feels messy, and we do not seem to really need
KALLSYMS_ALL, so select KALLSYMS instead.Signed-off-by Artem Bityutskiy <[email protected]>--- drivers/mtd/ubi/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/mtd/ubi/Kconfig +0
-0
drivers/mtd/ubi/Kconfig config MTD_UBI_DEBUG · line 62
Quoted 8 lines
drivers/mtd/ubi/Kconfig +1
-1@@ -56,7 +56,7 @@ config MTD_UBI_DEBUG bool "UBI debugging" depends on SYSFS select DEBUG_FS - select KALLSYMS_ALL if KALLSYMS && DEBUG_KERNEL + select KALLSYMS help This option enables UBI debugging.
Thanks.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Artem Bityutskiy
AppliedRe: [PATCH 1/2] UBIFS: do not select KALLSYMS_ALL
In reply to Randy DunlapQuoted 8 lines · Randy Dunlap
Quoted 8 lines
fs/ubifs/Kconfig +0
-0@@ -47,7 +47,7 @@ config UBIFS_FS_DEBUG bool "Enable debugging support" depends on UBIFS_FS select DEBUG_FS
Quoted 8 lines
fs/ubifs/Kconfig config UBIFS_FS_DEBUG · line 53
Quoted 6 lines
fs/ubifs/Kconfig +1
-1- select KALLSYMS_ALL + select KALLSYMS help This option enables UBIFS debugging support. It makes sure various assertions, self-checks, debugging messages and test modes are compiledAcked-by Randy Dunlap <[email protected]>
Pushed to UBI / UBIFS trees. These will show-up in linux-next a bit later (around -rc2, if it will be usable enough), and then I'll send this to Linus.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 4 lines · Artem Bityutskiy
[...]
I personally thinkKALLSYMS_ALLshould be just merged with KALLSYMS and disappear - we should have only one option.CONFIG_KALLSYMS_EXTRA_PASSshould die as well.
That sounds a little too extreme...
KALLSYMS is useful for most kernels, since it provides nice readable stack dumps for panics and BUG's.
KALLSYMS_ALL adds a lot of extra symbols that can be useful mostly to development kernels and shouldn't be used to add unnecessary bloat to user kernels.
Now as for CONFIG_KALLSYMS_EXTRA_PASS: to build the kallsyms table, the build process first links a kernel image with an empty kallsyms table and use that to fetch information for all the symbols.
It then uses that information to build the table with the right size, and links it again. If everything goes ok, this new version as all the symbols in the correct places and the final table can be built with the correct addresses.
The final linking should produce the same result as only the data on the kallsyms table changed, but not its size.
However, there have been bugs in the past with section alignments and symbol reordering for symbols with the same address, etc., etc. that make this final table not have the exact same size, and the build fails with an inconsistent kallsyms data message. At this point, the user can turn on the CONFIG_KALLSYMS_EXTRA_PASS and temporarily solve the problem while the developers find the correct fix. Without this option, in this situation the kernel would simply fail the compilation.
All this has been stable for a while and this option hasn't been needed recently (AFAIK), but if there is some bug in some new binutils or something, the option might be needed again.
Signature · 3 lines
Paulo Marques - www.grupopie.com "Who is general Failure and why is he reading my disk?"
Quoted 6 lines · Paulo Marques
Quoted 4 lines · Artem Bityutskiy
[...]
I personally thinkKALLSYMS_ALLshould be just merged with KALLSYMS and disappear - we should have only one option.CONFIG_KALLSYMS_EXTRA_PASSshould die as well.
Quoted 8 lines
That sounds a little too extreme...
KALLSYMS is useful for most kernels, since it provides nice readable stack dumps for panics and BUG's.
KALLSYMS_ALLadds a lot of extra symbols that can be useful mostly to development kernels and shouldn't be used to add unnecessary bloat to user kernels.
OK, thanks.
Quoted 20 lines
Now as for
CONFIG_KALLSYMS_EXTRA_PASS: to build the kallsyms table, the build process first links a kernel image with an empty kallsyms table and use that to fetch information for all the symbols.It then uses that information to build the table with the right size, and links it again. If everything goes ok, this new version as all the symbols in the correct places and the final table can be built with the correct addresses.
The final linking should produce the same result as only the data on the kallsyms table changed, but not its size.
However, there have been bugs in the past with section alignments and symbol reordering for symbols with the same address, etc., etc. that make this final table not have the exact same size, and the build fails with an inconsistent kallsyms data message. At this point, the user can turn on the
CONFIG_KALLSYMS_EXTRA_PASSand temporarily solve the problem while the developers find the correct fix. Without this option, in this situation the kernel would simply fail the compilation.
Quoted 3 lines
All this has been stable for a while and this option hasn't been needed recently (AFAIK), but if there is some bug in some new binutils or something, the option might be needed again.
Thanks for explanation!
But... why on earth this option is in Kconfig then, if this is only about extra pass during the kernel _compilation_ ? This and the vague help message in Kconfig help section are very misleading. This should not be in Kconfig at all then, it should be purely a Makefile thing!
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 6 lines · Paulo Marques
Quoted 4 lines · Artem Bityutskiy
[...]
I personally thinkKALLSYMS_ALLshould be just merged with KALLSYMS and disappear - we should have only one option.CONFIG_KALLSYMS_EXTRA_PASSshould die as well.
Quoted 8 lines
That sounds a little too extreme...
KALLSYMS is useful for most kernels, since it provides nice readable stack dumps for panics and BUG's.
KALLSYMS_ALLadds a lot of extra symbols that can be useful mostly to development kernels and shouldn't be used to add unnecessary bloat to user kernels.
Well, ok, I've measured how much is this "a lot". On an embedded arm platform this makes the kernel only 1.5% larger.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 2 lines · Artem Bityutskiy
Well, ok, I've measured how much is this "a lot". On an embedded arm platform this makes the kernel only 1.5% larger.
But in absolute numbers this is 70KiB in my case, which is indeed considerable amount. So, I agree that it makes sense to keep this as a separate option.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 7 lines · Artem Bityutskiy
Quoted 3 lines · Artem Bityutskiy
Well, ok, I've measured how much is this "a lot". On an embedded arm platform this makes the kernel only 1.5% larger.
But in absolute numbers this is 70KiB in my case, which is indeed considerable amount. So, I agree that it makes sense to keep this as a separate option.
Yes there are platforms where space is tight and 70 KiB could make or break a given setup.
/Ricard
Signature · 3 lines
Ricard Wolf Wanderlöf ricardw(at)axis.com Axis Communications AB, Lund, Sweden www.axis.com Phone +46 46 272 2016 Fax +46 46 13 61 30
Quoted 7 lines · Artem Bityutskiy
Quoted 2 lines · Artem Bityutskiy
Well, ok, I've measured how much is this "a lot". On an embedded arm platform this makes the kernel only 1.5% larger.
But in absolute numbers this is 70KiB in my case, which is indeed considerable amount. So, I agree that it makes sense to keep this as a separate option.
Yes, and this depends a lot on the kernel configuration options you've selected (and that 1.5% of the kernel size, might be 50%~100% of the kallsyms table).
IIRC, I had configurations where the KALLSYMS_ALL option was increasing the kallsyms table from something like 150kB to above 500kB (before compression). This was a long time ago though and I can't say exactly what was the configuration that made this happen.
As for the CONFIG_KALLSYMS_EXTRA_PASS, I think the original idea (it was not mine) was that it should be off by default and then the user would need to turn it on when something went wrong.
With an automatic makefile mechanism, the problem would go unnoticed and it just wouldn't be fixed, increasing the kernel compile time for everyone who hits the same troublesome configuration.
Signature · 4 lines
Paulo Marques - www.grupopie.com "As far as we know, our computer has never had an undetected error." Weisert
Quoted 9 lines · Paulo Marques
Quoted 7 lines · Artem Bityutskiy
Quoted 2 lines · Artem Bityutskiy
Well, ok, I've measured how much is this "a lot". On an embedded arm platform this makes the kernel only 1.5% larger.
But in absolute numbers this is 70KiB in my case, which is indeed considerable amount. So, I agree that it makes sense to keep this as a separate option.
Quoted 8 lines
Yes, and this depends a lot on the kernel configuration options you've selected (and that 1.5% of the kernel size, might be 50%~100% of the kallsyms table).
IIRC, I had configurations where the
KALLSYMS_ALLoption was increasing the kallsyms table from something like 150kB to above 500kB (before compression). This was a long time ago though and I can't say exactly what was the configuration that made this happen.
Yes, thanks, I agree that having 2 separate options is OK.
Quoted 3 lines
As for the
CONFIG_KALLSYMS_EXTRA_PASS, I think the original idea (it was not mine) was that it should be off by default and then the user would need to turn it on when something went wrong.
Yes, but my point is that this feature is about the build and it does not affect run-time, so it should not be in Kconfig.
Quoted 3 lines
With an automatic makefile mechanism, the problem would go unnoticed and it just wouldn't be fixed, increasing the kernel compile time for everyone who hits the same troublesome configuration.
Yes, the build system may print a message:
Your symbols table is screwed, this is a bug, report about it. As a temporary workaround use "make KALLSYMS_EXTRA_PASS=1"
Or something like that.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 6 lines · Artem Bityutskiy
Quoted 4 lines · Paulo Marques
[...]
With an automatic makefile mechanism, the problem would go unnoticed and it just wouldn't be fixed, increasing the kernel compile time for everyone who hits the same troublesome configuration.
Quoted 6 lines
Yes, the build system may print a message:
Your symbols table is screwed, this is a bug, report about it. As a temporary workaround use "make KALLSYMS_EXTRA_PASS=1"
Or something like that.
Yes, I think that would work too, and it would even prevent the option from being on for no good reason.
Signature · 3 lines
Paulo Marques - www.grupopie.com "Nostalgia isn't what it used to be."
Quoted 9 lines · Paulo Marques
Quoted 8 lines · Artem Bityutskiy
Quoted 4 lines · Paulo Marques
[...]
With an automatic makefile mechanism, the problem would go unnoticed and it just wouldn't be fixed, increasing the kernel compile time for everyone who hits the same troublesome configuration.Yes, the build system may print a message:
Quoted 7 lines
Quoted 4 lines
Your symbols table is screwed, this is a bug, report about it. As a temporary workaround use "make KALLSYMS_EXTRA_PASS=1"
Or something like that.
Yes, I think that would work too, and it would even prevent the option from being on for no good reason.
I'll try to find some time and cook a patch.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)