[PATCH v2] powerpc/64: BE option to use ELFv2 ABI for big endian kernels

Michal Suchánek msuchanek at suse.de
Tue May 4 06:17:52 AEST 2021


On Mon, May 03, 2021 at 11:34:25AM +0200, Michal Suchánek wrote:
> On Mon, May 03, 2021 at 09:11:16AM +0200, Michal Suchánek wrote:
> > On Mon, May 03, 2021 at 10:58:33AM +1000, Nicholas Piggin wrote:
> > > Excerpts from Michal Suchánek's message of May 3, 2021 2:57 am:
> > > > On Tue, Apr 28, 2020 at 09:25:17PM +1000, Nicholas Piggin wrote:
> > > >> 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.
> > 
> > Thanks
> > 
> > Michal
> > 
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index 678c13967580..e703c26e9b80 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -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
> > 
> > > 
> > > > 
> > > > Tested-by: Michal Suchánek <msuchanek at suse.de>
> > > > 
> > > > 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.
> 
> It does not crash and burn but there are some regressions from LE to BE
> on the ftrace kernel selftest:
> 
> --- ftraceLE.txt	2021-05-03 11:19:14.830000000 +0200
> +++ ftraceBE.txt	2021-05-03 11:27:24.770000000 +0200
> @@ -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.

There is some regression from mprofile on BE ABIv2

--- ftraceBEv2.txt	2021-05-03 18:11:01.100000000 +0200
+++ ftraceBE.mprofile.txt	2021-05-03 11:27:24.770000000 +0200
@@ -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.

--- ftraceBEv1.txt	2021-05-03 22:09:10.690000000 +0200
+++ ftraceBEv2.txt	2021-05-03 18:11:01.100000000 +0200
@@ -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


More information about the Linuxppc-dev mailing list