PERF support for SAMA5DX running Linux 3.6.9?

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

flotter
Posts: 8
Joined: Thu Mar 27, 2014 5:32 pm

PERF support for SAMA5DX running Linux 3.6.9?

Tue Apr 22, 2014 10:02 am

Hi guys and girls,

I am trying to get perf events working on Linux (e.g. oprofile, ARM Streamline). The first problem was that the DTB did not include the PMU so I added this according to previous forum posts:

--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -42,6 +42,11 @@
  };
  };
 
+   pmu {
+    compatible = "arm,cortex-a5-pmu";
+    interrupts = <46 4 0>;
+ };
+
  memory {
  reg = <0x20000000 0x8000000>;
  };


However, I still do not get counters working. The first issue is the ARM Streamline profiler reports that counters return zero. So I wrote a simple test application which reads the HW cycle counter:

root@sama5d3xek:~# ./perftest
[499503] <146341329996900>
[499503] <0>
[499503] <0>
[499503] <0>

It looks like the first read succeeds, but subsequent reads return zero. My next thought was the Secure User Non-Invasive debug is disabled, so that counters do not increment during userspace execution ...

So I used JTAG debug to confirm:

The kernel is running in Secure World, with SDES.SUNIDEN = 0, SDES.SUIDEN = 0 and PMCR.DP = 0.

I enabled all these during a debug session but still the same results...

Now I am stuck. I would like to know how the HW signals SPIDEN and SPNIDEN are wired on the Cortex-A5?

Did anyone succeed in getting perf to work?
Attachments
perf.tar
Simple PERF HW counter read test
(90 KiB) Downloaded 70 times
flotter
Posts: 8
Joined: Thu Mar 27, 2014 5:32 pm

Re: PERF support for SAMA5DX running Linux 3.6.9?

Tue Apr 22, 2014 10:57 am

I have since confirmed that the DEBUGAUTHSTATUS register at 0x00910FB8 is 0xFF indicating that SPNIDEN and NIDEN (and all the others) are enabled. In this case the values of SUNIDEN and SUIDEN are ignored and both invasive and non-invasive debug are fully enabled. Thus, the issue does not appear to be related to permissions.

I now suspect the interrupt source/configuration. Any help would still be appreciated.

Regards,
Fred
flotter
Posts: 8
Joined: Thu Mar 27, 2014 5:32 pm

Re: PERF support for SAMA5DX running Linux 3.6.9?

Tue Apr 22, 2014 3:21 pm

I have to conclude that either I messed up the Linux kernel configuration, or something is not right in the kernel 3.6.9.

root@sama5d3xek:/proc# perf list 

  cpu-cycles OR cycles                           [Hardware event]
  instructions                                       [Hardware event]
  cache-references                                [Hardware event]
  cache-misses                                     [Hardware event]

But then:

root@sama5d3xek:/proc# perf stat -e cycles dd if=/dev/zero of=/dev/null count=100000

  Error: open_counter returned with 19 (No such device). /bin/dmesg may provide additional information.

  Fatal: Not all events could be opened.

Any ideas would still be welcomed  :?
flotter
Posts: 8
Joined: Thu Mar 27, 2014 5:32 pm

Re: PERF support for SAMA5DX running Linux 3.6.9?

Wed Apr 23, 2014 10:44 am

This issue is fixed in linux-3.10-at91 branch.

(The branch I have used was linux-3.6.9-at91). 

Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 1 guest