powerpc/64: BE option to use ELFv2 ABI for big endian kernels
Subsystems (3)
Nicholas Piggin
reviewerPATCH v2 1/1 powerpc/64: BE option to use ELFv2 ABI for big endian kernels
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
---
Since v1:
- Improved the override flavour name suggested by Segher.
- Improved changelog wording.
arch/powerpc/Kconfig | 19 +++++++++++++++++++ arch/powerpc/Makefile | 15 ++++++++++----- arch/powerpc/boot/Makefile | 4 ++++ drivers/crypto/vmx/Makefile | 8 ++++++-- drivers/crypto/vmx/ppc-xlate.pl | 10 ++++++---- 5 files changed, 45 insertions(+), 11 deletions(-)
arch/powerpc/Kconfig +19 -0
@@ -147,6 +147,7 @@ config PPC select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_TABLE_SORT + select BUILD_ELF_V2 if PPC64 && CPU_LITTLE_ENDIAN select CLONE_BACKWARDS select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN select DYNAMIC_FTRACE if FUNCTION_TRACER
@@ -541,6 +542,24 @@ config KEXEC_FILE config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE +config BUILD_ELF_V2 + bool + +config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n + select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs. + + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer. + config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE))
arch/powerpc/Makefile +10 -5
@@ -92,10 +92,14 @@ endif ifdef CONFIG_PPC64 ifndef CONFIG_CC_IS_CLANG -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) -aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 +ifdef CONFIG_BUILD_ELF_V2 +cflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) +aflags-y += $(call cc-option,-mabi=elfv2) +else +cflags-y += $(call cc-option,-mabi=elfv1) +cflags-y += $(call cc-option,-mcall-aixdesc) +aflags-y += $(call cc-option,-mabi=elfv1) +endif endif endif
@@ -144,7 +148,7 @@ endif CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) ifndef CONFIG_CC_IS_CLANG -ifdef CONFIG_CPU_LITTLE_ENDIAN +ifdef CONFIG_BUILD_ELF_V2 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) else
@@ -153,6 +157,7 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) endif endif + CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
arch/powerpc/boot/Makefile +4 -0
@@ -41,6 +41,10 @@ endif BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) +ifdef CONFIG_BUILD_ELF_V2 +BOOTCFLAGS += $(call cc-option,-mabi=elfv2) +endif + ifdef CONFIG_CPU_BIG_ENDIAN BOOTCFLAGS += -mbig-endian else
drivers/crypto/vmx/Makefile +6 -2
@@ -5,18 +5,22 @@ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) override flavour := linux-ppc64le else +ifdef CONFIG_BUILD_ELF_V2 +override flavour := linux-ppc64-elfv2 +else override flavour := linux-ppc64 endif +endif quiet_cmd_perl = PERL $@ cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S -$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl FORCE +$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) -$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl FORCE +$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) clean-files := aesp8-ppc.S ghashp8-ppc.S
drivers/crypto/vmx/ppc-xlate.pl +6 -4
@@ -9,6 +9,8 @@ open STDOUT,">$output" || die "can't open $output: $!"; my %GLOBALS; my $dotinlocallabels=($flavour=~/linux/)?1:0; +my $abielfv2=(($flavour =~ /linux-ppc64le/) or ($flavour =~ /linux-ppc64-elfv2/))?1:0; +my $dotfunctions=($abielfv2=~1)?0:1; ################################################################ # directives which need special treatment on different platforms
@@ -40,7 +42,7 @@ my $globl = sub { }; my $text = sub { my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text"; - $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/); + $ret = ".abiversion 2\n".$ret if ($abielfv2); $ret; }; my $machine = sub {
@@ -56,8 +58,8 @@ my $size = sub { if ($flavour =~ /linux/) { shift; my $name = shift; $name =~ s|^[\.\_]||; - my $ret = ".size $name,.-".($flavour=~/64$/?".":"").$name; - $ret .= "\n.size .$name,.-.$name" if ($flavour=~/64$/); + my $ret = ".size $name,.-".($dotfunctions?".":"").$name; + $ret .= "\n.size .$name,.-.$name" if ($dotfunctions); $ret; } else
@@ -142,7 +144,7 @@ my $vmr = sub { # Some ABIs specify vrsave, special-purpose register #256, as reserved # for system use. -my $no_vrsave = ($flavour =~ /linux-ppc64le/); +my $no_vrsave = ($abielfv2); my $mtspr = sub { my ($f,$idx,$ra) = @_; if ($idx == 256 && $no_vrsave) {
Signature · 1 line
2.23.0
Hi!
Quoted 4 lines · Nicholas Piggin
arch/powerpc/Kconfig +4
-0+config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n
arch/powerpc/Kconfig config KEXEC_FILE · line 561
Quoted 10 lines
arch/powerpc/Kconfig +10
-0+ select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs. + + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer.
Is it clear that this is only for 64-bit? Maybe this text should fit that in somewhere?
It's not obvious to people who do not already know that ELFv2 is just the (nick-)name of a particular ABI, not a new kind of ELF (it is just version 1 ELF in fact), and that ABI is for 64-bit Power only.
Segher
Nicholas Piggin
reviewerExcerpts from Segher Boessenkool's message of April 29, 2020 9:40 am:
Quoted 12 lines
Hi!
Quoted 9 lines · Nicholas Piggin
arch/powerpc/Kconfig +9
-0+config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n + select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs.
Quoted 8 lines
arch/powerpc/Kconfig config KEXEC_FILE · line 561
Quoted 5 lines
arch/powerpc/Kconfig +5
-0+ + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer.Is it clear that this is only for 64-bit? Maybe this text should fit that in somewhere?
Don't know if it's necessary, the option only appears when 64-bit is selected.
Quoted 3 lines
It's not obvious to people who do not already know that ELFv2 is just the (nick-)name of a particular ABI, not a new kind of ELF (it is just version 1 ELF in fact), and that ABI is for 64-bit Power only.
I blame toolchain for -mabi=elfv2 ! And also some blame on ABI document which is called ELF V2 ABI rather than ELF ABI V2 which would have been unambiguous.
Kernel mostly gets it right (in the code I didn't write), and uses these
#if defined(_CALL_ELF) && _CALL_ELF == 2
#define PPC64_ELF_ABI_v2
#else
#define PPC64_ELF_ABI_v1
#endif
I can go through and change all my stuff and config options to ELF_ABI_v2.
Thanks,
Nick
Quoted 5 lines · Nicholas Piggin
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
Thanks
Michal
arch/powerpc/Kconfig +1 -1
@@ -495,7 +495,7 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". config MPROFILE_KERNEL - depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER + depends on PPC64 && BUILD_ELF_V2 && FUNCTION_TRACER def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__) config HOTPLUG_CPU
Quoted 182 lines
Reviewed-by Segher Boessenkool <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>---
Since v1:
- Improved the override flavour name suggested by Segher.
- Improved changelog wording.arch/powerpc/Kconfig | 19 +++++++++++++++++++ arch/powerpc/Makefile | 15 ++++++++++----- arch/powerpc/boot/Makefile | 4 ++++ drivers/crypto/vmx/Makefile | 8 ++++++-- drivers/crypto/vmx/ppc-xlate.pl | 10 ++++++---- 5 files changed, 45 insertions(+), 11 deletions(-)arch/powerpc/Kconfig +19
-0@@ -147,6 +147,7 @@ config PPC select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_TABLE_SORT + select BUILD_ELF_V2 if PPC64 && CPU_LITTLE_ENDIAN select CLONE_BACKWARDS select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN select DYNAMIC_FTRACE if FUNCTION_TRACER@@ -541,6 +542,24 @@ config KEXEC_FILE config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE +config BUILD_ELF_V2 + bool + +config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n + select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs. + + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer. + config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE))arch/powerpc/Makefile +10
-5@@ -92,10 +92,14 @@ endif ifdef CONFIG_PPC64 ifndef CONFIG_CC_IS_CLANG -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) -aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 +ifdef CONFIG_BUILD_ELF_V2 +cflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) +aflags-y += $(call cc-option,-mabi=elfv2) +else +cflags-y += $(call cc-option,-mabi=elfv1) +cflags-y += $(call cc-option,-mcall-aixdesc) +aflags-y += $(call cc-option,-mabi=elfv1) +endif endif endif@@ -144,7 +148,7 @@ endif CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) ifndef CONFIG_CC_IS_CLANG -ifdef CONFIG_CPU_LITTLE_ENDIAN +ifdef CONFIG_BUILD_ELF_V2 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) else@@ -153,6 +157,7 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) endif endif + CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)arch/powerpc/boot/Makefile +4
-0@@ -41,6 +41,10 @@ endif BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) +ifdef CONFIG_BUILD_ELF_V2 +BOOTCFLAGS += $(call cc-option,-mabi=elfv2) +endif + ifdef CONFIG_CPU_BIG_ENDIAN BOOTCFLAGS += -mbig-endian elsedrivers/crypto/vmx/Makefile +6
-2@@ -5,18 +5,22 @@ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) override flavour := linux-ppc64le else +ifdef CONFIG_BUILD_ELF_V2 +override flavour := linux-ppc64-elfv2 +else override flavour := linux-ppc64 endif +endif quiet_cmd_perl = PERL $@ cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S -$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl FORCE +$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) -$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl FORCE +$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) clean-files := aesp8-ppc.S ghashp8-ppc.Sdrivers/crypto/vmx/ppc-xlate.pl +6
-4@@ -9,6 +9,8 @@ open STDOUT,">$output" || die "can't open $output: $!"; my %GLOBALS; my $dotinlocallabels=($flavour=~/linux/)?1:0; +my $abielfv2=(($flavour =~ /linux-ppc64le/) or ($flavour =~ /linux-ppc64-elfv2/))?1:0; +my $dotfunctions=($abielfv2=~1)?0:1; ################################################################ # directives which need special treatment on different platforms@@ -40,7 +42,7 @@ my $globl = sub { }; my $text = sub { my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text"; - $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/); + $ret = ".abiversion 2\n".$ret if ($abielfv2); $ret; }; my $machine = sub {@@ -56,8 +58,8 @@ my $size = sub { if ($flavour =~ /linux/) { shift; my $name = shift; $name =~ s|^[\.\_]||; - my $ret = ".size $name,.-".($flavour=~/64$/?".":"").$name; - $ret .= "\n.size .$name,.-.$name" if ($flavour=~/64$/); + my $ret = ".size $name,.-".($dotfunctions?".":"").$name; + $ret .= "\n.size .$name,.-.$name" if ($dotfunctions); $ret; } else@@ -142,7 +144,7 @@ my $vmr = sub { # Some ABIs specify vrsave, special-purpose register #256, as reserved # for system use. -my $no_vrsave = ($flavour =~ /linux-ppc64le/); +my $no_vrsave = ($abielfv2); my $mtspr = sub { my ($f,$idx,$ra) = @_; if ($idx == 256 && $no_vrsave) {Signature · 1 line
2.23.0
Quoted 4 lines · Nicholas Piggin
Excerpts from Segher Boessenkool's message of April 29, 2020 9:40 am:
I blame toolchain for -mabi=elfv2 ! And also some blame on ABI document which is called ELF V2 ABI rather than ELF ABI V2 which would have been unambiguous.
At least ELFv2 ABI is correct. "ELF ABI v2" is not.
Quoted 1 line
I can go through and change all my stuff and config options to
ELF_ABI_v2.
Please don't. It is wrong. Both the original PowerPC ELF ABI and the ELFv2 one have versions themselves. Also, the base ELF standard has a version, and is set up so there can be incompatible versions even! Of course it still is version 1 to this day, but :-)
Segher
Nicholas Piggin
reviewerExcerpts from Segher Boessenkool's message of May 3, 2021 3:55 am:
Quoted 11 lines · Nicholas Piggin
Quoted 4 lines
Excerpts from Segher Boessenkool's message of April 29, 2020 9:40 am:
I blame toolchain for -mabi=elfv2 ! And also some blame on ABI document which is called ELF V2 ABI rather than ELF ABI V2 which would have been unambiguous.At least ELFv2 ABI is correct. "ELF ABI v2" is not.
Quoted 1 line
I can go through and change all my stuff and config options to
ELF_ABI_v2.Please don't. It is wrong.
Then I'm not sure what the point of your previous mail was, what did I miss?
Quoted 4 lines
Both the original PowerPC ELF ABI and the
ELFv2 one have versions themselves. Also, the base ELF standard has a version, and is set up so there can be incompatible versions even! Of course it still is version 1 to this day, but :-)
The point was for people who don't know ELFv2 has a specific meaning for powerpc, then ELF ABIv2 is more explanatory about it being an abi change rather than base elf change, even if it's not the "correct" name.
If you don't want that then good, I also prefer to just use ELFv2. I think people who change this option can easily look up the name in toolchain and other docs.
Thanks,
Nick
Nicholas Piggin
reviewerExcerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 8 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on BUILD_ELF_V2?
Quoted 7 lines
Tested-by Michal Suchánek <[email protected]>Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the _mcount call so just running some ftrace and ftrace with call graph should test it reasonably well.
Quoted 10 lines
Thanks
Michal
arch/powerpc/Kconfig +0
-0
arch/powerpc/Kconfig config LD_HEAD_STUB_CATCH · line 499
Quoted 6 lines
arch/powerpc/Kconfig +1
-1@@ -495,7 +495,7 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". config MPROFILE_KERNEL - depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER + depends on PPC64 && BUILD_ELF_V2 && FUNCTION_TRACER def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
Good idea. I can't remember if I did a grep for LITTLE_ENDIAN to check for other such opportunities.
Thanks,
Nick
Quoted 185 lines
arch/powerpc/Kconfig +0
-0config HOTPLUG_CPUQuoted 182 lines
Reviewed-by Segher Boessenkool <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>---
Since v1:
- Improved the override flavour name suggested by Segher.
- Improved changelog wording.arch/powerpc/Kconfig | 19 +++++++++++++++++++ arch/powerpc/Makefile | 15 ++++++++++----- arch/powerpc/boot/Makefile | 4 ++++ drivers/crypto/vmx/Makefile | 8 ++++++-- drivers/crypto/vmx/ppc-xlate.pl | 10 ++++++---- 5 files changed, 45 insertions(+), 11 deletions(-)arch/powerpc/Kconfig +19
-0@@ -147,6 +147,7 @@ config PPC select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_TABLE_SORT + select BUILD_ELF_V2 if PPC64 && CPU_LITTLE_ENDIAN select CLONE_BACKWARDS select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN select DYNAMIC_FTRACE if FUNCTION_TRACER@@ -541,6 +542,24 @@ config KEXEC_FILE config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE +config BUILD_ELF_V2 + bool + +config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n + select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs. + + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer. + config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE))arch/powerpc/Makefile +10
-5@@ -92,10 +92,14 @@ endif ifdef CONFIG_PPC64 ifndef CONFIG_CC_IS_CLANG -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) -aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 +ifdef CONFIG_BUILD_ELF_V2 +cflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) +aflags-y += $(call cc-option,-mabi=elfv2) +else +cflags-y += $(call cc-option,-mabi=elfv1) +cflags-y += $(call cc-option,-mcall-aixdesc) +aflags-y += $(call cc-option,-mabi=elfv1) +endif endif endif@@ -144,7 +148,7 @@ endif CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) ifndef CONFIG_CC_IS_CLANG -ifdef CONFIG_CPU_LITTLE_ENDIAN +ifdef CONFIG_BUILD_ELF_V2 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) else@@ -153,6 +157,7 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) endif endif + CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)arch/powerpc/boot/Makefile +4
-0@@ -41,6 +41,10 @@ endif BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) +ifdef CONFIG_BUILD_ELF_V2 +BOOTCFLAGS += $(call cc-option,-mabi=elfv2) +endif + ifdef CONFIG_CPU_BIG_ENDIAN BOOTCFLAGS += -mbig-endian elsedrivers/crypto/vmx/Makefile +6
-2@@ -5,18 +5,22 @@ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) override flavour := linux-ppc64le else +ifdef CONFIG_BUILD_ELF_V2 +override flavour := linux-ppc64-elfv2 +else override flavour := linux-ppc64 endif +endif quiet_cmd_perl = PERL $@ cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S -$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl FORCE +$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) -$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl FORCE +$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) clean-files := aesp8-ppc.S ghashp8-ppc.Sdrivers/crypto/vmx/ppc-xlate.pl +6
-4@@ -9,6 +9,8 @@ open STDOUT,">$output" || die "can't open $output: $!"; my %GLOBALS; my $dotinlocallabels=($flavour=~/linux/)?1:0; +my $abielfv2=(($flavour =~ /linux-ppc64le/) or ($flavour =~ /linux-ppc64-elfv2/))?1:0; +my $dotfunctions=($abielfv2=~1)?0:1; ################################################################ # directives which need special treatment on different platforms@@ -40,7 +42,7 @@ my $globl = sub { }; my $text = sub { my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text"; - $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/); + $ret = ".abiversion 2\n".$ret if ($abielfv2); $ret; }; my $machine = sub {@@ -56,8 +58,8 @@ my $size = sub { if ($flavour =~ /linux/) { shift; my $name = shift; $name =~ s|^[\.\_]||; - my $ret = ".size $name,.-".($flavour=~/64$/?".":"").$name; - $ret .= "\n.size .$name,.-.$name" if ($flavour=~/64$/); + my $ret = ".size $name,.-".($dotfunctions?".":"").$name; + $ret .= "\n.size .$name,.-.$name" if ($dotfunctions); $ret; } else@@ -142,7 +144,7 @@ my $vmr = sub { # Some ABIs specify vrsave, special-purpose register #256, as reserved # for system use. -my $no_vrsave = ($flavour =~ /linux-ppc64le/); +my $no_vrsave = ($abielfv2); my $mtspr = sub { my ($f,$idx,$ra) = @_; if ($idx == 256 && $no_vrsave) {Signature · 1 line
2.23.0
Quoted 8 lines · Nicholas Piggin
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 7 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Quoted 4 lines
Quoted 1 line
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on
BUILD_ELF_V2?
Looks like symbols are prefixed with a dot in ABIv1 and BTFID tool is not aware of that. It can be disabled on ABIv1 easily.
Thanks
Michal
lib/Kconfig.debug +1 -0
@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convert
Quoted 220 lines
Quoted 8 lines
Tested-by Michal Suchánek <[email protected]>Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the
_mcountcall so just running some ftrace and ftrace with call graph should test it reasonably well.Quoted 10 lines
Thanks
Michal
arch/powerpc/Kconfig +0
-0arch/powerpc/Kconfig config LD_HEAD_STUB_CATCH · line 499
Quoted 6 lines
arch/powerpc/Kconfig +1
-1@@ -495,7 +495,7 @@ config LD_HEAD_STUB_CATCH If unsure, say "N". config MPROFILE_KERNEL - depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER + depends on PPC64 && BUILD_ELF_V2 && FUNCTION_TRACER def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)Good idea. I can't remember if I did a grep for
LITTLE_ENDIANto check for other such opportunities.Thanks,
NickQuoted 185 lines
arch/powerpc/Kconfig +0
-0config HOTPLUG_CPUQuoted 182 lines
Reviewed-by Segher Boessenkool <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>---
Since v1:
- Improved the override flavour name suggested by Segher.
- Improved changelog wording.arch/powerpc/Kconfig | 19 +++++++++++++++++++ arch/powerpc/Makefile | 15 ++++++++++----- arch/powerpc/boot/Makefile | 4 ++++ drivers/crypto/vmx/Makefile | 8 ++++++-- drivers/crypto/vmx/ppc-xlate.pl | 10 ++++++---- 5 files changed, 45 insertions(+), 11 deletions(-)arch/powerpc/Kconfig +19
-0@@ -147,6 +147,7 @@ config PPC select ARCH_WEAK_RELEASE_ACQUIRE select BINFMT_ELF select BUILDTIME_TABLE_SORT + select BUILD_ELF_V2 if PPC64 && CPU_LITTLE_ENDIAN select CLONE_BACKWARDS select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN select DYNAMIC_FTRACE if FUNCTION_TRACER@@ -541,6 +542,24 @@ config KEXEC_FILE config ARCH_HAS_KEXEC_PURGATORY def_bool KEXEC_FILE +config BUILD_ELF_V2 + bool + +config BUILD_BIG_ENDIAN_ELF_V2 + bool "Build big-endian kernel using ELFv2 ABI (EXPERIMENTAL)" + depends on PPC64 && CPU_BIG_ENDIAN && EXPERT + default n + select BUILD_ELF_V2 + help + This builds the kernel image using the ELFv2 ABI, which has a + reduced stack overhead and faster function calls. This does not + affect the userspace ABIs. + + ELFv2 is the standard ABI for little-endian, but for big-endian + this is an experimental option that is less tested (kernel and + toolchain). This requires gcc 4.9 or newer and binutils 2.24 or + newer. + config RELOCATABLE bool "Build a relocatable kernel" depends on PPC64 || (FLATMEM && (44x || FSL_BOOKE))arch/powerpc/Makefile +10
-5@@ -92,10 +92,14 @@ endif ifdef CONFIG_PPC64 ifndef CONFIG_CC_IS_CLANG -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) -aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) -aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 +ifdef CONFIG_BUILD_ELF_V2 +cflags-y += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) +aflags-y += $(call cc-option,-mabi=elfv2) +else +cflags-y += $(call cc-option,-mabi=elfv1) +cflags-y += $(call cc-option,-mcall-aixdesc) +aflags-y += $(call cc-option,-mabi=elfv1) +endif endif endif@@ -144,7 +148,7 @@ endif CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) ifndef CONFIG_CC_IS_CLANG -ifdef CONFIG_CPU_LITTLE_ENDIAN +ifdef CONFIG_BUILD_ELF_V2 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) else@@ -153,6 +157,7 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) endif endif + CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)arch/powerpc/boot/Makefile +4
-0@@ -41,6 +41,10 @@ endif BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) +ifdef CONFIG_BUILD_ELF_V2 +BOOTCFLAGS += $(call cc-option,-mabi=elfv2) +endif + ifdef CONFIG_CPU_BIG_ENDIAN BOOTCFLAGS += -mbig-endian elsedrivers/crypto/vmx/Makefile +6
-2@@ -5,18 +5,22 @@ vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) override flavour := linux-ppc64le else +ifdef CONFIG_BUILD_ELF_V2 +override flavour := linux-ppc64-elfv2 +else override flavour := linux-ppc64 endif +endif quiet_cmd_perl = PERL $@ cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S -$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl FORCE +$(obj)/aesp8-ppc.S: $(src)/aesp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) -$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl FORCE +$(obj)/ghashp8-ppc.S: $(src)/ghashp8-ppc.pl $(src)/ppc-xlate.pl FORCE $(call if_changed,perl) clean-files := aesp8-ppc.S ghashp8-ppc.Sdrivers/crypto/vmx/ppc-xlate.pl +6
-4@@ -9,6 +9,8 @@ open STDOUT,">$output" || die "can't open $output: $!"; my %GLOBALS; my $dotinlocallabels=($flavour=~/linux/)?1:0; +my $abielfv2=(($flavour =~ /linux-ppc64le/) or ($flavour =~ /linux-ppc64-elfv2/))?1:0; +my $dotfunctions=($abielfv2=~1)?0:1; ################################################################ # directives which need special treatment on different platforms@@ -40,7 +42,7 @@ my $globl = sub { }; my $text = sub { my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text"; - $ret = ".abiversion 2\n".$ret if ($flavour =~ /linux.*64le/); + $ret = ".abiversion 2\n".$ret if ($abielfv2); $ret; }; my $machine = sub {@@ -56,8 +58,8 @@ my $size = sub { if ($flavour =~ /linux/) { shift; my $name = shift; $name =~ s|^[\.\_]||; - my $ret = ".size $name,.-".($flavour=~/64$/?".":"").$name; - $ret .= "\n.size .$name,.-.$name" if ($flavour=~/64$/); + my $ret = ".size $name,.-".($dotfunctions?".":"").$name; + $ret .= "\n.size .$name,.-.$name" if ($dotfunctions); $ret; } else@@ -142,7 +144,7 @@ my $vmr = sub { # Some ABIs specify vrsave, special-purpose register #256, as reserved # for system use. -my $no_vrsave = ($flavour =~ /linux-ppc64le/); +my $no_vrsave = ($abielfv2); my $mtspr = sub { my ($f,$idx,$ra) = @_; if ($idx == 256 && $no_vrsave) {Signature · 1 line
2.23.0
Quoted 38 lines · Michal Suchánek
Quoted 8 lines · Nicholas Piggin
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 7 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Quoted 4 lines
Quoted 1 line
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on
BUILD_ELF_V2?Looks like symbols are prefixed with a dot in ABIv1 and BTFID tool is not aware of that. It can be disabled on ABIv1 easily.
Thanks
Michal
lib/Kconfig.debug +1
-0@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convertQuoted 5 lines
Quoted 5 lines
Tested-by Michal Suchánek <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the
_mcountcall so just running some ftrace and ftrace with call graph should test it reasonably well.
It does not crash and burn but there are some regressions from LE to BE on the ftrace kernel selftest:
ftraceBE.txt renamed from ftraceLE.txt +13 -12
@@ -7,8 +7,8 @@ [n] Change the ringbuffer size [PASS] [n] Snapshot and tracing setting [PASS] [n] trace_pipe and trace_marker [PASS] -[n] Test ftrace direct functions against tracers [UNRESOLVED] -[n] Test ftrace direct functions against kprobes [UNRESOLVED] +[n] Test ftrace direct functions against tracers [FAIL] +[n] Test ftrace direct functions against kprobes [FAIL] [n] Generic dynamic event - add/remove kprobe events [PASS] [n] Generic dynamic event - add/remove synthetic events [PASS] [n] Generic dynamic event - selective clear (compatibility) [PASS]
@@ -16,10 +16,10 @@ [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS] -[n] event tracing - enable/disable with subsystem level files [PASS] +[n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] -[n] Test trace_printk from module [UNRESOLVED] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] Test trace_printk from module [FAIL] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]
@@ -27,7 +27,7 @@ [n] ftrace - function pid notrace filters [PASS] [n] ftrace - function pid filters [PASS] [n] ftrace - stacktrace filter command [PASS] -[n] ftrace - function trace on module [UNRESOLVED] +[n] ftrace - function trace on module [FAIL] [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS]
@@ -44,10 +44,10 @@ [n] Kprobe event argument syntax [PASS] [n] Kprobe dynamic event with arguments [PASS] [n] Kprobes event arguments with types [PASS] -[n] Kprobe event user-memory access [UNSUPPORTED] +[n] Kprobe event user-memory access [FAIL] [n] Kprobe event auto/manual naming [PASS] [n] Kprobe dynamic event with function tracer [PASS] -[n] Kprobe dynamic event - probing module [UNRESOLVED] +[n] Kprobe dynamic event - probing module [FAIL] [n] Create/delete multiprobe on kprobe event [PASS] [n] Kprobe event parser error log check [PASS] [n] Kretprobe dynamic event with arguments [PASS]
@@ -57,11 +57,11 @@ [n] Kprobe events - probe points [PASS] [n] Kprobe dynamic event - adding and removing [PASS] [n] Uprobe event parser error log check [PASS] -[n] test for the preemptirqsoff tracer [UNSUPPORTED] -[n] Meta-selftest: Checkbashisms [UNRESOLVED] +[n] test for the preemptirqsoff tracer [FAIL] +[n] Meta-selftest: Checkbashisms [FAIL] [n] Test wakeup RT tracer [PASS] [n] Test wakeup tracer [PASS] -[n] event trigger - test inter-event histogram trigger expected fail actions [XFAIL] +[n] event trigger - test inter-event histogram trigger expected fail actions [FAIL] [n] event trigger - test field variable support [PASS] [n] event trigger - test inter-event combined histogram trigger [PASS] [n] event trigger - test multiple actions on hist trigger [PASS]
@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.mceByV': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]
I needed to add a test timeout to get this far because "event tracing - enable/disable with subsystem level files" gets stuck.
Thanks
Michal
Hi!
Quoted 7 lines · Nicholas Piggin
Excerpts from Segher Boessenkool's message of May 3, 2021 3:55 am:
Quoted 6 lines · Nicholas Piggin
Quoted 4 lines
Excerpts from Segher Boessenkool's message of April 29, 2020 9:40 am:
I blame toolchain for -mabi=elfv2 ! And also some blame on ABI document which is called ELF V2 ABI rather than ELF ABI V2 which would have been unambiguous.
Quoted 8 lines
Quoted 5 lines
At least ELFv2 ABI is correct. "ELF ABI v2" is not.
Quoted 1 line
I can go through and change all my stuff and config options to
ELF_ABI_v2.Please don't. It is wrong.
Then I'm not sure what the point of your previous mail was, what did I miss?
I asked if you could make it clearer to people who do not know what this is whether they want to use it. Or that was my intention, anyhow :-/
Quoted 7 lines
Quoted 4 lines
Both the original PowerPC ELF ABI and the
ELFv2 one have versions themselves. Also, the base ELF standard has a version, and is set up so there can be incompatible versions even! Of course it still is version 1 to this day, but :-)The point was for people who don't know ELFv2 has a specific meaning for powerpc,
It does not have *any* meaning outside of Power. But people who do not know what it is can assume the wrong things about it. It isn't a great name because of that :-(
(It's not as bad as the MIPS ABIs -- an older one is called "new" :-) )
Quoted 2 lines
then ELF ABIv2 is more explanatory about it being an abi change rather than base elf change, even if it's not the "correct" name.
I very much disagree. "ELF ABIv2" is completely meaningless.
Quoted 1 line
If you don't want that then good, I also prefer to just use ELFv2. I
Good :-)
Quoted 2 lines
think people who change this option can easily look up the name in toolchain and other docs.
Yeah. As long as the defaults are good, whoever blows themselves up has only themselves to blame :-P
Segher
Quoted 125 lines · Michal Suchánek
Quoted 38 lines · Michal Suchánek
Quoted 8 lines · Nicholas Piggin
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 7 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Quoted 4 lines
Quoted 1 line
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on
BUILD_ELF_V2?Looks like symbols are prefixed with a dot in ABIv1 and BTFID tool is not aware of that. It can be disabled on ABIv1 easily.
Thanks
Michal
lib/Kconfig.debug +1
-0@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convertQuoted 5 lines
Quoted 5 lines
Tested-by Michal Suchánek <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the
_mcountcall so just running some ftrace and ftrace with call graph should test it reasonably well.It does not crash and burn but there are some regressions from LE to BE on the ftrace kernel selftest:
ftraceBE.txt renamed from ftraceLE.txt +13
-12@@ -7,8 +7,8 @@ [n] Change the ringbuffer size [PASS] [n] Snapshot and tracing setting [PASS] [n] trace_pipe and trace_marker [PASS] -[n] Test ftrace direct functions against tracers [UNRESOLVED] -[n] Test ftrace direct functions against kprobes [UNRESOLVED] +[n] Test ftrace direct functions against tracers [FAIL] +[n] Test ftrace direct functions against kprobes [FAIL] [n] Generic dynamic event - add/remove kprobe events [PASS] [n] Generic dynamic event - add/remove synthetic events [PASS] [n] Generic dynamic event - selective clear (compatibility) [PASS]@@ -16,10 +16,10 @@ [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS] -[n] event tracing - enable/disable with subsystem level files [PASS] +[n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] -[n] Test trace_printk from module [UNRESOLVED] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] Test trace_printk from module [FAIL] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -27,7 +27,7 @@ [n] ftrace - function pid notrace filters [PASS] [n] ftrace - function pid filters [PASS] [n] ftrace - stacktrace filter command [PASS] -[n] ftrace - function trace on module [UNRESOLVED] +[n] ftrace - function trace on module [FAIL] [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS]@@ -44,10 +44,10 @@ [n] Kprobe event argument syntax [PASS] [n] Kprobe dynamic event with arguments [PASS] [n] Kprobes event arguments with types [PASS] -[n] Kprobe event user-memory access [UNSUPPORTED] +[n] Kprobe event user-memory access [FAIL] [n] Kprobe event auto/manual naming [PASS] [n] Kprobe dynamic event with function tracer [PASS] -[n] Kprobe dynamic event - probing module [UNRESOLVED] +[n] Kprobe dynamic event - probing module [FAIL] [n] Create/delete multiprobe on kprobe event [PASS] [n] Kprobe event parser error log check [PASS] [n] Kretprobe dynamic event with arguments [PASS]@@ -57,11 +57,11 @@ [n] Kprobe events - probe points [PASS] [n] Kprobe dynamic event - adding and removing [PASS] [n] Uprobe event parser error log check [PASS] -[n] test for the preemptirqsoff tracer [UNSUPPORTED] -[n] Meta-selftest: Checkbashisms [UNRESOLVED] +[n] test for the preemptirqsoff tracer [FAIL] +[n] Meta-selftest: Checkbashisms [FAIL] [n] Test wakeup RT tracer [PASS] [n] Test wakeup tracer [PASS] -[n] event trigger - test inter-event histogram trigger expected fail actions [XFAIL] +[n] event trigger - test inter-event histogram trigger expected fail actions [FAIL] [n] event trigger - test field variable support [PASS] [n] event trigger - test inter-event combined histogram trigger [PASS] [n] event trigger - test multiple actions on hist trigger [PASS]@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.mceByV': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]
Quoted 2 lines
I needed to add a test timeout to get this far because "event tracing - enable/disable with subsystem level files" gets stuck.
There is some regression from mprofile on BE ABIv2
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +2 -2
@@ -19,7 +19,7 @@ [n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] [n] Test trace_printk from module [FAIL] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]
@@ -31,7 +31,7 @@ [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS] -[n] ftrace - Max stack tracer [PASS] +[n] ftrace - Max stack tracer [FAIL] [n] ftrace - test for function traceon/off triggers [PASS] [n] ftrace - test tracing error log support [PASS] [n] Test creation and deletion of trace instances while setting an event [PASS]
but generally the ftrace on BE is broken overall. The test "event tracing - enable/disable with subsystem level files" gets stuck and has to be killed by timeout. Running the testsuite twice the test "Basic test for tracers" locks up the machine regardless of using mprofile. The ABIV1 is even much worse with the exception of "(instance) event tracing - enable/disable with subsystem level files" which regresses on BE ABIv2 in general.
ftraceBEv2.txt renamed from ftraceBEv1.txt +24 -23
80 lines not on this page · raw message
Thanks
Michal
Nicholas Piggin
reviewerExcerpts from Michal Suchánek's message of May 4, 2021 6:17 am:
Quoted 143 lines · Michal Suchánek
Quoted 125 lines · Michal Suchánek
Quoted 38 lines · Nicholas Piggin
Quoted 8 lines
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 7 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Quoted 4 lines
Quoted 1 line
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on
BUILD_ELF_V2?Looks like symbols are prefixed with a dot in ABIv1 and BTFID tool is not aware of that. It can be disabled on ABIv1 easily.
Thanks
Michal
lib/Kconfig.debug +1
-0@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convertQuoted 5 lines
Quoted 5 lines
Tested-by Michal Suchánek <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the
_mcountcall so just running some ftrace and ftrace with call graph should test it reasonably well.It does not crash and burn but there are some regressions from LE to BE on the ftrace kernel selftest:
ftraceBE.txt renamed from ftraceLE.txt +13
-12@@ -7,8 +7,8 @@ [n] Change the ringbuffer size [PASS] [n] Snapshot and tracing setting [PASS] [n] trace_pipe and trace_marker [PASS] -[n] Test ftrace direct functions against tracers [UNRESOLVED] -[n] Test ftrace direct functions against kprobes [UNRESOLVED] +[n] Test ftrace direct functions against tracers [FAIL] +[n] Test ftrace direct functions against kprobes [FAIL] [n] Generic dynamic event - add/remove kprobe events [PASS] [n] Generic dynamic event - add/remove synthetic events [PASS] [n] Generic dynamic event - selective clear (compatibility) [PASS]@@ -16,10 +16,10 @@ [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS] -[n] event tracing - enable/disable with subsystem level files [PASS] +[n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] -[n] Test trace_printk from module [UNRESOLVED] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] Test trace_printk from module [FAIL] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -27,7 +27,7 @@ [n] ftrace - function pid notrace filters [PASS] [n] ftrace - function pid filters [PASS] [n] ftrace - stacktrace filter command [PASS] -[n] ftrace - function trace on module [UNRESOLVED] +[n] ftrace - function trace on module [FAIL] [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS]@@ -44,10 +44,10 @@ [n] Kprobe event argument syntax [PASS] [n] Kprobe dynamic event with arguments [PASS] [n] Kprobes event arguments with types [PASS] -[n] Kprobe event user-memory access [UNSUPPORTED] +[n] Kprobe event user-memory access [FAIL] [n] Kprobe event auto/manual naming [PASS] [n] Kprobe dynamic event with function tracer [PASS] -[n] Kprobe dynamic event - probing module [UNRESOLVED] +[n] Kprobe dynamic event - probing module [FAIL] [n] Create/delete multiprobe on kprobe event [PASS] [n] Kprobe event parser error log check [PASS] [n] Kretprobe dynamic event with arguments [PASS]@@ -57,11 +57,11 @@ [n] Kprobe events - probe points [PASS] [n] Kprobe dynamic event - adding and removing [PASS] [n] Uprobe event parser error log check [PASS] -[n] test for the preemptirqsoff tracer [UNSUPPORTED] -[n] Meta-selftest: Checkbashisms [UNRESOLVED] +[n] test for the preemptirqsoff tracer [FAIL] +[n] Meta-selftest: Checkbashisms [FAIL] [n] Test wakeup RT tracer [PASS] [n] Test wakeup tracer [PASS] -[n] event trigger - test inter-event histogram trigger expected fail actions [XFAIL] +[n] event trigger - test inter-event histogram trigger expected fail actions [FAIL] [n] event trigger - test field variable support [PASS] [n] event trigger - test inter-event combined histogram trigger [PASS] [n] event trigger - test multiple actions on hist trigger [PASS]@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.mceByV': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]Quoted 2 lines
I needed to add a test timeout to get this far because "event tracing - enable/disable with subsystem level files" gets stuck.
There is some regression from mprofile on BE ABIv2
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-1@@ -19,7 +19,7 @@ [n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] [n] Test trace_printk from module [FAIL] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]
ftraceBE.mprofile.txt line 37
Quoted 8 lines
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-1@@ -31,7 +31,7 @@ [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS] -[n] ftrace - Max stack tracer [PASS] +[n] ftrace - Max stack tracer [FAIL] [n] ftrace - test for function traceon/off triggers [PASS] [n] ftrace - test tracing error log support [PASS] [n] Test creation and deletion of trace instances while setting an event [PASS]
Hmm, I don't see an obvious case where the stack layout is based on BE when it should be using ELF ABI version, or ftrace_64_mprofile.S depends on LE. +Naveen
Quoted 8 lines
but generally the ftrace on BE is broken overall. The test "event tracing - enable/disable with subsystem level files" gets stuck and has to be killed by timeout. Running the testsuite twice the test "Basic test for tracers" locks up the machine regardless of using mprofile. The ABIV1 is even much worse with the exception of "(instance) event tracing - enable/disable with subsystem level files" which regresses on BE ABIv2 in general.
Wow it has fixed quite a few! That event tracing one hardly looks like a difficult test, hopefully should be something trivial.
Thanks for testing.
Thanks,
Nick
Quoted 92 lines
ftraceBEv2.txt renamed from ftraceBEv1.txt +24
-23@@ -9,10 +9,10 @@ [n] trace_pipe and trace_marker [PASS] [n] Test ftrace direct functions against tracers [FAIL] [n] Test ftrace direct functions against kprobes [FAIL] -[n] Generic dynamic event - add/remove kprobe events [FAIL] +[n] Generic dynamic event - add/remove kprobe events [PASS] [n] Generic dynamic event - add/remove synthetic events [PASS] -[n] Generic dynamic event - selective clear (compatibility) [FAIL] -[n] Generic dynamic event - generic clear event [FAIL] +[n] Generic dynamic event - selective clear (compatibility) [PASS] +[n] Generic dynamic event - generic clear event [PASS] [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS]@@ -23,39 +23,39 @@ [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS] -[n] ftrace - function glob filters [FAIL] +[n] ftrace - function glob filters [PASS] [n] ftrace - function pid notrace filters [PASS] [n] ftrace - function pid filters [PASS] [n] ftrace - stacktrace filter command [PASS] [n] ftrace - function trace on module [FAIL] [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] -[n] ftrace - test reading of set_ftrace_filter [FAIL] +[n] ftrace - test reading of set_ftrace_filter [PASS] [n] ftrace - Max stack tracer [PASS] [n] ftrace - test for function traceon/off triggers [PASS] [n] ftrace - test tracing error log support [PASS] [n] Test creation and deletion of trace instances while setting an event [PASS] [n] Test creation and deletion of trace instances [PASS] -[n] Kprobe dynamic event - adding and removing [FAIL] -[n] Kprobe dynamic event - busy event check [FAIL] -[n] Kprobe dynamic event with arguments [FAIL] -[n] Kprobe event with comm arguments [FAIL] -[n] Kprobe event string type argument [FAIL] -[n] Kprobe event symbol argument [FAIL] -[n] Kprobe event argument syntax [FAIL] -[n] Kprobes event arguments with types [FAIL] +[n] Kprobe dynamic event - adding and removing [PASS] +[n] Kprobe dynamic event - busy event check [PASS] +[n] Kprobe event with comm arguments [PASS] +[n] Kprobe event string type argument [PASS] +[n] Kprobe event symbol argument [PASS] +[n] Kprobe event argument syntax [PASS] +[n] Kprobe dynamic event with arguments [PASS] +[n] Kprobes event arguments with types [PASS] [n] Kprobe event user-memory access [FAIL] [n] Kprobe event auto/manual naming [PASS] -[n] Kprobe dynamic event with function tracer [FAIL] +[n] Kprobe dynamic event with function tracer [PASS] [n] Kprobe dynamic event - probing module [FAIL] -[n] Create/delete multiprobe on kprobe event [FAIL] -[n] Kprobe event parser error log check [FAIL] -[n] Kretprobe dynamic event with arguments [FAIL] -[n] Kretprobe dynamic event with maxactive [FAIL] -[n] Kretprobe %return suffix test [FAIL] -[n] Register/unregister many kprobe events [FAIL] -[n] Kprobe events - probe points [FAIL] -[n] Kprobe dynamic event - adding and removing [FAIL] +[n] Create/delete multiprobe on kprobe event [PASS] +[n] Kprobe event parser error log check [PASS] +[n] Kretprobe dynamic event with arguments [PASS] +[n] Kretprobe dynamic event with maxactive [PASS] +[n] Kretprobe %return suffix test [PASS] +[n] Register/unregister many kprobe events [PASS] +[n] Kprobe events - probe points [PASS] +[n] Kprobe dynamic event - adding and removing [PASS] [n] Uprobe event parser error log check [PASS] [n] test for the preemptirqsoff tracer [FAIL] [n] Meta-selftest: Checkbashisms [FAIL]@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.lxCI5k': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]Thanks
Michal
Michael Ellerman
reviewerQuoted 32 lines · Segher Boessenkool
Quoted 7 lines · Nicholas Piggin
Excerpts from Segher Boessenkool's message of May 3, 2021 3:55 am:
Quoted 6 lines · Nicholas Piggin
Quoted 4 lines
Excerpts from Segher Boessenkool's message of April 29, 2020 9:40 am:
I blame toolchain for -mabi=elfv2 ! And also some blame on ABI document which is called ELF V2 ABI rather than ELF ABI V2 which would have been unambiguous.Quoted 8 lines
Quoted 5 lines
At least ELFv2 ABI is correct. "ELF ABI v2" is not.
Quoted 1 line
I can go through and change all my stuff and config options to
ELF_ABI_v2.Please don't. It is wrong.
Then I'm not sure what the point of your previous mail was, what did I miss?
I asked if you could make it clearer to people who do not know what this is whether they want to use it. Or that was my intention, anyhow :-/
Quoted 7 lines
Quoted 4 lines
Both the original PowerPC ELF ABI and the
ELFv2 one have versions themselves. Also, the base ELF standard has a version, and is set up so there can be incompatible versions even! Of course it still is version 1 to this day, but :-)The point was for people who don't know ELFv2 has a specific meaning for powerpc,
It does not have *any* meaning outside of Power. But people who do not know what it is can assume the wrong things about it. It isn't a great name because of that :-(
Quoted 6 lines
(It's not as bad as the MIPS ABIs -- an older one is called "new" :-) )
Quoted 2 lines
then ELF ABIv2 is more explanatory about it being an abi change rather than base elf change, even if it's not the "correct" name.
I very much disagree. "ELF ABIv2" is completely meaningless.
Except:
$ readelf -h /bin/true
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: PowerPC64
Version: 0x1
Entry point address: 0x1990
Start of program headers: 64 (bytes into file)
Start of section headers: 66176 (bytes into file)
Flags: 0x2, abiv2
^^^^^:)
cheers
Quoted 18 lines · Nicholas Piggin
Excerpts from Michal Suchánek's message of May 4, 2021 6:17 am:
Quoted 17 lines · Michal Suchánek
Quoted 16 lines · Michal Suchánek
Quoted 15 lines · Nicholas Piggin
Quoted 11 lines
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 8 lines · Nicholas Piggin
Quoted 5 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Fixes BTFID failure on BE for me and the ELF ABIv2 kernel boots.
What's the BTFID failure? Anything we can do to fix it on the v1 ABI or at least make it depend on
BUILD_ELF_V2?Looks like symbols are prefixed with a dot in ABIv1 and BTFID tool is not aware of that. It can be disabled on ABIv1 easily.
Yes, I think BTF is generated by pahole, so we will need to add support for recognising dot symbols there.
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 22 lines
Thanks
Michal
lib/Kconfig.debug +1
-0@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convertQuoted 5 lines
Quoted 5 lines
Tested-by Michal Suchánek <[email protected]>Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofile code at a glance but don't have any idea how to test it.
AFAIK it's just a different ABI for the
_mcountcall so just running some ftrace and ftrace with call graph should test it reasonably well.It does not crash and burn but there are some regressions from LE to BE on the ftrace kernel selftest:
Quoted 10 lines
Quoted 10 lines
ftraceBE.txt line 11
Quoted 10 lines
ftraceBE.txt renamed from ftraceLE.txt +2
-2@@ -7,8 +7,8 @@ [n] Change the ringbuffer size [PASS] [n] Snapshot and tracing setting [PASS] [n] trace_pipe and trace_marker [PASS] -[n] Test ftrace direct functions against tracers [UNRESOLVED] -[n] Test ftrace direct functions against kprobes [UNRESOLVED] +[n] Test ftrace direct functions against tracers [FAIL] +[n] Test ftrace direct functions against kprobes [FAIL]
Strange to see those fail. I don't think my patch to enable ftrace direct functions is upstream yet ;)
Quoted 65 lines
Quoted 65 lines
Quoted 65 lines
ftraceBE.txt renamed from ftraceLE.txt +11
-10[n] Generic dynamic event - add/remove kprobe events [PASS] [n] Generic dynamic event - add/remove synthetic events [PASS] [n] Generic dynamic event - selective clear (compatibility) [PASS]@@ -16,10 +16,10 @@ [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS] -[n] event tracing - enable/disable with subsystem level files [PASS] +[n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] -[n] Test trace_printk from module [UNRESOLVED] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] Test trace_printk from module [FAIL] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -27,7 +27,7 @@ [n] ftrace - function pid notrace filters [PASS] [n] ftrace - function pid filters [PASS] [n] ftrace - stacktrace filter command [PASS] -[n] ftrace - function trace on module [UNRESOLVED] +[n] ftrace - function trace on module [FAIL] [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS]@@ -44,10 +44,10 @@ [n] Kprobe event argument syntax [PASS] [n] Kprobe dynamic event with arguments [PASS] [n] Kprobes event arguments with types [PASS] -[n] Kprobe event user-memory access [UNSUPPORTED] +[n] Kprobe event user-memory access [FAIL] [n] Kprobe event auto/manual naming [PASS] [n] Kprobe dynamic event with function tracer [PASS] -[n] Kprobe dynamic event - probing module [UNRESOLVED] +[n] Kprobe dynamic event - probing module [FAIL] [n] Create/delete multiprobe on kprobe event [PASS] [n] Kprobe event parser error log check [PASS] [n] Kretprobe dynamic event with arguments [PASS]@@ -57,11 +57,11 @@ [n] Kprobe events - probe points [PASS] [n] Kprobe dynamic event - adding and removing [PASS] [n] Uprobe event parser error log check [PASS] -[n] test for the preemptirqsoff tracer [UNSUPPORTED] -[n] Meta-selftest: Checkbashisms [UNRESOLVED] +[n] test for the preemptirqsoff tracer [FAIL] +[n] Meta-selftest: Checkbashisms [FAIL] [n] Test wakeup RT tracer [PASS] [n] Test wakeup tracer [PASS] -[n] event trigger - test inter-event histogram trigger expected fail actions [XFAIL] +[n] event trigger - test inter-event histogram trigger expected fail actions [FAIL] [n] event trigger - test field variable support [PASS] [n] event trigger - test inter-event combined histogram trigger [PASS] [n] event trigger - test multiple actions on hist trigger [PASS]@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.mceByV': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I needed to add a test timeout to get this far because "event tracing - enable/disable with subsystem level files" gets stuck.
Does that test pass on LE for you? In the past, I have seen some lockups but will have to go revisit the tests...
Quoted 19 lines
Quoted 19 lines
There is some regression from mprofile on BE ABIv2
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-2@@ -19,7 +19,7 @@ [n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] [n] Test trace_printk from module [FAIL] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -31,7 +31,7 @@ [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS] -[n] ftrace - Max stack tracer [PASS]
Quoted 8 lines
ftraceBE.mprofile.txt line 37
Quoted 4 lines
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-0+[n] ftrace - Max stack tracer [FAIL] [n] ftrace - test for function traceon/off triggers [PASS] [n] ftrace - test tracing error log support [PASS] [n] Test creation and deletion of trace instances while setting an event [PASS]Hmm, I don't see an obvious case where the stack layout is based on BE when it should be using ELF ABI version, or
ftrace_64_mprofile.Sdepends on LE. +Naveen
Yes, I don't think we ever enabled the stack tracer to work properly on LE and -mprofile-kernel. I will take a look tomorrow.
- Naveen
Quoted 14 lines · Naveen N. Rao
Quoted 13 lines · Nicholas Piggin
Excerpts from Michal Suchánek's message of May 4, 2021 6:17 am:
Quoted 12 lines · Michal Suchánek
Quoted 11 lines · Michal Suchánek
Quoted 9 lines · Nicholas Piggin
Quoted 8 lines
Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
Quoted 7 lines · Nicholas Piggin
Quoted 6 lines
Provide an option to use ELFv2 ABI for big endian builds. This works on GCC and clang (since 2014). It is less well tested and supported by the GNU toolchain, but it can give some useful advantages of the ELFv2 ABI for BE (e.g., less stack usage). Some distros even build BE ELFv2 userspace.
Quoted 1 line
Quoted 1 line
Fixes BTFID failure on BE for me and the ELF ABIv2
kernel boots.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
What's the BTFID failure? Anything we can do to fix it
on the v1 ABI or > > at least make it depend on
BUILD_ELF_V2?Quoted 1 line
Quoted 1 line
Looks like symbols are prefixed with a dot in ABIv1 and
BTFID tool is
Quoted 1 line
not aware of that. It can be disabled on ABIv1 easily.
Yes, I think BTF is generated by pahole, so we will need to add support for recognising dot symbols there.
There are symbols both with and without dot, and the dwarves development is headed towards using the ones without dot. Not sure it's the correct way to resolve it, though.
https://lore.kernel.org/lkml/[email protected]/
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 14 lines
lib/Kconfig.debug
Quoted 2 lines
lib/Kconfig.debug +0
-0index
678c13967580..e703c26e9b80100644lib/Kconfig.debug +1
-0@@ -305,6 +305,7 @@ config DEBUG_INFO_BTF bool "Generate BTF typeinfo" depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST + depends on !PPC64 || BUILD_ELF_V2 help Generate deduplicated BTF type information from DWARF debug info. Turning this on expects presence of pahole tool, which will convertQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tested-by: Michal Suchánek <[email protected]>
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Also can we enable mprofile on BE now?
I don't see anything endian-specific in the mprofilecode at a glance
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
but don't have any idea how to test it.
Quoted 1 line
AFAIK it's just a different ABI for the
_mcountcall sojust running
Quoted 1 line
Quoted 1 line
some ftrace and ftrace with call graph should test it reasonably well.
It does not crash and burn but there are some regressions from LE to BE on the ftrace kernel selftest:
ftraceBEv2.txt renamed from ftraceBEv1.txt +5
-4@@ -16,10 +16,10 @@ [n] event tracing - enable/disable with event level files [PASS] [n] event tracing - restricts events based on pid notrace filtering [PASS] [n] event tracing - restricts events based on pid [PASS] -[n] event tracing - enable/disable with subsystem level files [PASS] +[n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] -[n] Test trace_printk from module [UNRESOLVED] +[n] Test trace_printk from module [FAIL] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -96,7 +96,8 @@ [n] (instance) event tracing - enable/disable with event level files [PASS] [n] (instance) event tracing - restricts events based on pid notrace filtering [PASS] [n] (instance) event tracing - restricts events based on pid [PASS] -[n] (instance) event tracing - enable/disable with subsystem level files [PASS] +[n] (instance) event tracing - enable/disable with subsystem level files [FAIL] +rmdir: failed to remove '/sys/kernel/tracing/instances/ftracetest.mceByV': Device or resource busy [n] (instance) ftrace - test for function event triggers [PASS] [n] (instance) ftrace - function pid notrace filters [PASS] [n] (instance) ftrace - function pid filters [PASS]
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I needed to add a test timeout to get this far because "event tracing - enable/disable with subsystem level files" gets stuck.
Does that test pass on LE for you? In the past, I have seen some lockups but will have to go revisit the tests...
Yes, it's one of the actual regressions where the test is not marked as XFAIL, UNRESOLVED or UNSUPPORTED on LE.
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
There is some regression from mprofile on BE ABIv2
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-2@@ -19,7 +19,7 @@ [n] event tracing - enable/disable with subsystem level files [FAIL] [n] event tracing - enable/disable with top level files [PASS] [n] Test trace_printk from module [FAIL] -[n] ftrace - function graph filters with stack tracer [PASS] +[n] ftrace - function graph filters with stack tracer [FAIL] [n] ftrace - function graph filters [PASS] [n] ftrace - function trace with cpumask [PASS] [n] ftrace - test for function event triggers [PASS]@@ -31,7 +31,7 @@ [n] ftrace - function profiler with function tracing [PASS] [n] ftrace - function profiling [PASS] [n] ftrace - test reading of set_ftrace_filter [PASS] -[n] ftrace - Max stack tracer [PASS]Quoted 8 lines
ftraceBE.mprofile.txt line 37
Quoted 4 lines
ftraceBE.mprofile.txt renamed from ftraceBEv2.txt +1
-0+[n] ftrace - Max stack tracer [FAIL] [n] ftrace - test for function traceon/off triggers [PASS] [n] ftrace - test tracing error log support [PASS] [n] Test creation and deletion of trace instances while setting an event [PASS]Hmm, I don't see an obvious case where the stack layout is based on BE when it should be using ELF ABI version, or
ftrace_64_mprofile.Sdepends on LE. +Naveen
Quoted 2 lines
Yes, I don't think we ever enabled the stack tracer to work properly on LE and -mprofile-kernel. I will take a look tomorrow.
Right, "Max stack tracer" does not show as regression from LE to BE.
Thanks
Michal
Quoted 9 lines · Michael Ellerman
Quoted 5 lines · Segher Boessenkool
Quoted 2 lines · Nicholas Piggin
then ELF ABIv2 is more explanatory about it being an abi change rather than base elf change, even if it's not the "correct" name.
I very much disagree. "ELF ABIv2" is completely meaningless.
Except:
Quoted 16 lines
$ readelf -h /bin/true
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: PowerPC64
Version: 0x1
Entry point address: 0x1990
Start of program headers: 64 (bytes into file)
Start of section headers: 66176 (bytes into file)
Flags: 0x2, abiv2
^^^^^Ha :-)
This can also print "abiv1" or even "abiv0", btw:
case EM_PPC64:
if (e_flags & EF_PPC64_ABI)
{
char abi[] = ", abiv0";
abi[6] += e_flags & EF_PPC64_ABI;
strcat (buf, abi);
}
break;This is only in readelf, and the main audience for readelf is the people who know all details about what means what already. But, do you have a suggestion for better output here?
Segher