All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] Kbuild: Add an option to enable GCC VTA
@ 2014-11-21 18:40 Josh Stone
  2014-11-24 21:46 ` Michal Marek
  2015-04-23 21:25 ` [PATCH] " Frank Ch. Eigler
  0 siblings, 2 replies; 9+ messages in thread
From: Josh Stone @ 2014-11-21 18:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Josh Stone, Frank Ch. Eigler, Jakub Jelinek, Josh Boyer,
	Greg Kroah-Hartman, Linus Torvalds, Andrew Morton,
	Markus Trippelsdorf, Michel Dänzer

Due to recent codegen issues, gcc -fvar-tracking-assignments was
unconditionally disabled in commit 2062afb4f804a ("Fix gcc-4.9.0
miscompilation of load_balance() in scheduler").  However, this reduces
the debuginfo coverage for variable locations, especially in inline
functions.  VTA is certainly not perfect either in those cases, but it
is much better than without.  With compiler versions that have fixed the
codegen bugs, we would prefer to have the better details for SystemTap,
and surely other debuginfo consumers like perf will benefit as well.

This patch simply makes CONFIG_DEBUG_INFO_VTA an option.  I considered
Frank and Linus's discussion of a cc-option-like -fcompare-debug test,
but I'm convinced that a narrow test of an arch-specific codegen issue
is not really useful.  GCC has their own regression tests for this, so
I'd suggest GCC_COMPARE_DEBUG=-fvar-tracking-assignments-toggle is more
useful for kernel developers to test confidence.

In fact, I ran into a couple more issues when testing for this patch[1],
although neither of those had any codegen impact.
 [1] https://bugzilla.redhat.com/show_bug.cgi?id=1140872

With gcc-4.9.2-1.fc22, I can now build v3.18-rc5 with Fedora's i686 and
x86_64 configs, and this is completely clean with GCC_COMPARE_DEBUG.

Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Josh Stone <jistone@redhat.com>
---
 Makefile          |  4 ++++
 lib/Kconfig.debug | 18 +++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 00d618bbe8e7..a289efbe7e28 100644
--- a/Makefile
+++ b/Makefile
@@ -704,7 +704,11 @@ KBUILD_CFLAGS	+= -fomit-frame-pointer
 endif
 endif
 
+ifdef CONFIG_DEBUG_INFO_VTA
+KBUILD_CFLAGS   += $(call cc-option, -fvar-tracking-assignments)
+else
 KBUILD_CFLAGS   += $(call cc-option, -fno-var-tracking-assignments)
+endif
 
 ifdef CONFIG_DEBUG_INFO
 ifdef CONFIG_DEBUG_INFO_SPLIT
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4e35a5d767ed..27410417de1d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -165,7 +165,23 @@ config DEBUG_INFO_DWARF4
 	  Generate dwarf4 debug info. This requires recent versions
 	  of gcc and gdb. It makes the debug information larger.
 	  But it significantly improves the success of resolving
-	  variables in gdb on optimized code.
+	  variables in gdb on optimized code.  The gcc docs also
+	  recommend enabling -fvar-tracking-assignments for maximum
+	  benefit. (see DEBUG_INFO_VTA)
+
+config DEBUG_INFO_VTA
+	bool "Enable var-tracking-assignments for debuginfo"
+	depends on DEBUG_INFO
+	help
+	  Enable gcc -fvar-tracking-assignments for improved debug
+	  information on variable locations in optimized code.  Per
+	  gcc, DEBUG_INFO_DWARF4 is recommended for best use of VTA.
+
+	  VTA has been implicated in codegen bugs (gcc PR61801,
+	  PR61904), so this may deserve some caution.  One can set
+	  GCC_COMPARE_DEBUG=-fvar-tracking-assignments-toggle in the
+	  environment to automatically compile everything both ways,
+	  generating an error if anything differs.
 
 config ENABLE_WARN_DEPRECATED
 	bool "Enable __deprecated logic"
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [PATCH 3.15 33/37] Fix gcc-4.9.0 miscompilation of load_balance() in scheduler
@ 2014-08-05 23:59 Linus Torvalds
  2014-10-06 21:05 ` [PATCH] Kbuild: Add an option to enable GCC VTA Josh Stone
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Torvalds @ 2014-08-05 23:59 UTC (permalink / raw)
  To: Frank Ch. Eigler
  Cc: Josh Boyer, Jakub Jelinek, Greg Kroah-Hartman,
	Linux Kernel Mailing List, stable, Michel Dänzer,
	Markus Trippelsdorf, Josh Stone

On Tue, Aug 5, 2014 at 4:30 PM, Frank Ch. Eigler <fche@redhat.com> wrote:
>
> Would you consider a patch that does a gcc COMPARE_DEBUG-based test?

Yes. But as mentioned, we don't have a really good way to do that. I
guess we can do something similar to what "cc-option" does, but that
will end up doing it for every single kernel build. I'd love to have
something like this be done at kconfig time (along with all the
*other* crazy conditional compiler options we do), but I guess that's
a largely independent issue.

And afaik, it will basically disallow every gcc version since 4.5 up
until 4.9.2 gets released. And afaik, even current gcc actually fails
the compare-debug test for at least some inputs, so ...

                 Linus

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

end of thread, other threads:[~2015-04-24 13:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-21 18:40 [PATCH RESEND] Kbuild: Add an option to enable GCC VTA Josh Stone
2014-11-24 21:46 ` Michal Marek
2014-11-24 23:46   ` Josh Stone
2014-11-25 21:05     ` Michal Marek
2014-11-25 21:24       ` Josh Boyer
2015-04-23 21:25 ` [PATCH] " Frank Ch. Eigler
2015-04-24 12:40   ` Josh Boyer
2015-04-24 13:42     ` Frank Ch. Eigler
  -- strict thread matches above, loose matches on Subject: below --
2014-08-05 23:59 [PATCH 3.15 33/37] Fix gcc-4.9.0 miscompilation of load_balance() in scheduler Linus Torvalds
2014-10-06 21:05 ` [PATCH] Kbuild: Add an option to enable GCC VTA Josh Stone

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.