Skip to contentSkip to conversation

some tests and plugin tweaks for SVE

PATCH In review Alex Bennée 2 participants 4 messages Mar 28, 2022 – Apr 3, 2022

lore
Share & tools
lore
#0 lore raw

cover some tests and plugin tweaks for SVE

This is a quick pair of patches to help test fixes to the instrumentation of SVE binaries and their interaction with TCG plugins. It certainly shows the instrumentation isn't currently working. Userspace code can trace the sha512-vector builds.

Alex Bennée (2):
tests/tcg: add memory-sve test for aarch64
plugins: extend execlog to filter matches

 docs/devel/tcg-plugins.rst                |  9 ++-
 contrib/plugins/execlog.c                 | 96 +++++++++++++++++++----
 tests/tcg/aarch64/Makefile.softmmu-target |  7 ++
 tests/tcg/aarch64/system/boot.S           |  3 +-
 4 files changed, 99 insertions(+), 16 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 tests/tcg: add memory-sve test for aarch64

This will be helpful in debugging problems with tracking SVE memory accesses via the TCG plugins system.

Cc Robert Henry <[email protected]>
Cc Aaron Lindsay <[email protected]>
---
 tests/tcg/aarch64/Makefile.softmmu-target | 7 +++++++
 tests/tcg/aarch64/system/boot.S           | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/tcg/aarch64/Makefile.softmmu-target +7 -0
index a7286ac295..cc02814065 100644
@@ -31,6 +31,13 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
 
 memory: CFLAGS+=-DCHECK_UNALIGNED=1
 
+memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
+
+memory-sve: CFLAGS+=-DCHECK_UNALIGNED=1 -march=armv8.1-a+sve -O3 -fno-tree-loop-distribute-patterns
+
+TESTS+=memory-sve
+
 # Running
 QEMU_BASE_MACHINE=-M virt -cpu max -display none
 QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
tests/tcg/aarch64/system/boot.S +2 -1
index e190b1efa6..f136363d2a 100644
@@ -179,12 +179,13 @@ __start:
 	isb
 
 	/*
-	 * Enable FP registers. The standard C pre-amble will be
+	 * Enable FP/SVE registers. The standard C pre-amble will be
 	 * saving these and A-profile compilers will use AdvSIMD
 	 * registers unless we tell it not to.
 	*/
 	mrs	x0, cpacr_el1
 	orr	x0, x0, #(3 << 20)
+	orr	x0, x0, #(3 << 16)
 	msr	cpacr_el1, x0
 
 	/* Setup some stack space and enter the test code.
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 plugins: extend execlog to filter matches

In reply to Alex Bennée

Sometimes the whole execlog is just two much so add the ability to filter by instruction opcode or address.

[AJB: this shows for example

.qemu-system-aarch64 -display none -serial mon:stdio \
-M virt -cpu max \
-semihosting-config enable=on \
-kernel ./tests/tcg/aarch64-softmmu/memory-sve \
-plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin -D plugin.out

the st1w SVE instruction is not instrumenting its stores.]

Cc Robert Henry <[email protected]>
Cc Aaron Lindsay <[email protected]>
---
 docs/devel/tcg-plugins.rst |  9 +++-
 contrib/plugins/execlog.c  | 96 ++++++++++++++++++++++++++++++++------
 2 files changed, 90 insertions(+), 15 deletions(-)
docs/devel/tcg-plugins.rst +8 -1
index a7cc44aa20..a503d44cee 100644
@@ -346,7 +346,7 @@ The execlog tool traces executed instructions with memory access. It can be used
 for debugging and security analysis purposes.
 Please be aware that this will generate a lot of output.
 
-The plugin takes no argument::
+The plugin needs default argument::
 
   qemu-system-arm $(QEMU_ARGS) \
     -plugin ./contrib/plugins/libexeclog.so -d plugin
@@ -364,6 +364,13 @@ which will output an execution trace following this structure::
   0, 0xd34, 0xf9c8f000, "bl #0x10c8"
   0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM
 
+the output can be filtered to only track certain instructions or
+addresses using the `ifilter` or `afilter` options. You can stack the
+arguments if required::
+
+  qemu-system-arm $(QEMU_ARGS) \
+    -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin
+
 - contrib/plugins/cache.c
 
 Cache modelling plugin that measures the performance of a given L1 cache
contrib/plugins/execlog.c +82 -14

132 lines not on this page · raw message

Signature · 1 line
2.30.2
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH v1 2/2] plugins: extend execlog to filter matches

Quoted 11 lines · Alex Bennée

Sometimes the whole execlog is just two much so add the ability to filter by instruction opcode or address.

[AJB: this shows for example

  .qemu-system-aarch64 -display none -serial mon:stdio \
    -M virt -cpu max \
    -semihosting-config enable=on \
    -kernel ./tests/tcg/aarch64-softmmu/memory-sve \
    -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin -D plugin.out
Quoted 5 lines

the st1w SVE instruction is not instrumenting its stores.]

Cc Robert Henry <[email protected]>
Cc Aaron Lindsay <[email protected]>

Thanks!

Signature · 1 line
Alexandre