From: Greg Kroah-Hartman Date: Mon, 8 Oct 2012 15:57:01 +0000 (-0700) Subject: 3.5-stable patches X-Git-Tag: v3.0.46~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=89a63f3be7d9f9a466a701a7b7828d111a945e40;p=thirdparty%2Fkernel%2Fstable-queue.git 3.5-stable patches added patches: kbuild-fix-gcc-x-syntax.patch kbuild-make-fix-if_changed-when-command-contains-backslashes.patch mn10300-only-add-mmem-funcs-to-kbuild_cflags-if-gcc-supports-it.patch slab-fix-the-deadlock-issue-on-l3-alien-lock.patch --- diff --git a/queue-3.5/kbuild-fix-gcc-x-syntax.patch b/queue-3.5/kbuild-fix-gcc-x-syntax.patch new file mode 100644 index 00000000000..88d7aac203a --- /dev/null +++ b/queue-3.5/kbuild-fix-gcc-x-syntax.patch @@ -0,0 +1,205 @@ +From b1e0d8b70fa31821ebca3965f2ef8619d7c5e316 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 2 Oct 2012 16:42:36 +0200 +Subject: kbuild: Fix gcc -x syntax + +From: Jean Delvare + +commit b1e0d8b70fa31821ebca3965f2ef8619d7c5e316 upstream. + +The correct syntax for gcc -x is "gcc -x assembler", not +"gcc -xassembler". Even though the latter happens to work, the former +is what is documented in the manual page and thus what gcc wrappers +such as icecream do expect. + +This isn't a cosmetic change. The missing space prevents icecream from +recognizing compilation tasks it can't handle, leading to silent kernel +miscompilations. + +Besides me, credits go to Michael Matz and Dirk Mueller for +investigating the miscompilation issue and tracking it down to this +incorrect -x parameter syntax. + +Signed-off-by: Jean Delvare +Acked-by: Ingo Molnar +Cc: Bernhard Walle +Cc: Michal Marek +Cc: Ralf Baechle +Signed-off-by: Michal Marek +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/Makefile | 2 +- + arch/mips/kernel/Makefile | 2 +- + arch/x86/Makefile | 2 +- + scripts/Kbuild.include | 12 ++++++------ + scripts/gcc-version.sh | 6 +++--- + scripts/gcc-x86_32-has-stack-protector.sh | 2 +- + scripts/gcc-x86_64-has-stack-protector.sh | 2 +- + scripts/kconfig/check.sh | 2 +- + scripts/kconfig/lxdialog/check-lxdialog.sh | 2 +- + tools/perf/Makefile | 2 +- + tools/power/cpupower/Makefile | 2 +- + 11 files changed, 18 insertions(+), 18 deletions(-) + +--- a/arch/mips/Makefile ++++ b/arch/mips/Makefile +@@ -225,7 +225,7 @@ KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(d + LDFLAGS += -m $(ld-emul) + + ifdef CONFIG_MIPS +-CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -xc /dev/null | \ ++CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ + egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ + sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/") + ifdef CONFIG_64BIT +--- a/arch/mips/kernel/Makefile ++++ b/arch/mips/kernel/Makefile +@@ -104,7 +104,7 @@ obj-$(CONFIG_MIPS_MACHINE) += mips_machi + + obj-$(CONFIG_OF) += prom.o + +-CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) ++CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) + + obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o + +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -85,7 +85,7 @@ endif + ifdef CONFIG_X86_X32 + x32_ld_ok := $(call try-run,\ + /bin/echo -e '1: .quad 1b' | \ +- $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \ ++ $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ + $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ + $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) + ifeq ($(x32_ld_ok),y) +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -98,24 +98,24 @@ try-run = $(shell set -e; \ + # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) + + as-option = $(call try-run,\ +- $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) + + # as-instr + # Usage: cflags-y += $(call as-instr,instr,option1,option2) + + as-instr = $(call try-run,\ +- printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) ++ printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) + + # cc-option + # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) + + cc-option = $(call try-run,\ +- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) + + # cc-option-yn + # Usage: flag := $(call cc-option-yn,-march=winchip-c6) + cc-option-yn = $(call try-run,\ +- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) ++ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) + + # cc-option-align + # Prefix align with either -falign or -malign +@@ -125,7 +125,7 @@ cc-option-align = $(subst -functions=0,, + # cc-disable-warning + # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) + cc-disable-warning = $(call try-run,\ +- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) ++ $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) + + # cc-version + # Usage gcc-ver := $(call cc-version) +@@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-versi + # cc-ldoption + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) + cc-ldoption = $(call try-run,\ +- $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + + # ld-option + # Usage: LDFLAGS += $(call ld-option, -X) +--- a/scripts/gcc-version.sh ++++ b/scripts/gcc-version.sh +@@ -22,10 +22,10 @@ if [ ${#compiler} -eq 0 ]; then + exit 1 + fi + +-MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) +-MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) ++MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) ++MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) + if [ "x$with_patchlevel" != "x" ] ; then +- PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) ++ PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) + printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL + else + printf "%02d%02d\\n" $MAJOR $MINOR +--- a/scripts/gcc-x86_32-has-stack-protector.sh ++++ b/scripts/gcc-x86_32-has-stack-protector.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" ++echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" + if [ "$?" -eq "0" ] ; then + echo y + else +--- a/scripts/gcc-x86_64-has-stack-protector.sh ++++ b/scripts/gcc-x86_64-has-stack-protector.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" ++echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" + if [ "$?" -eq "0" ] ; then + echo y + else +--- a/scripts/kconfig/check.sh ++++ b/scripts/kconfig/check.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + # Needed for systems without gettext +-$* -xc -o /dev/null - > /dev/null 2>&1 << EOF ++$* -x c -o /dev/null - > /dev/null 2>&1 << EOF + #include + int main() + { +--- a/scripts/kconfig/lxdialog/check-lxdialog.sh ++++ b/scripts/kconfig/lxdialog/check-lxdialog.sh +@@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15 + + # Check if we can link to ncurses + check() { +- $cc -xc - -o $tmp 2>/dev/null <<'EOF' ++ $cc -x c - -o $tmp 2>/dev/null <<'EOF' + #include CURSES_LOC + main() {} + EOF +--- a/tools/perf/Makefile ++++ b/tools/perf/Makefile +@@ -62,7 +62,7 @@ ifeq ($(ARCH),x86_64) + ARCH := x86 + IS_X86_64 := 0 + ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) +- IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) ++ IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) + endif + ifeq (${IS_X86_64}, 1) + RAW_ARCH := x86_64 +--- a/tools/power/cpupower/Makefile ++++ b/tools/power/cpupower/Makefile +@@ -111,7 +111,7 @@ GMO_FILES = ${shell for HLANG in ${LANGU + export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS + + # check if compiler option is supported +-cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} ++cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} + + # use '-Os' optimization if available, else use -O2 + OPTIMIZATION := $(call cc-supports,-Os,-O2) diff --git a/queue-3.5/kbuild-make-fix-if_changed-when-command-contains-backslashes.patch b/queue-3.5/kbuild-make-fix-if_changed-when-command-contains-backslashes.patch new file mode 100644 index 00000000000..18f7bcb02a4 --- /dev/null +++ b/queue-3.5/kbuild-make-fix-if_changed-when-command-contains-backslashes.patch @@ -0,0 +1,43 @@ +From c353acba28fb3fa1fd05fd6b85a9fc7938330f9c Mon Sep 17 00:00:00 2001 +From: Sascha Hauer +Date: Thu, 4 Oct 2012 17:11:17 -0700 +Subject: kbuild: make: fix if_changed when command contains backslashes + +From: Sascha Hauer + +commit c353acba28fb3fa1fd05fd6b85a9fc7938330f9c upstream. + +The call if_changed mechanism does not work when the command contains +backslashes. This basically is an issue with lzo and bzip2 compressed +kernels. The compressed binaries do not contain the uncompressed image +size, so these use size_append to append the size. This results in +backslashes in the executed command. With this if_changed always +detects a change in the command and rebuilds the compressed image even +if nothing has changed. + +Fix this by escaping backslashes in make-cmd + +Signed-off-by: Sascha Hauer +Signed-off-by: Jan Luebbe +Cc: Sam Ravnborg +Cc: Bernhard Walle +Cc: Michal Marek +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/Kbuild.include | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -209,7 +209,7 @@ endif + # >$< substitution to preserve $ when reloading .cmd file + # note: when using inline perl scripts [perl -e '...$$t=1;...'] + # in $(cmd_xxx) double $$ your perl vars +-make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) ++make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) + + # Find any prerequisites that is newer than target or that does not exist. + # PHONY targets skipped in both cases. diff --git a/queue-3.5/mn10300-only-add-mmem-funcs-to-kbuild_cflags-if-gcc-supports-it.patch b/queue-3.5/mn10300-only-add-mmem-funcs-to-kbuild_cflags-if-gcc-supports-it.patch new file mode 100644 index 00000000000..805fc67be70 --- /dev/null +++ b/queue-3.5/mn10300-only-add-mmem-funcs-to-kbuild_cflags-if-gcc-supports-it.patch @@ -0,0 +1,38 @@ +From 9957423f035c2071f6d1c5d2f095cdafbeb25ad7 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Thu, 4 Oct 2012 17:11:13 -0700 +Subject: mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it + +From: Geert Uytterhoeven + +commit 9957423f035c2071f6d1c5d2f095cdafbeb25ad7 upstream. + +It seems the current (gcc 4.6.3) no longer provides this so make it +conditional. + +As reported by Tony before, the mn10300 architecture cross-compiles with +gcc-4.6.3 if -mmem-funcs is not added to KBUILD_CFLAGS. + +Reported-by: Tony Breeds +Signed-off-by: Geert Uytterhoeven +Cc: David Howells +Cc: Koichi Yasutake +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mn10300/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mn10300/Makefile ++++ b/arch/mn10300/Makefile +@@ -26,7 +26,7 @@ CHECKFLAGS += + PROCESSOR := unset + UNIT := unset + +-KBUILD_CFLAGS += -mam33 -mmem-funcs -DCPU=AM33 ++KBUILD_CFLAGS += -mam33 -DCPU=AM33 $(call cc-option,-mmem-funcs,) + KBUILD_AFLAGS += -mam33 -DCPU=AM33 + + ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y) diff --git a/queue-3.5/series b/queue-3.5/series index 09c083c7211..e6b0fe222c6 100644 --- a/queue-3.5/series +++ b/queue-3.5/series @@ -1 +1,5 @@ revert-dyndbg-fix-for-soh-in-logging-messages.patch +mn10300-only-add-mmem-funcs-to-kbuild_cflags-if-gcc-supports-it.patch +kbuild-make-fix-if_changed-when-command-contains-backslashes.patch +kbuild-fix-gcc-x-syntax.patch +slab-fix-the-deadlock-issue-on-l3-alien-lock.patch diff --git a/queue-3.5/slab-fix-the-deadlock-issue-on-l3-alien-lock.patch b/queue-3.5/slab-fix-the-deadlock-issue-on-l3-alien-lock.patch new file mode 100644 index 00000000000..d096f931052 --- /dev/null +++ b/queue-3.5/slab-fix-the-deadlock-issue-on-l3-alien-lock.patch @@ -0,0 +1,102 @@ +From 947ca1856a7e60aa6d20536785e6a42dff25aa6e Mon Sep 17 00:00:00 2001 +From: Michael Wang +Date: Wed, 5 Sep 2012 10:33:18 +0800 +Subject: slab: fix the DEADLOCK issue on l3 alien lock + +From: Michael Wang + +commit 947ca1856a7e60aa6d20536785e6a42dff25aa6e upstream. + +DEADLOCK will be report while running a kernel with NUMA and LOCKDEP enabled, +the process of this fake report is: + + kmem_cache_free() //free obj in cachep + -> cache_free_alien() //acquire cachep's l3 alien lock + -> __drain_alien_cache() + -> free_block() + -> slab_destroy() + -> kmem_cache_free() //free slab in cachep->slabp_cache + -> cache_free_alien() //acquire cachep->slabp_cache's l3 alien lock + +Since the cachep and cachep->slabp_cache's l3 alien are in the same lock class, +fake report generated. + +This should not happen since we already have init_lock_keys() which will +reassign the lock class for both l3 list and l3 alien. + +However, init_lock_keys() was invoked at a wrong position which is before we +invoke enable_cpucache() on each cache. + +Since until set slab_state to be FULL, we won't invoke enable_cpucache() +on caches to build their l3 alien while creating them, so although we invoked +init_lock_keys(), the l3 alien lock class won't change since we don't have +them until invoked enable_cpucache() later. + +This patch will invoke init_lock_keys() after we done enable_cpucache() +instead of before to avoid the fake DEADLOCK report. + +Michael traced the problem back to a commit in release 3.0.0: + +commit 30765b92ada267c5395fc788623cb15233276f5c +Author: Peter Zijlstra +Date: Thu Jul 28 23:22:56 2011 +0200 + + slab, lockdep: Annotate the locks before using them + + Fernando found we hit the regular OFF_SLAB 'recursion' before we + annotate the locks, cure this. + + The relevant portion of the stack-trace: + + > [ 0.000000] [] rt_spin_lock+0x50/0x56 + > [ 0.000000] [] __cache_free+0x43/0xc3 + > [ 0.000000] [] kmem_cache_free+0x6c/0xdc + > [ 0.000000] [] slab_destroy+0x4f/0x53 + > [ 0.000000] [] free_block+0x94/0xc1 + > [ 0.000000] [] do_tune_cpucache+0x10b/0x2bb + > [ 0.000000] [] enable_cpucache+0x7b/0xa7 + > [ 0.000000] [] kmem_cache_init_late+0x1f/0x61 + > [ 0.000000] [] start_kernel+0x24c/0x363 + > [ 0.000000] [] i386_start_kernel+0xa9/0xaf + + Reported-by: Fernando Lopez-Lezcano + Acked-by: Pekka Enberg + Signed-off-by: Peter Zijlstra + Link: http://lkml.kernel.org/r/1311888176.2617.379.camel@laptop + Signed-off-by: Ingo Molnar + +The commit moved init_lock_keys() before we build up the alien, so we +failed to reclass it. + +Acked-by: Christoph Lameter +Tested-by: Paul E. McKenney +Signed-off-by: Michael Wang +Signed-off-by: Pekka Enberg +Signed-off-by: Greg Kroah-Hartman + +--- + mm/slab.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/mm/slab.c ++++ b/mm/slab.c +@@ -1685,9 +1685,6 @@ void __init kmem_cache_init_late(void) + + g_cpucache_up = LATE; + +- /* Annotate slab for lockdep -- annotate the malloc caches */ +- init_lock_keys(); +- + /* 6) resize the head arrays to their final sizes */ + mutex_lock(&cache_chain_mutex); + list_for_each_entry(cachep, &cache_chain, next) +@@ -1695,6 +1692,9 @@ void __init kmem_cache_init_late(void) + BUG(); + mutex_unlock(&cache_chain_mutex); + ++ /* Annotate slab for lockdep -- annotate the malloc caches */ ++ init_lock_keys(); ++ + /* Done! */ + g_cpucache_up = FULL; +