On 18 April 2017 at 14:12, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Hello Mathieu
BPF exists when I am building "perf" but I am getting an error indicating "BPF support is not compiled" When I am running it on the target. Am I missing a package?
When building "perf": .. bpf: [ on ]
When running "perf" on the target. ./perf record -e cs_etm/8008010000.cluster0-etf/ --per-thread uname event syntax error: 'cs_etm/8008010000.cluster0-etf/' ___ BPF support is not compiled
The perf command line parser is insanely complex. Here I suppose the extra "-etf" is causing the bison parser to hit a BPF rule, hence the error message. If you drop the "-etf" in the DT I'm pretty sure the message will go away. You can also enhance the flex/bison parser but to me the "address.name" convention is enough.
Regards, Reza
-----Original Message----- From: Etemadi, Mohammad Sent: Monday, April 17, 2017 4:03 PM To: Mathieu Poirier mathieu.poirier@linaro.org Cc: coresight@lists.linaro.org Subject: RE: Perf-opencsd-4.9
Thanks Mathieu
Regards, Reza
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Monday, April 17, 2017 2:51 PM To: Etemadi, Mohammad mohammad.etemadi@intel.com Cc: coresight@lists.linaro.org Subject: Re: Perf-opencsd-4.9
On 17 April 2017 at 13:08, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Thanks Mathieu
I fixed the power domain issue. Now, it can discover ETMs. For some reason, it cannot create /sys/devices/cs_etm/cpu1 Rather than creating cpu1, it tries to recreate cpu0.
How does it map ETMs to CPUs?
The mapping between tracer and CPU is done in the device tree - as such there seems to be a problem with the DT specification. If the code can't find a CPU for a tracer it will default to '0', which seems to be happening here. Look at the dragonboard example [1].
Instrumenting the code to understand what is going on is always a good idea.
Mathieu
[1]. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch...
Regards, Reza
entering ETM4_probe
coresight-etm4x 8008c40000.etm: ETM 4.0 initialized
Leaving ETMv4 Probe
entering ETMv4_probe sysfs: cannot create duplicate filename '/devices/cs_etm/cpu0' ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x88 Modules linked in:
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Monday, April 17, 2017 9:23 AM To: Etemadi, Mohammad mohammad.etemadi@intel.com Cc: coresight@lists.linaro.org Subject: Re: Perf-opencsd-4.9
On 14 April 2017 at 16:35, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Hello Mathieu
We have changed the device tree to reflect all CoreSight components on our platform. Still I do not see any device listed in the following directory
/sys/bus/coresight/devices
Am I missing something in Linux 4.9 configuration? I have enabled CONFIG_CORESIGHT in .config.
When the system boots AMBA probes for devices connected (and discoverable) on the bus. The first thing to do is make sure the CS devices show up at enumeration time. I suggest instrumenting function amba_device_try_add() [1] to see if CS devices are discovered. If not then it is probably a matter of enabling the debug power domain. While debugging I also suggest to boot with the "nohlt" option or disable CPUidle completely. That way tracers (usually located in the CPU/cluster power domain) are guaranteed to be enabled.
If CS devices show up then you will need to instrument the _probe() function of each CS driver to see what makes them unhappy.
Mathieu
[1]. http://lxr.free-electrons.com/source/drivers/amba/bus.c#L344
Regards, Reza
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Friday, March 31, 2017 3:37 PM To: Etemadi, Mohammad mohammad.etemadi@intel.com Subject: Re: Perf-opencsd-4.9
On 31 March 2017 at 14:32, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Thanks Mathieu
I am using Yocto tool chain. So, I have to add --sysroot to both opencsd and tools/perf makefiles. If I see more problems, I may have to switch building them on the target.
Ok, let me know.
I will be travelling for the next two weeks. As such I may be slow to respond, if at all. While I am away you can always send your questions to "coresight@lists.linaro.org". There is a lot of very knowledgeable people on there that can help you.
Regards, Reza
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Friday, March 31, 2017 3:27 PM To: Etemadi, Mohammad mohammad.etemadi@intel.com Subject: Re: Perf-opencsd-4.9
For my own sanity I tried doing the same thing and everything works as advertised. The only difference is that I'm not cross compiling and I have gcc 5.4.0. We know how to fix the gcc 6.2 problem and the cross compilation isn't part of the equation.
For the perf tools I am working with branch perf-openscd-4.9 (b50067a52cf3). On the openCSD side I am using the master branch (054c07caa2eb).
Mathieu
On 31 March 2017 at 13:52, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Thanks Mathieu
I am using master branch
git clone https://github.com/Linaro/OpenCSD.git my-opencsd git checkout -b master origin/master
Is this a correct branch for opencsd?
I am cross compiling both opencsd and tools/perf.
Regards, Reza
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Friday, March 31, 2017 2:34 PM To: Etemadi, Mohammad mohammad.etemadi@intel.com Subject: Re: Perf-opencsd-4.9
On 31 March 2017 at 12:58, Etemadi, Mohammad mohammad.etemadi@intel.com wrote:
Hello Mathieu
We have taken all the patches. When building tools/perf we get the following compilation errors. Do you have some ideas if we are missing a patch?
The problem comes from mismatches between the kernel and the openCSD version. We try to keep them working for older versions but that can't be guaranteed all the time.
CC util/parse-events.o CC util/parse-events-flex.o CC util/pmu.o util/cs-etm.c:1282:27: error: ?cs_etm_global_header_fmts? defined but not used [-Werror=unused-const-variable=] static const char * const cs_etm_global_header_fmts[] = { ^~~~~~~~~~~~~~~~~~~~~~~~~
Right, you are building branch 4.9 with a gcc version that is higher than 6.2. We have a patch for that on the 4.11-rc1 branch [1].
[1]. https://github.com/Linaro/OpenCSD/commit/2379238cd554a3445b87ceaa4e f 0 0 15c5d25c4b3
CC util/pmu-flex.o util/cs-etm-decoder/cs-etm-decoder.c: In function ?cs_etm_decoder__gen_trace_elem_printer?: util/cs-etm-decoder/cs-etm-decoder.c:204:7: error: ?OCSD_GEN_TRC_ELEM_SWTRACE? undeclared (first use in this function) case OCSD_GEN_TRC_ELEM_SWTRACE: ^~~~~~~~~~~~~~~~~~~~~~~~~ util/cs-etm-decoder/cs-etm-decoder.c:204:7: note: each undeclared identifier is reported only once for each function it appears in util/cs-etm-decoder/cs-etm-decoder.c:205:7: error: ?OCSD_GEN_TRC_ELEM_CUSTOM? undeclared (first use in this function) case OCSD_GEN_TRC_ELEM_CUSTOM: ^~~~~~~~~~~~~~~~~~~~~~~~
Those two are related to the openCSD version. What version of the library are you working with? In any case if you stick with the latest revision (0.5.4) or TIP you should be fine. The commits that added these two is here [2].
[2]. https://github.com/Linaro/OpenCSD/commit/885cb935cf04acc3d0afd2bb24 2 b d 9f7328e7104
mv: cannot stat 'util/cs-etm-decoder/.cs-etm-decoder.o.tmp': No such file or directory
Regards, Reza
-----Original Message----- From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] Sent: Thursday, March 30, 2017 10:15 AM To: Etemadi, Mohammad mohammad.etemadi@intel.com Subject: Re: Perf-opencsd-4.9
On 30 March 2017 at 09:12, Etemadi, Mohammad mohammad.etemadi@intel.com wrote: > Thanks. > > Do you have links to these patches?
It's all there: https://github.com/Linaro/OpenCSD/commits/perf-opencsd-4.9
> > Regards, Reza > > -----Original Message----- > From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] > Sent: Thursday, March 30, 2017 10:06 AM > To: Etemadi, Mohammad mohammad.etemadi@intel.com > Subject: Re: Perf-opencsd-4.9 > > On 30 March 2017 at 08:51, Etemadi, Mohammad mohammad.etemadi@intel.com wrote: >> Thanks Mathieu >> >> This is an in-house board and we had to do some BSP changes to boot Linux 4.9 on our board. > > Ok. > >> I just want to make sure that I merge perf-openCSD-4.9 correctly with our source tree. >> So, are you saying that I only need to replace tool/perf directory? > > Simply apply the patches you find on perf-opencsd-4.9, that will make life easier on you. > >> >> Regards, Reza >> >> -----Original Message----- >> From: Mathieu Poirier [mailto:mathieu.poirier@linaro.org] >> Sent: Thursday, March 30, 2017 9:40 AM >> To: Etemadi, Mohammad mohammad.etemadi@intel.com >> Subject: Re: Perf-opencsd-4.9 >> >> On 29 March 2017 at 19:47, Etemadi, Mohammad mohammad.etemadi@intel.com wrote: >>> Hello Matt >> >> Hi there, >> >>> >>> >>> >>> We have Linux 4.9 running on our ARMv8 platform. I like to try >>> instruction tracing using perf-opencsd-4.9. >> >> Ok, that should be an interesting project. >> >>> >>> I noticed that there is a Linaro Linux source tree for perf-opencsd-4.9. >>> Looks like this tree consists of base >>> >>> Linux kernel 4.9 plus some some additions to support CoreSight >>> and instruction trace using Perf tool. >> >> All the kernel side of the solution is already upstream. What is on gitHub it part of the user space perf tools that haven't been upstreamed yet (we are working on it) and the openCSD decoding library. >> >>> >>> >>> >>> For adding trace functionality, Is it possible to get a patch >>> that I can apply to my base Linux 4.9? >> >> I'm not sure of what you mean by "a patch I can add" - can you rephrase of give me more details? All the patches on top of mainline (on gitHub) should apply cleanly to your tree. >> >>> >>> >>> >>> Also which files must be changed to reflect specific SOC CoreSight topology? >> >> CoreSight is different on every platform, which is why all the platform specific stuff has been pushed to the device tree. Is this a commercial board or something in-house? >> >> In the former case support for vexpress[1], juno (R0/1/2)[2] and the dragonboard[3] are already upstream. There is also something for HiKey that I could share with you if need be. If this is an in-house project you will need to make up your own device tree base on the topology you are working with. >> >> I'm always interested by what people are doing with CoreSight. Get back to me if you have more questions. >> >> Regards, >> Mathieu >> >> [1]. >> http://lxr.free-electrons.com/source/arch/arm/boot/dts/vexpress- >> v >> 2 >> p >> - >> c >> a >> 15_a7.dts [2]. >> http://lxr.free-electrons.com/source/arch/arm64/boot/dts/arm/jun >> o >> - >> b >> a >> s >> e >> .dtsi [3]. >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.g >> i >> t >> / >> t >> r >> e >> e/arch/arm64/boot/dts/qcom/msm8916.dtsi?id=refs/tags/v4.11-rc4 >> >> >>> >>> >>> >>> Regards, Reza