Skip to contentSkip to conversation

powerpc patches for new Kconfig language

PATCH Superseded Nicholas Piggin 3 participants 10 messages May 16, 2018 – May 30, 2018

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

v4 cover powerpc patches for new Kconfig language

This series of patches improves th powerpc kbuild system. The motivation was to to be compatible with the new Kconfig scripting language that Yamada-san has proposed here:

https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/?h=kconfig-shell-v3

I have tested on top of that tree and powerpc now builds there.

I think patches 1-3 are improvements to the build system even before kconfig-shell, so they could be merged ahead of it in the powerpc tree.

Patch 4 takes advatage of a new feature of the kconfig-shell work to improve powerpc kconfig, so that should instead be merged with the kbuild tree with an ack from powerpc, after patches 1-3 are merged.

v4 just brings some build fixes to patch 3 (including a change from patch 4 that belonged in patch 3), and improvemets to changelogs.

Thanks,
Nick

Nicholas Piggin (4):
powerpc/kbuild: set default generic machine type for 32-bit compile powerpc/kbuild: remove CROSS32 defines from top level powerpc Makefile powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS powerpc/kbuild: move -mprofile-kernel check to Kconfig

 arch/powerpc/Kconfig                          | 16 +------
 arch/powerpc/Makefile                         | 45 ++++++++-----------
 arch/powerpc/boot/Makefile                    | 16 ++++---
 arch/powerpc/kernel/vdso32/Makefile           | 15 +++++--
 .../tools/gcc-check-mprofile-kernel.sh        | 12 +++--
 scripts/recordmcount.pl                       | 18 +++++++-
 6 files changed, 67 insertions(+), 55 deletions(-)
Signature · 1 line
2.17.0
author reviewer
#1 lore raw

PATCH v4 1/4 powerpc/kbuild: set default generic machine type for 32-bit compile

Some 64-bit toolchains uses the wrong ISA variant for compiling 32-bit kernels, even with -m32. Debian's powerpc64le is one such case, and that is because it is built with --with-cpu=power8.

So when cross compiling a 32-bit kernel with a 64-bit toolchain, set -mcpu=powerpc initially, which is the generic 32-bit powerpc machine type and scheduling model. CPU and platform code can override this with subsequent -mcpu flags if necessary.

This is not done for 32-bit toolchains otherwise it would override their defaults, which are presumably set appropriately for the environment (moreso than a 64-bit cross compiler).

This fixes a lot of build failures due to incompatible assembly when compiling 32-bit kernel with th Debian powerpc64le 64-bit toolchain.

Cc Segher Boessenkool <[email protected]>
---
 arch/powerpc/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/powerpc/Makefile +11 -0
index 95813df90801..15ca4bafad82 100644
@@ -24,9 +24,20 @@ ifeq ($(HAS_BIARCH),y)
 ifeq ($(CROSS32_COMPILE),)
 CROSS32CC	:= $(CC) -m32
 KBUILD_ARFLAGS	+= --target=elf32-powerpc
+
+ifdef CONFIG_PPC32
+# These options will be overridden by any -mcpu option that the CPU
+# or platform code sets later on the command line, but they are needed
+# to set a sane 32-bit cpu target for the 64-bit cross compiler which
+# may default to the wrong ISA.
+KBUILD_CFLAGS		+= -mcpu=powerpc
+KBUILD_AFLAGS		+= -mcpu=powerpc
+endif
+
 endif
 endif
 
+
 export CROSS32CC CROSS32AR
 
 ifeq ($(CROSS_COMPILE),)
Signature · 1 line
2.17.0
#2 lore raw

Re: [PATCH v4 1/4] powerpc/kbuild: set default generic machine type for 32-bit compile

2018-05-16 23:14 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 13 lines

Some 64-bit toolchains uses the wrong ISA variant for compiling 32-bit kernels, even with -m32. Debian's powerpc64le is one such case, and that is because it is built with --with-cpu=power8.

So when cross compiling a 32-bit kernel with a 64-bit toolchain, set -mcpu=powerpc initially, which is the generic 32-bit powerpc machine type and scheduling model. CPU and platform code can override this with subsequent -mcpu flags if necessary.

This is not done for 32-bit toolchains otherwise it would override their defaults, which are presumably set appropriately for the environment (moreso than a 64-bit cross compiler).

Quoted 6 lines

This fixes a lot of build failures due to incompatible assembly when compiling 32-bit kernel with th Debian powerpc64le 64-bit toolchain.

Cc Segher Boessenkool <[email protected]>

---

Can you please remove the noise changes?

1/4 adds some blank lines, then 2/4 removes them.

arch/powerpc/Makefile ifeq ($(HAS_BIARCH),y) · line 27

Quoted 12 lines
 arch/powerpc/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/powerpc/Makefile +1 -0
index 95813df90801..15ca4bafad82 100644
@@ -24,9 +24,20 @@ ifeq ($(HAS_BIARCH),y)
 ifeq ($(CROSS32_COMPILE),)
 CROSS32CC      := $(CC) -m32
 KBUILD_ARFLAGS += --target=elf32-powerpc
+

This blank line will be removed by the next patch.

arch/powerpc/Makefile ifeq ($(HAS_BIARCH),y) · line 36

Quoted 9 lines
arch/powerpc/Makefile +9 -0
+ifdef CONFIG_PPC32
+# These options will be overridden by any -mcpu option that the CPU
+# or platform code sets later on the command line, but they are needed
+# to set a sane 32-bit cpu target for the 64-bit cross compiler which
+# may default to the wrong ISA.
+KBUILD_CFLAGS          += -mcpu=powerpc
+KBUILD_AFLAGS          += -mcpu=powerpc
+endif
+

This blank line will be removed by the next patch.

arch/powerpc/Makefile ifeq ($(HAS_BIARCH),y) · line 40

Quoted 4 lines
arch/powerpc/Makefile +1 -0
 endif
 endif
 
+

This blank line will be removed by the next patch.

Quoted 10 lines
arch/powerpc/Makefile +0 -1
 export CROSS32CC CROSS32AR
 
 ifeq ($(CROSS_COMPILE),)
--

2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
author reviewer
#3 lore raw

Re: [PATCH v4 1/4] powerpc/kbuild: set default generic machine type for 32-bit compile

Quoted 17 lines · On Tue, 29 May 2018 22:39:48 +0900 Masahiro Yamada…

2018-05-16 23:14 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 16 lines

Some 64-bit toolchains uses the wrong ISA variant for compiling 32-bit kernels, even with -m32. Debian's powerpc64le is one such case, and that is because it is built with --with-cpu=power8.

So when cross compiling a 32-bit kernel with a 64-bit toolchain, set -mcpu=powerpc initially, which is the generic 32-bit powerpc machine type and scheduling model. CPU and platform code can override this with subsequent -mcpu flags if necessary.

This is not done for 32-bit toolchains otherwise it would override their defaults, which are presumably set appropriately for the environment (moreso than a 64-bit cross compiler).

This fixes a lot of build failures due to incompatible assembly when compiling 32-bit kernel with th Debian powerpc64le 64-bit toolchain.

Quoted 8 lines
Quoted 3 lines
Cc Segher Boessenkool <[email protected]>

---

Can you please remove the noise changes?

1/4 adds some blank lines, then 2/4 removes them.

Okay sure, I will change that.

Thanks,
Nick

author reviewer
#4 lore raw

PATCH v4 2/4 powerpc/kbuild: remove CROSS32 defines from top level powerpc Makefile

In reply to Nicholas Piggin

Switch VDSO32 build over to use CROSS32_COMPILE directly, and have it pass in -m32 after the standard c_flags. This allows endianness overrides to be removed and the endian and bitness flags moved into standard flags variables.

---
 arch/powerpc/Makefile               | 10 ----------
 arch/powerpc/boot/Makefile          | 16 +++++++++++-----
 arch/powerpc/kernel/vdso32/Makefile | 15 +++++++++++----
 3 files changed, 22 insertions(+), 19 deletions(-)
arch/powerpc/Makefile +0 -10
index 15ca4bafad82..167b26a0780c 100644
@@ -17,14 +17,8 @@ HAS_BIARCH	:= $(call cc-option-yn, -m32)
 # Set default 32 bits cross compilers for vdso and boot wrapper
 CROSS32_COMPILE ?=
 
-CROSS32CC		:= $(CROSS32_COMPILE)gcc
-CROSS32AR		:= $(CROSS32_COMPILE)ar
-
 ifeq ($(HAS_BIARCH),y)
 ifeq ($(CROSS32_COMPILE),)
-CROSS32CC	:= $(CC) -m32
-KBUILD_ARFLAGS	+= --target=elf32-powerpc
-
 ifdef CONFIG_PPC32
 # These options will be overridden by any -mcpu option that the CPU
 # or platform code sets later on the command line, but they are needed
@@ -33,13 +27,9 @@ ifdef CONFIG_PPC32
 KBUILD_CFLAGS		+= -mcpu=powerpc
 KBUILD_AFLAGS		+= -mcpu=powerpc
 endif
-
 endif
 endif
 
-
-export CROSS32CC CROSS32AR
-
 ifeq ($(CROSS_COMPILE),)
 KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
 else
arch/powerpc/boot/Makefile +11 -5
index 26d5d2a5b8e9..49767e06202c 100644
@@ -23,19 +23,23 @@ all: $(obj)/zImage
 compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP
 compress-$(CONFIG_KERNEL_XZ)   := CONFIG_KERNEL_XZ
 
+ifdef CROSS32_COMPILE
+    BOOTCC := $(CROSS32_COMPILE)gcc
+    BOOTAR := $(CROSS32_COMPILE)ar
+else
+    BOOTCC := $(CC)
+    BOOTAR := $(AR)
+endif
+
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -fno-strict-aliasing -Os -msoft-float -pipe \
 		 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
 		 -D$(compress-y)
 
-BOOTCC := $(CC)
 ifdef CONFIG_PPC64_BOOT_WRAPPER
 BOOTCFLAGS	+= -m64
 else
 BOOTCFLAGS	+= -m32
-ifdef CROSS32_COMPILE
-    BOOTCC := $(CROSS32_COMPILE)gcc
-endif
 endif
 
 BOOTCFLAGS	+= -isystem $(shell $(BOOTCC) -print-file-name=include)
@@ -49,6 +53,8 @@ endif
 
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
 
+BOOTARFLAGS	:= -cr$(KBUILD_ARFLAGS)
+
 ifdef CONFIG_DEBUG_INFO
 BOOTCFLAGS	+= -g
 endif
@@ -202,7 +208,7 @@ quiet_cmd_bootas = BOOTAS  $@
       cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
 
 quiet_cmd_bootar = BOOTAR  $@
-      cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
+      cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
 
 $(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
 	$(call if_changed_dep,bootcc)
arch/powerpc/kernel/vdso32/Makefile +11 -4
index b8c434d1d459..50112d4473bb 100644
@@ -8,8 +8,15 @@ obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o \
 
 # Build rules
 
-ifeq ($(CONFIG_PPC32),y)
-CROSS32CC := $(CC)
+ifdef CROSS32_COMPILE
+    VDSOCC := $(CROSS32_COMPILE)gcc
+else
+    VDSOCC := $(CC)
+endif
+
+CC32FLAGS :=
+ifdef CONFIG_PPC64
+CC32FLAGS += -m32
 endif
 
 targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
@@ -45,9 +52,9 @@ $(obj-vdso32): %.o: %.S FORCE
 
 # actual build commands
 quiet_cmd_vdso32ld = VDSO32L $@
-      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
+      cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
 quiet_cmd_vdso32as = VDSO32A $@
-      cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
+      cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
 
 # install commands for the unstripped file
 quiet_cmd_vdso_install = INSTALL $@
Signature · 1 line
2.17.0
author reviewer
#5 lore raw

PATCH v4 3/4 powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS

In reply to Nicholas Piggin

The powerpc toolchain can compile combinations of 32/64 bit and big/little endian, so it's convenient to consider, e.g.,

CC -m64 -mbig-endian

To be the C compiler for the purpose of invoking it to build target artifacts. So overriding the the CC variable to include these flags works for this purpose.

Unfortunately that is not compatible with the way the proposed new Kconfig macro language implementation, which gets confused by the the $(CC) environment variable changing.

After previous patches in this series, these flags can be carefully passed in using the usual kbuild flags variables instead.

---
Since v3:
- Added 32/64 flags to recordmcount.pl invocation of the toolchain, similarly to BE/LE. This fixes problems with toolchain default target bitness != kernel target bitness. I kept Steven's ack because it's much the same powerpc specific change, okay?

- Added a similar fix for mismatched toolchain default endianness or bitness to the gcc-check-mprofile-kernel.sh script. This was pulled in from patch 4 and improved (added comment and endianness flags).

 arch/powerpc/Makefile                          | 16 +++++++++-------
 .../powerpc/tools/gcc-check-mprofile-kernel.sh | 12 ++++++++----
 scripts/recordmcount.pl                        | 18 +++++++++++++++++-
 3 files changed, 34 insertions(+), 12 deletions(-)
arch/powerpc/Makefile +9 -7
index 167b26a0780c..6faf1d6ad9dd 100644
@@ -75,13 +75,15 @@ endif
 endif
 
 ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
-override LD	+= -EL
+KBUILD_CFLAGS	+= -mlittle-endian
+LDFLAGS		+= -EL
 LDEMULATION	:= lppc
 GNUTARGET	:= powerpcle
 MULTIPLEWORD	:= -mno-multiple
 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
 else
-override LD	+= -EB
+KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
+LDFLAGS		+= -EB
 LDEMULATION	:= ppc
 GNUTARGET	:= powerpc
 MULTIPLEWORD	:= -mmultiple
@@ -94,19 +96,19 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 endif
 
-cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
-cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
 ifneq ($(cc-name),clang)
   cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
 endif
 
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
 aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
 
 ifeq ($(HAS_BIARCH),y)
-override AS	+= -a$(BITS)
-override LD	+= -m elf$(BITS)$(LDEMULATION)
-override CC	+= -m$(BITS)
+KBUILD_CFLAGS	+= -m$(BITS)
+KBUILD_AFLAGS	+= -m$(BITS) -Wl,-a$(BITS)
+LDFLAGS		+= -m elf$(BITS)$(LDEMULATION)
 KBUILD_ARFLAGS	+= --target=elf$(BITS)-$(GNUTARGET)
 endif
 
arch/powerpc/tools/gcc-check-mprofile-kernel.sh +8 -4
index 061f8035bdbe..a7dd0e5d9f98 100755
@@ -7,17 +7,21 @@ set -o pipefail
 # To debug, uncomment the following line
 # set -x
 
+# -mprofile-kernel is only supported on 64le, so this should not be invoked
+# for other targets. Therefore we can pass in -m64 and -mlittle-endian
+# explicitly, to take care of toolchains defaulting to other targets.
+
 # Test whether the compile option -mprofile-kernel exists and generates
 # profiling code (ie. a call to _mcount()).
 echo "int func() { return 0; }" | \
-    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
-    grep -q "_mcount"
+    $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
+    2> /dev/null | grep -q "_mcount"
 
 # Test whether the notrace attribute correctly suppresses calls to _mcount().
 
 echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
-    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
-    grep -q "_mcount" && \
+    $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
+    2> /dev/null | grep -q "_mcount" && \
     exit 1
 
 echo "OK"
scripts/recordmcount.pl +17 -1
index 191eb949d52c..fe06e77c15eb 100755
@@ -266,13 +266,29 @@ if ($arch eq "x86_64") {
     $objcopy .= " -O elf32-sh-linux";
 
 } elsif ($arch eq "powerpc") {
+    my $ldemulation;
+
     $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
     # See comment in the sparc64 section for why we use '\w'.
     $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
 
+    if ($endian eq "big") {
+	    $cc .= " -mbig-endian ";
+	    $ld .= " -EB ";
+	    $ldemulation = "ppc"
+    } else {
+	    $cc .= " -mlittle-endian ";
+	    $ld .= " -EL ";
+	    $ldemulation = "lppc"
+    }
     if ($bits == 64) {
-	$type = ".quad";
+        $type = ".quad";
+        $cc .= " -m64 ";
+        $ld .= " -m elf64".$ldemulation." ";
+    } else {
+        $cc .= " -m32 ";
+        $ld .= " -m elf32".$ldemulation." ";
     }
 
 } elsif ($arch eq "arm") {
Signature · 1 line
2.17.0
author reviewer
#6 lore raw

PATCH v4 4/4 powerpc/kbuild: move -mprofile-kernel check to Kconfig

In reply to Nicholas Piggin

This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig.

[ Note: this depends on https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v3 ]

---
Since v3:
- Moved a stray hunk back to patch 3 where it belongs.

 arch/powerpc/Kconfig  | 16 +---------------
 arch/powerpc/Makefile | 14 ++------------
 2 files changed, 3 insertions(+), 27 deletions(-)
arch/powerpc/Kconfig +1 -15
index 512fcc177c87..af527f894f9b 100644
@@ -460,23 +460,9 @@ config LD_HEAD_STUB_CATCH
 
 	  If unsure, say "N".
 
-config DISABLE_MPROFILE_KERNEL
-	bool "Disable use of mprofile-kernel for kernel tracing"
-	depends on PPC64 && CPU_LITTLE_ENDIAN
-	default y
-	help
-	  Selecting this options disables use of the mprofile-kernel ABI for
-	  kernel tracing. That will cause options such as live patching
-	  (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to
-	  be disabled also.
-
-	  If you have a toolchain which supports mprofile-kernel, then you can
-	  disable this. Otherwise leave it enabled. If you're not sure, say
-	  "Y".
-
 config MPROFILE_KERNEL
 	depends on PPC64 && CPU_LITTLE_ENDIAN
-	def_bool !DISABLE_MPROFILE_KERNEL
+	def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
 
 config IOMMU_HELPER
 	def_bool PPC64
arch/powerpc/Makefile +2 -12
index 6faf1d6ad9dd..8f7a64fe7370 100644
@@ -161,18 +161,8 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
 endif
 
 ifdef CONFIG_MPROFILE_KERNEL
-    ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK)
-        CC_FLAGS_FTRACE := -pg -mprofile-kernel
-        KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
-    else
-        # If the user asked for mprofile-kernel but the toolchain doesn't
-        # support it, emit a warning and deliberately break the build later
-        # with mprofile-kernel-not-supported. We would prefer to make this an
-        # error right here, but then the user would never be able to run
-        # oldconfig to change their configuration.
-        $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL)
-        CC_FLAGS_FTRACE := -mprofile-kernel-not-supported
-    endif
+	CC_FLAGS_FTRACE := -pg -mprofile-kernel
+	KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
 endif
 
 CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
Signature · 1 line
2.17.0
#7 lore raw

Re: [PATCH v4 4/4] powerpc/kbuild: move -mprofile-kernel check to Kconfig

I love your patch! Yet something to improve:

Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-patches-for-new-Kconfig-language/20180517-224044
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allmodconfig
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
make.cross ARCH=powerpc allmodconfig
make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$' arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'

>> arch/powerpc/Kconfig:468: syntax error
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
>> arch/powerpc/Kconfig:467: invalid option

make[2]: *** [allmodconfig] Error 1
make[1]: *** [allmodconfig] Error 2
make: *** [sub-make] Error 2
--
arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$' arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'

>> arch/powerpc/Kconfig:468: syntax error
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
>> arch/powerpc/Kconfig:467: invalid option

make[2]: *** [oldconfig] Error 1
make[1]: *** [oldconfig] Error 2
make: *** [sub-make] Error 2
--
arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$' arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'

>> arch/powerpc/Kconfig:468: syntax error
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
   arch/powerpc/Kconfig:467:warning: ignoring unsupported character '$'
>> arch/powerpc/Kconfig:467: invalid option

make[2]: *** [olddefconfig] Error 1
make[2]: Target 'oldnoconfig' not remade because of errors. make[1]: *** [oldnoconfig] Error 2
make: *** [sub-make] Error 2

vim +468 arch/powerpc/Kconfig

e05c0e81 Kevin Hao       2013-07-16  443  
3d72bbc4 Michael Neuling 2013-02-13  444  config PPC_TRANSACTIONAL_MEM
3d72bbc4 Michael Neuling 2013-02-13  445         bool "Transactional Memory support for POWERPC"
3d72bbc4 Michael Neuling 2013-02-13  446         depends on PPC_BOOK3S_64
3d72bbc4 Michael Neuling 2013-02-13  447         depends on SMP
7b37a123 Michael Neuling 2014-01-08  448         select ALTIVEC
7b37a123 Michael Neuling 2014-01-08  449         select VSX
3d72bbc4 Michael Neuling 2013-02-13  450         default n
3d72bbc4 Michael Neuling 2013-02-13  451         ---help---
3d72bbc4 Michael Neuling 2013-02-13  452           Support user-mode Transactional Memory on POWERPC.
3d72bbc4 Michael Neuling 2013-02-13  453  
951eedeb Nicholas Piggin 2017-05-29  454  config LD_HEAD_STUB_CATCH
951eedeb Nicholas Piggin 2017-05-29  455  	bool "Reserve 256 bytes to cope with linker stubs in HEAD text" if EXPERT
951eedeb Nicholas Piggin 2017-05-29  456  	depends on PPC64
951eedeb Nicholas Piggin 2017-05-29  457  	default n
951eedeb Nicholas Piggin 2017-05-29  458  	help
951eedeb Nicholas Piggin 2017-05-29  459  	  Very large kernels can cause linker branch stubs to be generated by
951eedeb Nicholas Piggin 2017-05-29  460  	  code in head_64.S, which moves the head text sections out of their
951eedeb Nicholas Piggin 2017-05-29  461  	  specified location. This option can work around the problem.
951eedeb Nicholas Piggin 2017-05-29  462  
951eedeb Nicholas Piggin 2017-05-29  463  	  If unsure, say "N".
951eedeb Nicholas Piggin 2017-05-29  464  
8c50b72a Torsten Duwe    2016-03-03  465  config MPROFILE_KERNEL
8c50b72a Torsten Duwe    2016-03-03  466  	depends on PPC64 && CPU_LITTLE_ENDIAN

4421b963 Nicholas Piggin 2018-05-17 @467 def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
8c50b72a Torsten Duwe 2016-03-03 @468

:::::: The code at line 468 was first introduced by commit
:::::: 8c50b72a3b4f1f7cdfdfebd233b1cbd121262e65 powerpc/ftrace: Add Kconfig & Make glue for mprofile-kernel

:::::: TO: Torsten Duwe <[email protected]>
:::::: CC: Michael Ellerman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author reviewer
#8 lore raw

Re: [PATCH v4 4/4] powerpc/kbuild: move -mprofile-kernel check to Kconfig

In reply to Nicholas Piggin
Quoted 6 lines · On Thu, 17 May 2018 00:14:58 +1000 Nicholas Piggin <[email protected]> wrote:

This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig.

[ Note: this depends on https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v3 ]

Here is an incremental patch that brings this up to v4.

https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v4

---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
index c7cc482cb660..60b83398b498 100644
@@ -462,7 +462,7 @@ config LD_HEAD_STUB_CATCH
 
 config MPROFILE_KERNEL
 	depends on PPC64 && CPU_LITTLE_ENDIAN
-	def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
+	def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
 
 config IOMMU_HELPER
 	def_bool PPC64
Signature · 1 line
2.17.0
#9 lore raw

Re: [PATCH v4 4/4] powerpc/kbuild: move -mprofile-kernel check to Kconfig

In reply to Nicholas Piggin

2018-05-16 23:14 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 30 lines

This eliminates the workaround that requires disabling -mprofile-kernel by default in Kconfig.

[ Note: this depends on https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig-shell-v3 ]

---
Since v3:
- Moved a stray hunk back to patch 3 where it belongs.

 arch/powerpc/Kconfig  | 16 +---------------
 arch/powerpc/Makefile | 14 ++------------
 2 files changed, 3 insertions(+), 27 deletions(-)
arch/powerpc/Kconfig +0 -8
index 512fcc177c87..af527f894f9b 100644
@@ -460,23 +460,9 @@ config LD_HEAD_STUB_CATCH
 
          If unsure, say "N".
 
-config DISABLE_MPROFILE_KERNEL
-       bool "Disable use of mprofile-kernel for kernel tracing"
-       depends on PPC64 && CPU_LITTLE_ENDIAN
-       default y
-       help
-         Selecting this options disables use of the mprofile-kernel ABI for
-         kernel tracing. That will cause options such as live patching
-         (CONFIG_LIVEPATCH) which depend on CONFIG_DYNAMIC_FTRACE_WITH_REGS to

arch/powerpc/Kconfig config LD_HEAD_STUB_CATCH · line 465

Quoted 10 lines
arch/powerpc/Kconfig +1 -7
-         be disabled also.
-
-         If you have a toolchain which supports mprofile-kernel, then you can
-         disable this. Otherwise leave it enabled. If you're not sure, say
-         "Y".
-
 config MPROFILE_KERNEL
        depends on PPC64 && CPU_LITTLE_ENDIAN
-       def_bool !DISABLE_MPROFILE_KERNEL
+       def_bool $(success $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)

Your fix-up patch is good,
but could you check my comments below please?

arch/powerpc/Makefile CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 · line 164

Quoted 11 lines
arch/powerpc/Kconfig +0 -0
 config IOMMU_HELPER
        def_bool PPC64
arch/powerpc/Makefile +0 -1
index 6faf1d6ad9dd..8f7a64fe7370 100644
@@ -161,18 +161,8 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
 endif
 
 ifdef CONFIG_MPROFILE_KERNEL
-    ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK)

You do not need to compare the returned string with "OK" any more.

Please remove the
echo "OK"
line from the shell script.

arch/powerpc/Makefile CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 · line 165

Quoted 13 lines
arch/powerpc/Makefile +2 -11
-        CC_FLAGS_FTRACE := -pg -mprofile-kernel
-        KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
-    else
-        # If the user asked for mprofile-kernel but the toolchain doesn't
-        # support it, emit a warning and deliberately break the build later
-        # with mprofile-kernel-not-supported. We would prefer to make this an
-        # error right here, but then the user would never be able to run
-        # oldconfig to change their configuration.
-        $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL)
-        CC_FLAGS_FTRACE := -mprofile-kernel-not-supported
-    endif
+       CC_FLAGS_FTRACE := -pg -mprofile-kernel
+       KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL

Now, CONFIG_MPROFILE_KERNEL is equivalent to CC_USING_MPROFILE_KERNEL.

If you replace #ifdef CC_USING_MPROFILE_KERNEL with #ifdef CONFIG_MPROFILE_KERNEL,
you can remove CC_USING_MRPROFILE_KERNEL entirely, right?

Quoted 10 lines
arch/powerpc/Makefile +0 -1
 endif
 
 CFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
--

2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada