Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Add asm pureloop test tool

Add test tool to be driven by further test scripts. This tool is pure
arm64 ASM with no libc usage to ensure it is the same exact binary/code
every time so it can also be re-used for many uses. It just loops for a
given fixed number of loops.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org
Link: https://lore.kernel.org/r/20220909152803.2317006-4-carsten.haitzler@foss.arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Carsten Haitzler and committed by
Arnaldo Carvalho de Melo
8b975197 34bec35c

+65 -1
+2 -1
tools/perf/tests/shell/coresight/Makefile
··· 4 4 include ../../../../../tools/scripts/Makefile.arch 5 5 include ../../../../../tools/scripts/utilities.mak 6 6 7 - SUBDIRS = 7 + SUBDIRS = \ 8 + asm_pure_loop 8 9 9 10 all: $(SUBDIRS) 10 11 $(SUBDIRS):
+1
tools/perf/tests/shell/coresight/asm_pure_loop/.gitignore
··· 1 + asm_pure_loop
+34
tools/perf/tests/shell/coresight/asm_pure_loop/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Carsten Haitzler <carsten.haitzler@arm.com>, 2021 3 + 4 + include ../Makefile.miniconfig 5 + 6 + # Binary to produce 7 + BIN=asm_pure_loop 8 + # Any linking/libraries needed for the binary - empty if none needed 9 + LIB= 10 + 11 + all: $(BIN) 12 + 13 + $(BIN): $(BIN).S 14 + ifdef CORESIGHT 15 + ifeq ($(ARCH),arm64) 16 + # Build line - this is raw asm with no libc to have an always exact binary 17 + $(Q)$(CC) $(BIN).S -nostdlib -static -o $(BIN) $(LIB) 18 + endif 19 + endif 20 + 21 + install-tests: all 22 + ifdef CORESIGHT 23 + ifeq ($(ARCH),arm64) 24 + # Install the test tool in the right place 25 + $(call QUIET_INSTALL, tests) \ 26 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$(INSTDIR_SUB)/$(BIN)'; \ 27 + $(INSTALL) $(BIN) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$(INSTDIR_SUB)/$(BIN)/$(BIN)' 28 + endif 29 + endif 30 + 31 + clean: 32 + $(Q)$(RM) -f $(BIN) 33 + 34 + .PHONY: all clean install-tests
+28
tools/perf/tests/shell/coresight/asm_pure_loop/asm_pure_loop.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Tamas Zsoldos <tamas.zsoldos@arm.com>, 2021 */ 3 + 4 + .globl _start 5 + _start: 6 + mov x0, 0x0000ffff 7 + mov x1, xzr 8 + loop: 9 + nop 10 + nop 11 + cbnz x1, noskip 12 + nop 13 + nop 14 + adrp x2, skip 15 + add x2, x2, :lo12:skip 16 + br x2 17 + nop 18 + nop 19 + noskip: 20 + nop 21 + nop 22 + skip: 23 + sub x0, x0, 1 24 + cbnz x0, loop 25 + 26 + mov x0, #0 27 + mov x8, #93 // __NR_exit syscall 28 + svc #0