All of lore.kernel.org
 help / color / mirror / Atom feed
* Decoding the PTM traces
@ 2012-11-14 14:04 Arun KS
  2012-11-14 14:58 ` Punit Agrawal
  2012-11-14 23:25 ` Arve Hjønnevåg
  0 siblings, 2 replies; 7+ messages in thread
From: Arun KS @ 2012-11-14 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

I m trying to capture and decode PTM trace from Cortex A9 dual core.

I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
setting the funnel to get data in ETB.
But I don't know how to decode these traces.

Anyone has any pointers?

Thanks,
Arun

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-14 14:04 Decoding the PTM traces Arun KS
@ 2012-11-14 14:58 ` Punit Agrawal
  2012-11-14 15:13   ` Arun KS
  2012-11-14 23:25 ` Arve Hjønnevåg
  1 sibling, 1 reply; 7+ messages in thread
From: Punit Agrawal @ 2012-11-14 14:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arun,

You can think of the trace in the ETB as the raw stream resulting from
the multiplexing of different trace streams. So to get to the PTM trace
you'll first have to de-multiplex the stream, and then decode the stream
based on the source - in this case PTM.

The format of the data stored in the ETB is described in the ETM TRM
Section 9.6
(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Bgbhhidd.html).
The decoding should give you a trace stream for each active trace
source. The ATBID can be used to de-multiplex multiple sources, e.g.,
the two PTMs associated with the two A9s.

The PTM stream can then be decoded using the Program Flow Trace Protocol
described in Program Flow Trace Architecture Specification Section 4
(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0035b/Chddbbdf.html).

Out of curiosity, may I ask what are you trying to do?

Hope this helps. Feel free to ask for clarification.

Cheers,
Punit



On 14/11/12 14:04, Arun KS wrote:
> Hello,
>
> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>
> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
> setting the funnel to get data in ETB.
> But I don't know how to decode these traces.
>
> Anyone has any pointers?
>
> Thanks,
> Arun
>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev at lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
>
>
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-14 14:58 ` Punit Agrawal
@ 2012-11-14 15:13   ` Arun KS
  2012-11-14 15:35     ` Punit Agrawal
  0 siblings, 1 reply; 7+ messages in thread
From: Arun KS @ 2012-11-14 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Punit,

On Wed, Nov 14, 2012 at 8:28 PM, Punit Agrawal <punit.agrawal@arm.com> wrote:
> Hi Arun,
>
> You can think of the trace in the ETB as the raw stream resulting from
> the multiplexing of different trace streams. So to get to the PTM trace
> you'll first have to de-multiplex the stream, and then decode the stream
> based on the source - in this case PTM.
>
> The format of the data stored in the ETB is described in the ETM TRM
> Section 9.6
> (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Bgbhhidd.html).
> The decoding should give you a trace stream for each active trace
> source. The ATBID can be used to de-multiplex multiple sources, e.g.,
> the two PTMs associated with the two A9s.
>
> The PTM stream can then be decoded using the Program Flow Trace Protocol
> described in Program Flow Trace Architecture Specification Section 4
> (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0035b/Chddbbdf.html).

So do you mean that there is no open source tool which decodes this as
of now and I have to write one?

>
> Out of curiosity, may I ask what are you trying to do?

The main intention is to debug freeze issues using PTM traces.
When a device is in freeze, my intention is to  collect PTM traces
from ETB and decode.
So that I ll get traces of last few branches and exceptions.

Thanks,
Arun

>
> Hope this helps. Feel free to ask for clarification.
>
> Cheers,
> Punit
>
>
>
>
> On 14/11/12 14:04, Arun KS wrote:
>>
>> Hello,
>>
>> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>>
>> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
>> setting the funnel to get data in ETB.
>> But I don't know how to decode these traces.
>>
>> Anyone has any pointers?
>>
>> Thanks,
>> Arun
>>
>> _______________________________________________
>> linaro-dev mailing list
>> linaro-dev at lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/linaro-dev
>>
>>
>>
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium.  Thank you.
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-14 15:13   ` Arun KS
@ 2012-11-14 15:35     ` Punit Agrawal
  0 siblings, 0 replies; 7+ messages in thread
From: Punit Agrawal @ 2012-11-14 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/11/12 15:13, Arun KS wrote:
> Hello Punit,
>
> On Wed, Nov 14, 2012 at 8:28 PM, Punit Agrawal <punit.agrawal@arm.com> wrote:
>> Hi Arun,
>>
>> You can think of the trace in the ETB as the raw stream resulting from
>> the multiplexing of different trace streams. So to get to the PTM trace
>> you'll first have to de-multiplex the stream, and then decode the stream
>> based on the source - in this case PTM.
>>
>> The format of the data stored in the ETB is described in the ETM TRM
>> Section 9.6
>> (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Bgbhhidd.html).
>> The decoding should give you a trace stream for each active trace
>> source. The ATBID can be used to de-multiplex multiple sources, e.g.,
>> the two PTMs associated with the two A9s.
After sending the previous email, I had a quick look at etm.c and
noticed that it configures the ETB formatter to run in "Bypass" mode,
i.e., it doesn't introduce any formatting into the trace stream.
>>
>> The PTM stream can then be decoded using the Program Flow Trace Protocol
>> described in Program Flow Trace Architecture Specification Section 4
>> (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0035b/Chddbbdf.html).
> So do you mean that there is no open source tool which decodes this as
> of now and I have to write one?
I don't know of any open source tool to decode PTM trace.

But in light of the above finding, decoding only PTM trace should give
you the information you are after.

Hope that makes it a little bit easier.

Punit
>> Out of curiosity, may I ask what are you trying to do?
> The main intention is to debug freeze issues using PTM traces.
> When a device is in freeze, my intention is to  collect PTM traces
> from ETB and decode.
> So that I ll get traces of last few branches and exceptions.
>
> Thanks,
> Arun
>
>> Hope this helps. Feel free to ask for clarification.
>>
>> Cheers,
>> Punit
>>
>>
>>
>>
>> On 14/11/12 14:04, Arun KS wrote:
>>> Hello,
>>>
>>> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>>>
>>> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
>>> setting the funnel to get data in ETB.
>>> But I don't know how to decode these traces.
>>>
>>> Anyone has any pointers?
>>>
>>> Thanks,
>>> Arun
>>>
>>> _______________________________________________
>>> linaro-dev mailing list
>>> linaro-dev at lists.linaro.org
>>> http://lists.linaro.org/mailman/listinfo/linaro-dev
>>>
>>>
>>>
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments are
>> confidential and may also be privileged. If you are not the intended
>> recipient, please notify the sender immediately and do not disclose the
>> contents to any other person, use it for any purpose, or store or copy the
>> information in any medium.  Thank you.
>>
>
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-14 14:04 Decoding the PTM traces Arun KS
  2012-11-14 14:58 ` Punit Agrawal
@ 2012-11-14 23:25 ` Arve Hjønnevåg
  2012-11-15  3:41   ` Arun KS
  1 sibling, 1 reply; 7+ messages in thread
From: Arve Hjønnevåg @ 2012-11-14 23:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 14, 2012 at 6:04 AM, Arun KS <arunks.linux@gmail.com> wrote:
> Hello,
>
> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>
> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
> setting the funnel to get data in ETB.
> But I don't know how to decode these traces.
>
> Anyone has any pointers?
>
> Thanks,
> Arun

I attached some tools I use to decode the traces. I have used this on
the A8, A9 and A15. I assume since you cc-ed me you have already
applied the kernel patches I posted a while back. Without them you
will not get useful trace data from a dual core processor.

-- 
Arve Hj?nnev?g
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etm.c
Type: text/x-csrc
Size: 20847 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/7058a281/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objdump.py
Type: application/octet-stream
Size: 6317 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/7058a281/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etm-objdump.py
Type: application/octet-stream
Size: 6984 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121114/7058a281/attachment-0003.obj>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-14 23:25 ` Arve Hjønnevåg
@ 2012-11-15  3:41   ` Arun KS
  2012-11-16  4:33     ` Arun KS
  0 siblings, 1 reply; 7+ messages in thread
From: Arun KS @ 2012-11-15  3:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Arve,

On Thu, Nov 15, 2012 at 4:55 AM, Arve Hj?nnev?g <arve@android.com> wrote:
> On Wed, Nov 14, 2012 at 6:04 AM, Arun KS <arunks.linux@gmail.com> wrote:
>> Hello,
>>
>> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>>
>> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
>> setting the funnel to get data in ETB.
>> But I don't know how to decode these traces.
>>
>> Anyone has any pointers?
>>
>> Thanks,
>> Arun
>
> I attached some tools I use to decode the traces. I have used this on
> the A8, A9 and A15. I assume since you cc-ed me you have already
> applied the kernel patches I posted a while back. Without them you
> will not get useful trace data from a dual core processor.

Thank you very much for the tools. Hope I have taken all your patches.

Here is how my git log --oneline looks on arch/arm/kernel/etm.c

75cbaea ARM: etm: Add sysfs entry to enable return stack if supported
434032a ARM: etm: Add sysfs entry to disable branch_output flag
c6b1c35 ARM: etm: Add sysfs entry to set context-id-size
cfb8dc5 ARM: etm: Add sysfs entry to enable timestamps if supported
d263bc7 ARM: etm: Check arch version and disable data tracing for ptm
eff62a8 ARM: etm: Wait for etm/ptm(s) to stop before requesting PowerDown
4246983 ARM: etm: Power down etm(s) when tracing is not enabled
992cd59 ARM: etm: Support multiple ETMs/PTMs.
3a91f3e ARM: etm: Return the entire trace buffer if it is empty after reset
fe05bda ARM: etm: Add some missing locks and error checks
0c3da53 ARM: etm: Configure data tracing
d71c695 ARM: etm: Allow range selection
f13ae47 ARM: etm: Don't try to clear the buffer full status after
reading the buffer
8511b5b ARM: etm: Don't limit tracing to only non-secure code.
d387659 ARM: etm: Don't require clock control
73017a5 arm: fix implicit module.h users by adding it to arch/arm as required.
8e88069 ARM: 6838/1: etm: fix section mismatch warning
aa25afa ARM: amba: make probe() functions take const id tables
092e0e7 Merge branch 'llseek' of
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
6038f37 llseek: automatically add .llseek fop
8234eae ARM: 6291/1: coresight: move struct tracectx inside etm driver
1495cc9 Input: sysrq - drop tty argument from sysrq ops handlers
988257c ARM: 6294/1: etm: do a dummy read from OSSRR during initialization
9e354ea ARM: 6292/1: coresight: add ETM management registers
c5d6c77 ARM: 5841/1: a driver for on-chip ETM and ETB

I ll let you know the results.

thanks,
Arun
>
> --
> Arve Hj?nnev?g

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Decoding the PTM traces
  2012-11-15  3:41   ` Arun KS
@ 2012-11-16  4:33     ` Arun KS
  0 siblings, 0 replies; 7+ messages in thread
From: Arun KS @ 2012-11-16  4:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Arve,

On Thu, Nov 15, 2012 at 9:11 AM, Arun KS <arunks.linux@gmail.com> wrote:
> Hello Arve,
>
> On Thu, Nov 15, 2012 at 4:55 AM, Arve Hj?nnev?g <arve@android.com> wrote:
>> On Wed, Nov 14, 2012 at 6:04 AM, Arun KS <arunks.linux@gmail.com> wrote:
>>> Hello,
>>>
>>> I m trying to capture and decode PTM trace from Cortex A9 dual core.
>>>
>>> I m successful  in configuring the driver(arch/arm/kernel/etm.c) and
>>> setting the funnel to get data in ETB.
>>> But I don't know how to decode these traces.
>>>
>>> Anyone has any pointers?
>>>
>>> Thanks,
>>> Arun
>>
>> I attached some tools I use to decode the traces. I have used this on
>> the A8, A9 and A15. I assume since you cc-ed me you have already
>> applied the kernel patches I posted a while back. Without them you
>> will not get useful trace data from a dual core processor.
>
> Thank you very much for the tools. Hope I have taken all your patches.
>
> Here is how my git log --oneline looks on arch/arm/kernel/etm.c
>
> 75cbaea ARM: etm: Add sysfs entry to enable return stack if supported
> 434032a ARM: etm: Add sysfs entry to disable branch_output flag
> c6b1c35 ARM: etm: Add sysfs entry to set context-id-size
> cfb8dc5 ARM: etm: Add sysfs entry to enable timestamps if supported
> d263bc7 ARM: etm: Check arch version and disable data tracing for ptm
> eff62a8 ARM: etm: Wait for etm/ptm(s) to stop before requesting PowerDown
> 4246983 ARM: etm: Power down etm(s) when tracing is not enabled
> 992cd59 ARM: etm: Support multiple ETMs/PTMs.
> 3a91f3e ARM: etm: Return the entire trace buffer if it is empty after reset
> fe05bda ARM: etm: Add some missing locks and error checks
> 0c3da53 ARM: etm: Configure data tracing
> d71c695 ARM: etm: Allow range selection
> f13ae47 ARM: etm: Don't try to clear the buffer full status after
> reading the buffer
> 8511b5b ARM: etm: Don't limit tracing to only non-secure code.
> d387659 ARM: etm: Don't require clock control
> 73017a5 arm: fix implicit module.h users by adding it to arch/arm as required.
> 8e88069 ARM: 6838/1: etm: fix section mismatch warning
> aa25afa ARM: amba: make probe() functions take const id tables
> 092e0e7 Merge branch 'llseek' of
> git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
> 6038f37 llseek: automatically add .llseek fop
> 8234eae ARM: 6291/1: coresight: move struct tracectx inside etm driver
> 1495cc9 Input: sysrq - drop tty argument from sysrq ops handlers
> 988257c ARM: 6294/1: etm: do a dummy read from OSSRR during initialization
> 9e354ea ARM: 6292/1: coresight: add ETM management registers
> c5d6c77 ARM: 5841/1: a driver for on-chip ETM and ETB
>
> I ll let you know the results.

I m able to see decoded ptm traces using the following command,
python3.1 etm-objdump.py --trace-decoder=./etm
--trace-decoder-options="--pft-1.1 --sourceid-match 2" ptm.bin

Thanks,
Arun
>
> thanks,
> Arun
>>
>> --
>> Arve Hj?nnev?g

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-16  4:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 14:04 Decoding the PTM traces Arun KS
2012-11-14 14:58 ` Punit Agrawal
2012-11-14 15:13   ` Arun KS
2012-11-14 15:35     ` Punit Agrawal
2012-11-14 23:25 ` Arve Hjønnevåg
2012-11-15  3:41   ` Arun KS
2012-11-16  4:33     ` Arun KS

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.