Re: coresight drivers access from syscall interface

2019-12-05 Thread Mathieu Poirier
Good day,

On Thu, 5 Dec 2019 at 06:36, zied guermazi  wrote:
>
> hi,
> I started implementing GDB process record and replay with ARM CoreSight as 
> described in the rfc published early this year.
> Current implementation of coresight tracing in Perf is based on the sysfs 
> interface, by accessing /sys/bus/event_source/devices/cs_etm ...  file. GDB 
> implementation of bts and ipt is based on the syscall  "sys_perf_event_open".
> it would be nice to use the similar mechanism for realizing similar 
> functionalities. therefore I would like to know if linux kernel (with 
> coresight deivers)  is exposing coresight drivers through the syscall 
> sys_perf_event_open and if this is the case how shall I configure the 
> perf_event_attr to use it.

The coresight subsystem and drivers work the same way with regards to
the sys_perf_event_open() system call.  Implementation for both ARM
and Intel follow the same perf/AUX buffer interface in order to
provide a common front to users.  In fact using coresight with perf
works pretty much the same way as BTS or PT - documentation on that
can be found in the kernel tree [1] and on github [2].

Thanks,
Mathieu

[1]. 
https://elixir.bootlin.com/linux/latest/source/Documentation/trace/coresight.rst
[2]. https://github.com/Linaro/OpenCSD/blob/master/HOWTO.md

>
> thanks
> Zied Guermazi
>
>
>
>
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain


Re: progress in btrace with etm in gdb

2020-02-17 Thread Mathieu Poirier
 i
Hi Zied,

As requested before, always add the CS mailing list when interacting
with us.  There is a fair amount of people on there that would surely
be interested in this work.  I also CC'd the linaro-toolchain group
since some of the content below is related to what they do.

On Mon, 17 Feb 2020 at 10:08, zied guermazi  wrote:
>
> Hi Mike, hi Matthieu
> it works!
>
>
>
> On Monday, December 16, 2019, 11:20:20 PM GMT+1, zied guermazi 
>  wrote:
>
>
> hi Mike, hi Mathieu
> last few weeks I was able to spend some time on implementing this feature, 
> and I want to share the status with you and get your recommendation on 
> organizational and technical level.
> so far I was able to use perf events to configure the drivers for etm and 
> collect the traces. the code was tested successfully on an STM32MP157A 
> discovery kit (arm v7).
> I would like to push this on git, first for review and second for integration 
> and creating traction . Do you think it is ok to push it in this status 
> (feature partially achieved) ? is linaro gdb git the correct one? who is the 
> maintainer of this part of gdb? I do not have an ARMv8 platform to test. who 
> can support here?

I will address your questions one by one:

Q: Do you think it is ok to push it in this status (feature partially
achieved) ?
A: That depends on how advanced things are.  If it is stable (i.e it
does something) and can be used as a starting point for other people
to work on, then there is probably value in publishing your work.

Q: is linaro gdb git the correct one?
A: I see from your other email that you've already published your work.

Q: who is the maintainer of this part of gdb?
A: I'm sure the GDB project has documentation and a well defined
process that would identify who you should submit your code to.

Q: I do not have an ARMv8 platform to test. who can support here?
A: No doubt you'd get a lot more interest if you were working on V8.
I suggest purchasing a dragonboard 410c - they are super cheap, well
supported and one of our CS reference platforms.  I think we talked
about that before...

>
> during the implementation few technical question raised:
> - etm tracing collection requires selecting a trace sink. and I have two 
> alternatives: either extending the "record btrace etm" command (used to start 
> tracing) with a sink as an argument or extending the command "set record 
> btrace" (general configuration of tracing) with etm sink sub-command? (I have 
> hard-coded it currently to be able to progress)

I would assume this "set record btrace" command has an effect on the
current session only.  If so I would go for the latter option.


> - currently I am hardcoding the path "/sys/bus/event_source/devices/cs_etm/" 
> as the default etm source, is this guaranteed to be unique? can we have a 
> system with many etm sources enumerated in the sysfs.
>

I am very confused by this question.  Yes, the path
"/sys/bus/event_source/devices/cs_etm/" is guaranteed to be unique but
it is by no means a "default source".  Is is simply a directory used
by the perf tools to have more details on the CS specifics for the
running platform.  Nowadays it is fair to assume there is one ETM perf
CPU, all enumerated under sysfs.  Also keep in mind that processes are
being moved around by the scheduler and as such, a specific source
can't be hard coded.


> for parsing the traces I will need some configuration parameters like the 
> content of registers  ETMCR, ETMIDR, ETMCCER, ETMTRACEIDR. if my 
> understanding of the implementation of perf is correct, it is collecting them 
> from the sysfs files located in 
> /sys/bus/event_source/devices/cs_etm/cpu0/mgmt/. which are global for the 
> system. my question is what will happen if two process are requesting tracing 
> at the same time? how to differentiate between traces going to one session 
> from the second one? is it possible to get the parameters of a given session 
> by some kind of ioctl request to the file descriptor we get out of 
> sys_perf_open call?

Configuration of the tracers does indeed need to be considered.  At
this time we assume all the tracers in an implementation are similar,
hence using ".../cpu0/mgmt".  The information gathered from there is
related to the static configuration of the tracers.  Per session
dynamic configuration is collected from the perf tools command line
and communicated to the perf infrastructure for later interpretation
by the decoding code when instantiating a decoder from the openCSD
library.  Since the current framework handles only N:1 source/sink
configuration,  there can only be one trace session using a sink.
There is currently no way to extract trace session configuration other
than the user space perf tools mechanic.

>
> I will publish those queries in the linaro coresight and gdb forums, I wanted 
> first to align with you especially on the organizational issues, before going 
> to a bigger round.
>
> Thanks for your support
> Zied Guermazi
>
>
__

Re: progress in btrace with etm in gdb

2020-02-17 Thread Mathieu Poirier
Same comment applies with regards to mailing lists.

On Mon, 17 Feb 2020 at 10:16, zied guermazi  wrote:
>
> Hi Mike, hi Matthieu,
>
> I was too rapid to press the send button, sorry for the inconvienience.
> and yes, it works. I published the source code in github 
> (https://github.com/gzied/binutils-gdb/tree/gdb_arm_coresight) ,as well as a 
> mail in linaro mailing list 
> (https://lists.linaro.org/pipermail/coresight/2020-February/003676.html).

Unfortunately you didn't publish your work in "PATCH" format and as
such it can't be reviewed.


> Eventhough there is still an effort needed to stabilize it for armv7,  and 
> test it for armv8, I consider this as a breakthough that we can build on the 
> top of it.
> I will be visiting Embedded world exhibition between 25th and 27th of 
> February in Nuremberg, Germany. are you planning to be there too. I am 
> looking forwards to meet you there if possible to discuss possibilities of  
> further development and integration in the main stream.

I won't be in Nuremberg next week and I'm pretty sure Mike won't be
there either.  Other people on the lists might be around and
interested in meeting with you.  Mike and I will be attending Linaro
Connect in Budapest between the 23rd and 27th of March.  The Linaro
toolchain group will also be there so it might be the perfect
opportunity to sit down for an hour or so and have a chat.

A good day to you,
Mathieu

>
> Kind Regards
> Zied Guermazi
>
>
>
>
>
> On Monday, February 17, 2020, 06:08:26 PM GMT+1, zied guermazi 
>  wrote:
>
>
> Hi Mike, hi Matthieu
> it works!
>
>
>
> On Monday, December 16, 2019, 11:20:20 PM GMT+1, zied guermazi 
>  wrote:
>
>
> hi Mike, hi Mathieu
> last few weeks I was able to spend some time on implementing this feature, 
> and I want to share the status with you and get your recommendation on 
> organizational and technical level.
> so far I was able to use perf events to configure the drivers for etm and 
> collect the traces. the code was tested successfully on an STM32MP157A 
> discovery kit (arm v7).
> I would like to push this on git, first for review and second for integration 
> and creating traction . Do you think it is ok to push it in this status 
> (feature partially achieved) ? is linaro gdb git the correct one? who is the 
> maintainer of this part of gdb? I do not have an ARMv8 platform to test. who 
> can support here?
>
> during the implementation few technical question raised:
> - etm tracing collection requires selecting a trace sink. and I have two 
> alternatives: either extending the "record btrace etm" command (used to start 
> tracing) with a sink as an argument or extending the command "set record 
> btrace" (general configuration of tracing) with etm sink sub-command? (I have 
> hard-coded it currently to be able to progress)
> - currently I am hardcoding the path "/sys/bus/event_source/devices/cs_etm/" 
> as the default etm source, is this guaranteed to be unique? can we have a 
> system with many etm sources enumerated in the sysfs.
>
> for parsing the traces I will need some configuration parameters like the 
> content of registers  ETMCR, ETMIDR, ETMCCER, ETMTRACEIDR. if my 
> understanding of the implementation of perf is correct, it is collecting them 
> from the sysfs files located in 
> /sys/bus/event_source/devices/cs_etm/cpu0/mgmt/. which are global for the 
> system. my question is what will happen if two process are requesting tracing 
> at the same time? how to differentiate between traces going to one session 
> from the second one? is it possible to get the parameters of a given session 
> by some kind of ioctl request to the file descriptor we get out of 
> sys_perf_open call?
>
> I will publish those queries in the linaro coresight and gdb forums, I wanted 
> first to align with you especially on the organizational issues, before going 
> to a bigger round.
>
> Thanks for your support
> Zied Guermazi
>
>
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain


Re: progress in btrace with etm in gdb

2020-02-18 Thread Mathieu Poirier
On Mon, 17 Feb 2020 at 14:42, zied guermazi  wrote:
>
> hi all,
> I am attaching the patch for the changes done in gdb in order to activate 
> instructions and functions recording on ARM processors. your feedback and 
> review comments are welcome.

In order to get people to look at your code it needs to be formatted
and sent out using the proper format.  You can see how people submit
code to the GDB project here[1].

[1]. https://sourceware.org/ml/gdb-patches/


> and for sure if someone is planning to visit the embedded word exhibition and 
> want to have an exchange concerning this topic, he/she is welcome to drop me 
> an e-mail to schedule an appointment
> Kind Regards
> Zied Guermazi
>
> On Monday, February 17, 2020, 7:23:07 PM GMT+1, Mathieu Poirier 
>  wrote:
>
>
> Same comment applies with regards to mailing lists.
>
> On Mon, 17 Feb 2020 at 10:16, zied guermazi  wrote:
> >
> > Hi Mike, hi Matthieu,
> >
> > I was too rapid to press the send button, sorry for the inconvienience.
> > and yes, it works. I published the source code in github 
> > (https://github.com/gzied/binutils-gdb/tree/gdb_arm_coresight) ,as well as 
> > a mail in linaro mailing list 
> > (https://lists.linaro.org/pipermail/coresight/2020-February/003676.html).
>
> Unfortunately you didn't publish your work in "PATCH" format and as
> such it can't be reviewed.
>
>
> > Eventhough there is still an effort needed to stabilize it for armv7,  and 
> > test it for armv8, I consider this as a breakthough that we can build on 
> > the top of it.
> > I will be visiting Embedded world exhibition between 25th and 27th of 
> > February in Nuremberg, Germany. are you planning to be there too. I am 
> > looking forwards to meet you there if possible to discuss possibilities of  
> > further development and integration in the main stream.
>
> I won't be in Nuremberg next week and I'm pretty sure Mike won't be
> there either.  Other people on the lists might be around and
> interested in meeting with you.  Mike and I will be attending Linaro
> Connect in Budapest between the 23rd and 27th of March.  The Linaro
> toolchain group will also be there so it might be the perfect
> opportunity to sit down for an hour or so and have a chat.
>
> A good day to you,
> Mathieu
>
>
> >
> > Kind Regards
> > Zied Guermazi
> >
> >
> >
> >
> >
> > On Monday, February 17, 2020, 06:08:26 PM GMT+1, zied guermazi 
> >  wrote:
> >
> >
> > Hi Mike, hi Matthieu
> > it works!
> >
> >
> >
> > On Monday, December 16, 2019, 11:20:20 PM GMT+1, zied guermazi 
> >  wrote:
> >
> >
> > hi Mike, hi Mathieu
> > last few weeks I was able to spend some time on implementing this feature, 
> > and I want to share the status with you and get your recommendation on 
> > organizational and technical level.
> > so far I was able to use perf events to configure the drivers for etm and 
> > collect the traces. the code was tested successfully on an STM32MP157A 
> > discovery kit (arm v7).
> > I would like to push this on git, first for review and second for 
> > integration and creating traction . Do you think it is ok to push it in 
> > this status (feature partially achieved) ? is linaro gdb git the correct 
> > one? who is the maintainer of this part of gdb? I do not have an ARMv8 
> > platform to test. who can support here?
> >
> > during the implementation few technical question raised:
> > - etm tracing collection requires selecting a trace sink. and I have two 
> > alternatives: either extending the "record btrace etm" command (used to 
> > start tracing) with a sink as an argument or extending the command "set 
> > record btrace" (general configuration of tracing) with etm sink 
> > sub-command? (I have hard-coded it currently to be able to progress)
> > - currently I am hardcoding the path 
> > "/sys/bus/event_source/devices/cs_etm/" as the default etm source, is this 
> > guaranteed to be unique? can we have a system with many etm sources 
> > enumerated in the sysfs.
> >
> > for parsing the traces I will need some configuration parameters like the 
> > content of registers  ETMCR, ETMIDR, ETMCCER, ETMTRACEIDR. if my 
> > understanding of the implementation of perf is correct, it is collecting 
> > them from the sysfs files located in 
> > /sys/bus/event_source/devices/cs_etm/cpu0/mgmt/. which are global for the 
> > system. my question is what will happen if two process are requesting 
> > tracing at the same time?

Re: progress in btrace with etm in gdb

2020-02-19 Thread Mathieu Poirier
On Wed, 19 Feb 2020 at 03:03, zied guermazi  wrote:
>
> hi
> I went though the gdb-patches link you provided and if my understanding is 
> correct, you ( and the community) are expecting  patches with higher 
> granularity and a well defined scope and explanation. is my understanding 
> correct? is there other guidelines to follow.

The GDB community has guidelines for submitting patches - I suggest
you read them before sending your patchset.  Breaking down your patch
in smaller chunks will greatly help motivating people to look at your
work.

> I have generated a patch from the branch I used in developing this feature 
> using "git format-patch", and I am attaching it. I do not recommend using it 
> for reviewing or integration purpose, since it was a kind of exploratory 
> development where some codes/decisions where revoked/amended between 
> different commits.
> I will prepare a clean set of patches and distribute it. for that, I will 
> need few days (nights to be more precise :) )
>
> Best Regards
> Zied Guermazi
>
> On Tuesday, February 18, 2020, 5:07:24 PM GMT+1, Mathieu Poirier 
>  wrote:
>
>
> On Mon, 17 Feb 2020 at 14:42, zied guermazi  wrote:
> >
> > hi all,
> > I am attaching the patch for the changes done in gdb in order to activate 
> > instructions and functions recording on ARM processors. your feedback and 
> > review comments are welcome.
>
> In order to get people to look at your code it needs to be formatted
> and sent out using the proper format.  You can see how people submit
> code to the GDB project here[1].
>
> [1]. https://sourceware.org/ml/gdb-patches/
>
>
>
> > and for sure if someone is planning to visit the embedded word exhibition 
> > and want to have an exchange concerning this topic, he/she is welcome to 
> > drop me an e-mail to schedule an appointment
> > Kind Regards
> > Zied Guermazi
> >
> > On Monday, February 17, 2020, 7:23:07 PM GMT+1, Mathieu Poirier 
> >  wrote:
> >
> >
> > Same comment applies with regards to mailing lists.
> >
> > On Mon, 17 Feb 2020 at 10:16, zied guermazi  wrote:
> > >
> > > Hi Mike, hi Matthieu,
> > >
> > > I was too rapid to press the send button, sorry for the inconvienience.
> > > and yes, it works. I published the source code in github 
> > > (https://github.com/gzied/binutils-gdb/tree/gdb_arm_coresight) ,as well 
> > > as a mail in linaro mailing list 
> > > (https://lists.linaro.org/pipermail/coresight/2020-February/003676.html).
> >
> > Unfortunately you didn't publish your work in "PATCH" format and as
> > such it can't be reviewed.
> >
> >
> > > Eventhough there is still an effort needed to stabilize it for armv7,  
> > > and test it for armv8, I consider this as a breakthough that we can build 
> > > on the top of it.
> > > I will be visiting Embedded world exhibition between 25th and 27th of 
> > > February in Nuremberg, Germany. are you planning to be there too. I am 
> > > looking forwards to meet you there if possible to discuss possibilities 
> > > of  further development and integration in the main stream.
> >
> > I won't be in Nuremberg next week and I'm pretty sure Mike won't be
> > there either.  Other people on the lists might be around and
> > interested in meeting with you.  Mike and I will be attending Linaro
> > Connect in Budapest between the 23rd and 27th of March.  The Linaro
> > toolchain group will also be there so it might be the perfect
> > opportunity to sit down for an hour or so and have a chat.
> >
> > A good day to you,
> > Mathieu
> >
> >
> > >
> > > Kind Regards
> > > Zied Guermazi
> > >
> > >
> > >
> > >
> > >
> > > On Monday, February 17, 2020, 06:08:26 PM GMT+1, zied guermazi 
> > >  wrote:
> > >
> > >
> > > Hi Mike, hi Matthieu
> > > it works!
> > >
> > >
> > >
> > > On Monday, December 16, 2019, 11:20:20 PM GMT+1, zied guermazi 
> > >  wrote:
> > >
> > >
> > > hi Mike, hi Mathieu
> > > last few weeks I was able to spend some time on implementing this 
> > > feature, and I want to share the status with you and get your 
> > > recommendation on organizational and technical level.
> > > so far I was able to use perf events to configure the drivers for etm and 
> > > collect the traces. the code was tested successfully on an STM32MP157A 
> > > discovery kit (arm v7).
> >

Re: Compilation issue with Linaro ARM toolchain

2021-01-18 Thread Mathieu Poirier
Adding the Linaro toolchain group mailing list.

On Mon, Jan 18, 2021 at 05:49:39PM +0300, Sergey Suloev wrote:
> Hi, guys,
> 
> I am having an issue builduing kernel 5.11 (rc4) with Linaro ARM toolchain.
> The issue seems to be related to CC plugins sources.
> Here is my build log: https://pastebin.com/DTn7Szax. I have never seen this
> before with versions 5.10 and below.
> 
> Thank you,
> Sergey
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain