]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Feb 2021 15:34:50 +0000 (16:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Feb 2021 15:34:50 +0000 (16:34 +0100)
added patches:
trace-use-mcount-record-for-dynamic-ftrace.patch
tracing-avoid-calling-cc-option-mrecord-mcount-for-every-makefile.patch
tracing-fix-skip_stack_validation-1-build-due-to-bad-merge-with-mrecord-mcount.patch

queue-4.4/series
queue-4.4/trace-use-mcount-record-for-dynamic-ftrace.patch [new file with mode: 0644]
queue-4.4/tracing-avoid-calling-cc-option-mrecord-mcount-for-every-makefile.patch [new file with mode: 0644]
queue-4.4/tracing-fix-skip_stack_validation-1-build-due-to-bad-merge-with-mrecord-mcount.patch [new file with mode: 0644]

index 23f10afead8ad636e3e679d695140aa4b036ca4e..70fa4cb203af093ed97e377f6451918331df9856 100644 (file)
@@ -19,3 +19,6 @@ usb-dwc3-ulpi-replace-cpu-based-busyloop-with-protocol-based-one.patch
 net-watchdog-hold-device-global-xmit-lock-during-tx-disable.patch
 vsock-fix-locking-in-vsock_shutdown.patch
 x86-build-disable-cet-instrumentation-in-the-kernel-for-32-bit-too.patch
+trace-use-mcount-record-for-dynamic-ftrace.patch
+tracing-fix-skip_stack_validation-1-build-due-to-bad-merge-with-mrecord-mcount.patch
+tracing-avoid-calling-cc-option-mrecord-mcount-for-every-makefile.patch
diff --git a/queue-4.4/trace-use-mcount-record-for-dynamic-ftrace.patch b/queue-4.4/trace-use-mcount-record-for-dynamic-ftrace.patch
new file mode 100644 (file)
index 0000000..cc4abc6
--- /dev/null
@@ -0,0 +1,54 @@
+From 96f60dfa5819a065bfdd2f2ba0df7d9cbce7f4dd Mon Sep 17 00:00:00 2001
+From: Andi Kleen <ak@linux.intel.com>
+Date: Mon, 27 Nov 2017 13:34:13 -0800
+Subject: trace: Use -mcount-record for dynamic ftrace
+
+From: Andi Kleen <ak@linux.intel.com>
+
+commit 96f60dfa5819a065bfdd2f2ba0df7d9cbce7f4dd upstream.
+
+gcc 5 supports a new -mcount-record option to generate ftrace
+tables directly. This avoids the need to run record_mcount
+manually.
+
+Use this option when available.
+
+So far doesn't use -mcount-nop, which also exists now.
+
+This is needed to make ftrace work with LTO because the
+normal record-mcount script doesn't run over the link
+time output.
+
+It should also improve build times slightly in the general
+case.
+Link: http://lkml.kernel.org/r/20171127213423.27218-12-andi@firstfloor.org
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/Makefile.build |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -221,6 +221,11 @@ cmd_modversions_c =                                                               \
+ endif
+ ifdef CONFIG_FTRACE_MCOUNT_RECORD
++# gcc 5 supports generating the mcount tables directly
++ifneq ($(call cc-option,-mrecord-mcount,y),y)
++KBUILD_CFLAGS += -mrecord-mcount
++else
++# else do it all manually
+ ifdef BUILD_C_RECORDMCOUNT
+ ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
+   RECORDMCOUNT_FLAGS = -w
+@@ -250,6 +255,7 @@ cmd_record_mcount =                                                \
+               $(sub_cmd_record_mcount)                        \
+       fi;
+ endif
++endif
+ define rule_cc_o_c
+       $(call echo-cmd,checksrc) $(cmd_checksrc)                         \
diff --git a/queue-4.4/tracing-avoid-calling-cc-option-mrecord-mcount-for-every-makefile.patch b/queue-4.4/tracing-avoid-calling-cc-option-mrecord-mcount-for-every-makefile.patch
new file mode 100644 (file)
index 0000000..2cda696
--- /dev/null
@@ -0,0 +1,76 @@
+From 07d0408120216b60625c9a5b8012d1c3a907984d Mon Sep 17 00:00:00 2001
+From: Vasily Gorbik <gor@linux.ibm.com>
+Date: Mon, 6 Aug 2018 15:17:44 +0200
+Subject: tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
+
+From: Vasily Gorbik <gor@linux.ibm.com>
+
+commit 07d0408120216b60625c9a5b8012d1c3a907984d upstream.
+
+Currently if CONFIG_FTRACE_MCOUNT_RECORD is enabled -mrecord-mcount
+compiler flag support is tested for every Makefile.
+
+Top 4 cc-option usages:
+    511 -mrecord-mcount
+     11  -fno-stack-protector
+      9 -Wno-override-init
+      2 -fsched-pressure
+
+To address that move cc-option from scripts/Makefile.build to top Makefile
+and export CC_USING_RECORD_MCOUNT to be used in original place.
+
+While doing that also add -mrecord-mcount to CC_FLAGS_FTRACE (if gcc
+actually supports it).
+
+Link: http://lkml.kernel.org/r/patch-2.thread-aa7b8d.git-de935bace15a.your-ad-here.call-01533557518-ext-9465@work.hours
+
+Acked-by: Andi Kleen <ak@linux.intel.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile               |    7 +++++++
+ scripts/Makefile.build |    9 +++------
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -760,6 +760,13 @@ ifdef CONFIG_FUNCTION_TRACER
+ ifndef CC_FLAGS_FTRACE
+ CC_FLAGS_FTRACE := -pg
+ endif
++ifdef CONFIG_FTRACE_MCOUNT_RECORD
++  # gcc 5 supports generating the mcount tables directly
++  ifeq ($(call cc-option-yn,-mrecord-mcount),y)
++    CC_FLAGS_FTRACE   += -mrecord-mcount
++    export CC_USING_RECORD_MCOUNT := 1
++  endif
++endif
+ export CC_FLAGS_FTRACE
+ ifdef CONFIG_HAVE_FENTRY
+ CC_USING_FENTRY       := $(call cc-option, -mfentry -DCC_USING_FENTRY)
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -221,11 +221,8 @@ cmd_modversions_c =                                                               \
+ endif
+ ifdef CONFIG_FTRACE_MCOUNT_RECORD
+-# gcc 5 supports generating the mcount tables directly
+-ifneq ($(call cc-option,-mrecord-mcount,y),y)
+-KBUILD_CFLAGS += -mrecord-mcount
+-else
+-# else do it all manually
++ifndef CC_USING_RECORD_MCOUNT
++# compiler will not generate __mcount_loc use recordmcount or recordmcount.pl
+ ifdef BUILD_C_RECORDMCOUNT
+ ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
+   RECORDMCOUNT_FLAGS = -w
+@@ -254,7 +251,7 @@ cmd_record_mcount =                                                \
+            "$(CC_FLAGS_FTRACE)" ]; then                       \
+               $(sub_cmd_record_mcount)                        \
+       fi;
+-endif # -record-mcount
++endif # CC_USING_RECORD_MCOUNT
+ endif
+ define rule_cc_o_c
diff --git a/queue-4.4/tracing-fix-skip_stack_validation-1-build-due-to-bad-merge-with-mrecord-mcount.patch b/queue-4.4/tracing-fix-skip_stack_validation-1-build-due-to-bad-merge-with-mrecord-mcount.patch
new file mode 100644 (file)
index 0000000..67db627
--- /dev/null
@@ -0,0 +1,43 @@
+From ed7d40bc67b8353c677b38c6cdddcdc310c0f452 Mon Sep 17 00:00:00 2001
+From: Greg Thelen <gthelen@google.com>
+Date: Fri, 8 Jun 2018 14:47:46 -0700
+Subject: tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
+
+From: Greg Thelen <gthelen@google.com>
+
+commit ed7d40bc67b8353c677b38c6cdddcdc310c0f452 upstream.
+
+Non gcc-5 builds with CONFIG_STACK_VALIDATION=y and
+SKIP_STACK_VALIDATION=1 fail.
+Example output:
+  /bin/sh: init/.tmp_main.o: Permission denied
+
+commit 96f60dfa5819 ("trace: Use -mcount-record for dynamic ftrace"),
+added a mismatched endif.  This causes cmd_objtool to get mistakenly
+set.
+
+Relocate endif to balance the newly added -record-mcount check.
+
+Link: http://lkml.kernel.org/r/20180608214746.136554-1-gthelen@google.com
+
+Fixes: 96f60dfa5819 ("trace: Use -mcount-record for dynamic ftrace")
+Acked-by: Andi Kleen <ak@linux.intel.com>
+Tested-by: David Rientjes <rientjes@google.com>
+Signed-off-by: Greg Thelen <gthelen@google.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/Makefile.build |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -254,7 +254,7 @@ cmd_record_mcount =                                                \
+            "$(CC_FLAGS_FTRACE)" ]; then                       \
+               $(sub_cmd_record_mcount)                        \
+       fi;
+-endif
++endif # -record-mcount
+ endif
+ define rule_cc_o_c