Hi Mike,
On 09/19/2017 06:06 PM, Mike Leach wrote:
Hi Sebastian,
I agree that this is either a decoder or inject issue.
First, can you confirm you are using version 0.7.3 of the decoder - I recently fixed an addressing bug in there.
I have updated my decoder as of this morning master branch of OpenCSD git: commit 5eb5e0e850339fe42a230c9d5ff93cd37cf9ae36 Author: Mike Leach mike.leach@linaro.org Date: Fri Sep 8 14:03:16 2017 +0100
I have applied the attached patch to remove two compile warnings.
Otherwise there are a couple of possibilities.... A) an as yet undiscovered decoder bug. B) gaps in the trace that are not being communicated correctly making inject assume continuous trace when it is not. C) some other misunderstanding/misinterpretation between decoder and perf inject.
Whichever it is I need to look at the raw trace data alongside the inject output at one of the A/B points and follow the packet => decode => inject flow to see why we get a bad address value.
Can you send me the capture you are using to create the examples you quote above - plus instructions on how to reproduce the output you were getting. I'll then up the logging on the decoder and walk through the trace decode path.
Here are the steps that I followed on a Juno-r0 machine:
$ gcc -O3 -g3 sort.c -o sort_3k-base -DARRAY_LEN=3000 $ cat sort.c #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #ifndef ARRAY_LEN #define ARRAY_LEN 30000 #endif
static struct timeval tm1;
static inline void start() { gettimeofday(&tm1, NULL); }
static inline void stop() { struct timeval tm2; gettimeofday(&tm2, NULL); unsigned long long t = 1000 * (tm2.tv_sec - tm1.tv_sec) +\ (tm2.tv_usec - tm1.tv_usec) / 1000; printf("%llu ms\n", t); }
void bubble_sort (int *a, int n) { int i, t, s = 1; while (s) { s = 0; for (i = 1; i < n; i++) { if (a[i] < a[i - 1]) { t = a[i]; a[i] = a[i - 1]; a[i - 1] = t; s = 1; } } } }
void sort_array() { printf("Bubble sorting array of %d elements\n", ARRAY_LEN); int data[ARRAY_LEN], i; for(i=0; i<ARRAY_LEN; ++i){ data[i] = rand(); } bubble_sort(data, ARRAY_LEN); }
int main(){ start(); sort_array(); stop(); return 0; }
$ export LD_LIBRARY_PATH=.../decoder/tests/bin/linux-arm64/rel $ perf record -e cs_etm/@20070000.etr/u --per-thread ./sort_3k-base $ perf inject -f -i perf.data -o inj --itrace=i100usl --strip $ tools/perf/perf report -D -i inj &> dump
The dump still shows the wrong jumps with the new decoder: $ grep '00000000004008c4 -> 00000000004008b4' dump | wc -l 603 $ grep '00000000004008b0 -> 00000000004008a8' dump | wc -l 723
The trace of the new decoder is longer than the trace I got yesterday with the old decoder.
Sebastian