On Tue, May 23, 2017 at 1:44 AM, George Burgess gbiv@google.com wrote:
Right; sorry, I'm tired. :) I was a bit sneaky with the ARM patch, since I'm using Android+fastboot with this kernel, as I think you are.
In particular, I modified Li Pengcheng's sysconf patch to also flip the bits that the ARM patch does. It seems that this works just as well (and is convenient, since that patch already ioremaps the region that the arm-tf patch writes to). New hi6220-sysconfig.c patch is attached.
I tried applying this patch to 4.9, as well. I was able to get the device to boot and recognize its ETMs, but perf dies seemingly because `sink_ops(sink)->alloc_buffer == NULL` (coresight-etm-perf.c; line 241ish). Trying to apply a patch to make that work gave me a build error, which I didn't look too much into; I'm perfectly fine with my kernel not being near AOSP's HEAD for the moment. :)
If you'd like, I'm happy to gather the hacks I made to make 4.11 play nicely with AOSP and put them in patch form tomorrow. It was mainly just me adding bits and pieces to Makefiles and crossing my fingers.
Thanks George for the patch. I got the AOSP linux kernel 4.9 working with CoreSight with the attached patches. I can see the ETM components:
hikey:/ # ls /sys/bus/coresight/devices/ amba:replicator@0/ f6501000.funnel/ f659f000.etm/ f65df000.etm/ f6401000.funnel/ f659c000.etm/ f65dc000.etm/ f6402000.etf/ f659d000.etm/ f65dd000.etm/ f6404000.etr/ f659e000.etm/ f65de000.etm/
However perf does not collect traces yet: it fails with some malloc problem (maybe the same problem as what you reported above)
# perf record -e cs_etm/@f6404000.etr/u --per-thread failed to mmap with 12 (Cannot allocate memory)
I will try to run perf under gdb and see where and why this fails.
Sebastian