From: Greg Kroah-Hartman Date: Thu, 10 Jan 2019 18:31:58 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.20.2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfeb2f6ac53fe6ea2d81bf43ae35e2caad2fd3ab;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: ftrace-build-with-cppflags-to-get-qunused-arguments.patch kbuild-add-no-integrated-as-clang-option-unconditionally.patch kbuild-consolidate-clang-compiler-flags.patch makefile-export-clang-toolchain-variables.patch md-raid10-remove-vlais.patch powerpc-avoid-mno-sched-epilog-on-gcc-4.9-and-newer.patch powerpc-boot-set-target-when-cross-compiling-for-clang.patch powerpc-disable-wbuiltin-requires-header-when-setjmp-is-used.patch raid6-ppc-fix-build-for-clang.patch --- diff --git a/queue-4.14/ftrace-build-with-cppflags-to-get-qunused-arguments.patch b/queue-4.14/ftrace-build-with-cppflags-to-get-qunused-arguments.patch new file mode 100644 index 00000000000..b16ecb13e9e --- /dev/null +++ b/queue-4.14/ftrace-build-with-cppflags-to-get-qunused-arguments.patch @@ -0,0 +1,33 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Joel Stanley +Date: Mon, 17 Sep 2018 17:07:54 +0930 +Subject: ftrace: Build with CPPFLAGS to get -Qunused-arguments + +From: Joel Stanley + +When building to record the mcount locations the kernel uses +KBUILD_CFLAGS but not KBUILD_CPPFLAGS. This means it lacks +-Qunused-arguments when building with clang, resulting in a lot of +noisy warnings. + +Signed-off-by: Joel Stanley +Reviewed-by: Nick Desaulniers +Signed-off-by: Masahiro Yamada +[nc: Fix conflicts due to lack of 87a32e624037 and d503ac531a52] +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + scripts/Makefile.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/Makefile.build ++++ b/scripts/Makefile.build +@@ -242,7 +242,7 @@ else + sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ + "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ + "$(if $(CONFIG_64BIT),64,32)" \ +- "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ ++ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \ + "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ + "$(if $(part-of-module),1,0)" "$(@)"; + recordmcount_source := $(srctree)/scripts/recordmcount.pl diff --git a/queue-4.14/kbuild-add-no-integrated-as-clang-option-unconditionally.patch b/queue-4.14/kbuild-add-no-integrated-as-clang-option-unconditionally.patch new file mode 100644 index 00000000000..32108678afe --- /dev/null +++ b/queue-4.14/kbuild-add-no-integrated-as-clang-option-unconditionally.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Masahiro Yamada +Date: Tue, 6 Nov 2018 12:04:54 +0900 +Subject: kbuild: add -no-integrated-as Clang option unconditionally + +From: Masahiro Yamada + +commit dbe27a002ef8573168cb64e181458ea23a74e2b6 upstream. + +We are still a way off the Clang's integrated assembler support for +the kernel. Hence, -no-integrated-as is mandatory to build the kernel +with Clang. If you had an ancient version of Clang that does not +recognize this option, you would not be able to compile the kernel +anyway. + +Signed-off-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Tested-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -489,8 +489,8 @@ CLANG_GCC_TC := --gcc-toolchain=$(GCC_TO + endif + KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) + KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +-KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) +-KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) ++KBUILD_CFLAGS += -no-integrated-as ++KBUILD_AFLAGS += -no-integrated-as + endif + + RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register diff --git a/queue-4.14/kbuild-consolidate-clang-compiler-flags.patch b/queue-4.14/kbuild-consolidate-clang-compiler-flags.patch new file mode 100644 index 00000000000..b6404aeb34c --- /dev/null +++ b/queue-4.14/kbuild-consolidate-clang-compiler-flags.patch @@ -0,0 +1,50 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Masahiro Yamada +Date: Tue, 6 Nov 2018 12:04:55 +0900 +Subject: kbuild: consolidate Clang compiler flags + +From: Masahiro Yamada + +commit 238bcbc4e07fad2fff99c5b157d0c37ccd4d093c upstream. + +Collect basic Clang options such as --target, --prefix, --gcc-toolchain, +-no-integrated-as into a single variable CLANG_FLAGS so that it can be +easily reused in other parts of Makefile. + +Signed-off-by: Masahiro Yamada +Reviewed-by: Nick Desaulniers +Tested-by: Nick Desaulniers +Acked-by: Greg Hackmann +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -479,18 +479,17 @@ endif + + ifeq ($(cc-name),clang) + ifneq ($(CROSS_COMPILE),) +-CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) ++CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) + GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) +-CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) ++CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) + GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) + endif + ifneq ($(GCC_TOOLCHAIN),) +-CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) ++CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) + endif +-KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +-KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +-KBUILD_CFLAGS += -no-integrated-as +-KBUILD_AFLAGS += -no-integrated-as ++CLANG_FLAGS += -no-integrated-as ++KBUILD_CFLAGS += $(CLANG_FLAGS) ++KBUILD_AFLAGS += $(CLANG_FLAGS) + endif + + RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register diff --git a/queue-4.14/makefile-export-clang-toolchain-variables.patch b/queue-4.14/makefile-export-clang-toolchain-variables.patch new file mode 100644 index 00000000000..cd2c4c299b1 --- /dev/null +++ b/queue-4.14/makefile-export-clang-toolchain-variables.patch @@ -0,0 +1,29 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Joel Stanley +Date: Mon, 12 Nov 2018 14:51:15 +1030 +Subject: Makefile: Export clang toolchain variables + +From: Joel Stanley + +commit 3bd9805090af843b25f97ffe5049f20ade1d86d6 upstream. + +The powerpc makefile will use these in it's boot wrapper. + +Signed-off-by: Joel Stanley +Signed-off-by: Masahiro Yamada +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 1 + + 1 file changed, 1 insertion(+) + +--- a/Makefile ++++ b/Makefile +@@ -490,6 +490,7 @@ endif + CLANG_FLAGS += -no-integrated-as + KBUILD_CFLAGS += $(CLANG_FLAGS) + KBUILD_AFLAGS += $(CLANG_FLAGS) ++export CLANG_FLAGS + endif + + RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register diff --git a/queue-4.14/md-raid10-remove-vlais.patch b/queue-4.14/md-raid10-remove-vlais.patch new file mode 100644 index 00000000000..8864e311a11 --- /dev/null +++ b/queue-4.14/md-raid10-remove-vlais.patch @@ -0,0 +1,70 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Matthias Kaehlcke +Date: Thu, 5 Oct 2017 11:28:47 -0700 +Subject: md: raid10: remove VLAIS + +From: Matthias Kaehlcke + +commit 584ed9fa9532f8b9d5955628ff87ee3b2ab9f5a9 upstream. + +The raid10 driver can't be built with clang since it uses a variable +length array in a structure (VLAIS): + +drivers/md/raid10.c:4583:17: error: fields must have a constant size: + 'variable length array in structure' extension will never be supported + +Allocate the r10bio struct with kmalloc instead of using the VLAIS +construct. + +Shaohua: set the MD_RECOVERY_INTR bit +Neil Brown: use GFP_NOIO + +Signed-off-by: Matthias Kaehlcke +Reviewed-by: Guenter Roeck +Signed-off-by: Shaohua Li +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/raid10.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/md/raid10.c ++++ b/drivers/md/raid10.c +@@ -4591,15 +4591,18 @@ static int handle_reshape_read_error(str + /* Use sync reads to get the blocks from somewhere else */ + int sectors = r10_bio->sectors; + struct r10conf *conf = mddev->private; +- struct { +- struct r10bio r10_bio; +- struct r10dev devs[conf->copies]; +- } on_stack; +- struct r10bio *r10b = &on_stack.r10_bio; ++ struct r10bio *r10b; + int slot = 0; + int idx = 0; + struct page **pages; + ++ r10b = kmalloc(sizeof(*r10b) + ++ sizeof(struct r10dev) * conf->copies, GFP_NOIO); ++ if (!r10b) { ++ set_bit(MD_RECOVERY_INTR, &mddev->recovery); ++ return -ENOMEM; ++ } ++ + /* reshape IOs share pages from .devs[0].bio */ + pages = get_resync_pages(r10_bio->devs[0].bio)->pages; + +@@ -4648,11 +4651,13 @@ static int handle_reshape_read_error(str + /* couldn't read this block, must give up */ + set_bit(MD_RECOVERY_INTR, + &mddev->recovery); ++ kfree(r10b); + return -EIO; + } + sectors -= s; + idx++; + } ++ kfree(r10b); + return 0; + } + diff --git a/queue-4.14/powerpc-avoid-mno-sched-epilog-on-gcc-4.9-and-newer.patch b/queue-4.14/powerpc-avoid-mno-sched-epilog-on-gcc-4.9-and-newer.patch new file mode 100644 index 00000000000..f120f1fe467 --- /dev/null +++ b/queue-4.14/powerpc-avoid-mno-sched-epilog-on-gcc-4.9-and-newer.patch @@ -0,0 +1,35 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Nicholas Piggin +Date: Fri, 14 Sep 2018 15:08:54 +1000 +Subject: powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer + +From: Nicholas Piggin + +commit 6977f95e63b9b3fb4a5973481a800dd9f48a1338 upstream. + +Signed-off-by: Nicholas Piggin +Reviewed-by: Joel Stanley +Signed-off-by: Michael Ellerman +[nc: Adjust context due to lack of f2910f0e6835 and 2a056f58fd33] +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/Makefile | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/Makefile ++++ b/arch/powerpc/Makefile +@@ -236,7 +236,12 @@ endif + + # Work around a gcc code-gen bug with -fno-omit-frame-pointer. + ifeq ($(CONFIG_FUNCTION_TRACER),y) +-KBUILD_CFLAGS += -mno-sched-epilog ++# Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8 ++# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199 ++# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828 ++ifneq ($(cc-name),clang) ++KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog) ++endif + endif + + cpu-as-$(CONFIG_4xx) += -Wa,-m405 diff --git a/queue-4.14/powerpc-boot-set-target-when-cross-compiling-for-clang.patch b/queue-4.14/powerpc-boot-set-target-when-cross-compiling-for-clang.patch new file mode 100644 index 00000000000..a82ecaa17aa --- /dev/null +++ b/queue-4.14/powerpc-boot-set-target-when-cross-compiling-for-clang.patch @@ -0,0 +1,41 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Joel Stanley +Date: Mon, 12 Nov 2018 14:51:16 +1030 +Subject: powerpc/boot: Set target when cross-compiling for clang + +From: Joel Stanley + +commit 813af51f5d30a2da6a2523c08465f9726e51772e upstream. + +Clang needs to be told which target it is building for when cross +compiling. + +Link: https://github.com/ClangBuiltLinux/linux/issues/259 +Signed-off-by: Joel Stanley +Tested-by: Daniel Axtens # powerpc 64-bit BE +Acked-by: Michael Ellerman +Reviewed-by: Nick Desaulniers +Signed-off-by: Masahiro Yamada +[nc: Use 'ifeq ($(cc-name),clang)' instead of 'ifdef CONFIG_CC_IS_CLANG' + because that config does not exist in 4.14; the Kconfig rewrite + that added that config happened in 4.18] +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/boot/Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/powerpc/boot/Makefile ++++ b/arch/powerpc/boot/Makefile +@@ -49,6 +49,11 @@ endif + + BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc + ++ifeq ($(cc-name),clang) ++BOOTCFLAGS += $(CLANG_FLAGS) ++BOOTAFLAGS += $(CLANG_FLAGS) ++endif ++ + ifdef CONFIG_DEBUG_INFO + BOOTCFLAGS += -g + endif diff --git a/queue-4.14/powerpc-disable-wbuiltin-requires-header-when-setjmp-is-used.patch b/queue-4.14/powerpc-disable-wbuiltin-requires-header-when-setjmp-is-used.patch new file mode 100644 index 00000000000..aa43f0f58aa --- /dev/null +++ b/queue-4.14/powerpc-disable-wbuiltin-requires-header-when-setjmp-is-used.patch @@ -0,0 +1,65 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Joel Stanley +Date: Mon, 17 Sep 2018 17:16:21 +0930 +Subject: powerpc: Disable -Wbuiltin-requires-header when setjmp is used + +From: Joel Stanley + +commit aea447141c7e7824b81b49acd1bc785506fba46e upstream. + +The powerpc kernel uses setjmp which causes a warning when building +with clang: + + In file included from arch/powerpc/xmon/xmon.c:51: + ./arch/powerpc/include/asm/setjmp.h:15:13: error: declaration of + built-in function 'setjmp' requires inclusion of the header + [-Werror,-Wbuiltin-requires-header] + extern long setjmp(long *); + ^ + ./arch/powerpc/include/asm/setjmp.h:16:13: error: declaration of + built-in function 'longjmp' requires inclusion of the header + [-Werror,-Wbuiltin-requires-header] + extern void longjmp(long *, long); + ^ + +This *is* the header and we're not using the built-in setjump but +rather the one in arch/powerpc/kernel/misc.S. As the compiler warning +does not make sense, it for the files where setjmp is used. + +Signed-off-by: Joel Stanley +Reviewed-by: Nick Desaulniers +[mpe: Move subdir-ccflags in xmon/Makefile to not clobber -Werror] +Signed-off-by: Michael Ellerman +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/kernel/Makefile | 3 +++ + arch/powerpc/xmon/Makefile | 5 ++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/kernel/Makefile ++++ b/arch/powerpc/kernel/Makefile +@@ -5,6 +5,9 @@ + + CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' + ++# Disable clang warning for using setjmp without setjmp.h header ++CFLAGS_crash.o += $(call cc-disable-warning, builtin-requires-header) ++ + subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror + + ifeq ($(CONFIG_PPC64),y) +--- a/arch/powerpc/xmon/Makefile ++++ b/arch/powerpc/xmon/Makefile +@@ -1,7 +1,10 @@ + # SPDX-License-Identifier: GPL-2.0 + # Makefile for xmon + +-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror ++# Disable clang warning for using setjmp without setjmp.h header ++subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header) ++ ++subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror + + GCOV_PROFILE := n + UBSAN_SANITIZE := n diff --git a/queue-4.14/raid6-ppc-fix-build-for-clang.patch b/queue-4.14/raid6-ppc-fix-build-for-clang.patch new file mode 100644 index 00000000000..4ff007b3e56 --- /dev/null +++ b/queue-4.14/raid6-ppc-fix-build-for-clang.patch @@ -0,0 +1,62 @@ +From foo@baz Thu Jan 10 19:31:14 CET 2019 +From: Joel Stanley +Date: Fri, 2 Nov 2018 11:14:55 +1030 +Subject: raid6/ppc: Fix build for clang + +From: Joel Stanley + +commit e213574a449f7a57d4202c1869bbc7680b6b5521 upstream. + +We cannot build these files with clang as it does not allow altivec +instructions in assembly when -msoft-float is passed. + +Jinsong Ji wrote: +> We currently disable Altivec/VSX support when enabling soft-float. So +> any usage of vector builtins will break. +> +> Enable Altivec/VSX with soft-float may need quite some clean up work, so +> I guess this is currently a limitation. +> +> Removing -msoft-float will make it work (and we are lucky that no +> floating point instructions will be generated as well). + +This is a workaround until the issue is resolved in clang. + +Link: https://bugs.llvm.org/show_bug.cgi?id=31177 +Link: https://github.com/ClangBuiltLinux/linux/issues/239 +Signed-off-by: Joel Stanley +Reviewed-by: Nick Desaulniers +Signed-off-by: Michael Ellerman +[nc: Use 'ifeq ($(cc-name),clang)' instead of 'ifdef CONFIG_CC_IS_CLANG' + because that config does not exist in 4.14; the Kconfig rewrite + that added that config happened in 4.18] +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + lib/raid6/Makefile | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/lib/raid6/Makefile ++++ b/lib/raid6/Makefile +@@ -18,6 +18,21 @@ quiet_cmd_unroll = UNROLL $@ + + ifeq ($(CONFIG_ALTIVEC),y) + altivec_flags := -maltivec $(call cc-option,-mabi=altivec) ++ ++ifeq ($(cc-name),clang) ++# clang ppc port does not yet support -maltivec when -msoft-float is ++# enabled. A future release of clang will resolve this ++# https://bugs.llvm.org/show_bug.cgi?id=31177 ++CFLAGS_REMOVE_altivec1.o += -msoft-float ++CFLAGS_REMOVE_altivec2.o += -msoft-float ++CFLAGS_REMOVE_altivec4.o += -msoft-float ++CFLAGS_REMOVE_altivec8.o += -msoft-float ++CFLAGS_REMOVE_altivec8.o += -msoft-float ++CFLAGS_REMOVE_vpermxor1.o += -msoft-float ++CFLAGS_REMOVE_vpermxor2.o += -msoft-float ++CFLAGS_REMOVE_vpermxor4.o += -msoft-float ++CFLAGS_REMOVE_vpermxor8.o += -msoft-float ++endif + endif + + # The GCC option -ffreestanding is required in order to compile code containing diff --git a/queue-4.14/series b/queue-4.14/series index c20717d30b7..e99e81dee2d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -66,3 +66,12 @@ mm-hmm-mark-hmm_devmem_-add-add_resource-export_symbol_gpl.patch mm-swap-fix-swapoff-with-ksm-pages.patch sunrpc-fix-cache_head-leak-due-to-queued-request.patch sunrpc-use-svc_net-in-svcauth_gss_-functions.patch +powerpc-avoid-mno-sched-epilog-on-gcc-4.9-and-newer.patch +powerpc-disable-wbuiltin-requires-header-when-setjmp-is-used.patch +ftrace-build-with-cppflags-to-get-qunused-arguments.patch +md-raid10-remove-vlais.patch +kbuild-add-no-integrated-as-clang-option-unconditionally.patch +kbuild-consolidate-clang-compiler-flags.patch +makefile-export-clang-toolchain-variables.patch +powerpc-boot-set-target-when-cross-compiling-for-clang.patch +raid6-ppc-fix-build-for-clang.patch