summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@fedoraproject.org>2014-12-16 12:13:21 -0500
committerJosh Boyer <jwboyer@fedoraproject.org>2014-12-16 12:14:39 -0500
commit2b3a01ceecad93ff43e194e4e8605d3316ed4a96 (patch)
tree25eaffcdce3f25816a5c179a311ed73fa5ff8096
parent59879cba34ee74208a9cc772c2a63f0a5d8d6192 (diff)
downloadkernel-2b3a01ceecad93ff43e194e4e8605d3316ed4a96.tar.gz
kernel-2b3a01ceecad93ff43e194e4e8605d3316ed4a96.tar.xz
kernel-2b3a01ceecad93ff43e194e4e8605d3316ed4a96.zip
Add patch from Josh Stone to restore var-tracking via Kconfig (rhbz 1126580)
-rw-r--r--Kbuild-Add-an-option-to-enable-GCC-VTA.patch92
-rw-r--r--config-generic1
-rw-r--r--kernel.spec8
3 files changed, 101 insertions, 0 deletions
diff --git a/Kbuild-Add-an-option-to-enable-GCC-VTA.patch b/Kbuild-Add-an-option-to-enable-GCC-VTA.patch
new file mode 100644
index 00000000..eef13c4e
--- /dev/null
+++ b/Kbuild-Add-an-option-to-enable-GCC-VTA.patch
@@ -0,0 +1,92 @@
+From: Josh Stone <jistone@redhat.com>
+Date: Fri, 21 Nov 2014 10:40:00 -0800
+Subject: [PATCH] Kbuild: Add an option to enable GCC VTA
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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 bb43e9e6a79c..8a3aba74fe0b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -709,7 +709,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 a28590083622..ce1107439d7d 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
+
diff --git a/config-generic b/config-generic
index e17732b0..fffc16bd 100644
--- a/config-generic
+++ b/config-generic
@@ -4333,6 +4333,7 @@ CONFIG_FRAME_WARN=1024
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x0
CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_VTA=y
# Revisit both of these options
# CONFIG_DEBUG_INFO_SPLIT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
diff --git a/kernel.spec b/kernel.spec
index 63556da2..905c96e8 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -516,6 +516,9 @@ Patch530: silence-fbcon-logo.patch
Patch600: lib-cpumask-Make-CPUMASK_OFFSTACK-usable-without-deb.patch
+#rhbz 1126580
+Patch601: Kbuild-Add-an-option-to-enable-GCC-VTA.patch
+
Patch800: crash-driver.patch
# crypto/
@@ -1287,6 +1290,8 @@ ApplyPatch input-silence-i8042-noise.patch
ApplyPatch silence-fbcon-logo.patch
# Changes to upstream defaults.
+#rhbz 1126580
+ApplyPatch Kbuild-Add-an-option-to-enable-GCC-VTA.patch
# /dev/crash driver.
ApplyPatch crash-driver.patch
@@ -2266,6 +2271,9 @@ fi
# ||----w |
# || ||
%changelog
+* Tue Dec 16 2014 Josh Boyer <jwboyer@fedoraproject.org>
+- Add patch from Josh Stone to restore var-tracking via Kconfig (rhbz 1126580)
+
* Mon Dec 15 2014 Josh Boyer <jwboyer@fedoraproject.org>
- Fix ppc64 boot with smt-enabled=off (rhbz 1173806)
- CVE-2014-8133 x86: espfix(64) bypass via set_thread_area and CLONE_SETTLS (rhbz 1172797 1174374)