Skip to content

Commit 8b97519

Browse files
carstenhaitzleracmel
authored andcommitted
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 <[email protected]> Signed-off-by: Carsten Haitzler <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 34bec35 commit 8b97519

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

tools/perf/tests/shell/coresight/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ include ../../../../../tools/scripts/Makefile.include
44
include ../../../../../tools/scripts/Makefile.arch
55
include ../../../../../tools/scripts/utilities.mak
66

7-
SUBDIRS =
7+
SUBDIRS = \
8+
asm_pure_loop
89

910
all: $(SUBDIRS)
1011
$(SUBDIRS):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
asm_pure_loop
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
# Carsten Haitzler <[email protected]>, 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
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* Tamas Zsoldos <[email protected]>, 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

0 commit comments

Comments
 (0)