Claudio Fontana(deleted)
|
cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/17/2018 2:46 AM
post118821
|
cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
Hi all,
is it possible at all to synchronize events captured with TraceEvent across cpus?
The issue here is that in the trace buffers the events coming from different cpus
have a timestamp that is apparently generated with ClockCycles(), whose counters are not synchronized.
How can I properly calculate time intervals in this situation?
Thank you,
Claudio
|
|
|
Elad Lahav
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Elad Lahav
05/17/2018 1:12 PM
post118823
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
ClockCycles() is assumed to be synchronized across cores (in theory it
doesn't have to be, but there are various things that would break if
that assumption doesn't hold).
What board and BSP are you using?
--Elad
On Thu, 2018-05-17 at 02:46 -0400, Claudio Fontana wrote:
> Hi all,
>
> is it possible at all to synchronize events captured with TraceEvent
> across cpus?
>
> The issue here is that in the trace buffers the events coming from
> different cpus
> have a timestamp that is apparently generated with ClockCycles(),
> whose counters are not synchronized.
>
> How can I properly calculate time intervals in this situation?
>
> Thank you,
>
> Claudio
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118821
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
|
|
|
Claudio Fontana(deleted)
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/18/2018 2:28 AM
post118826
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
> ClockCycles() is assumed to be synchronized across cores (in theory it
> doesn't have to be, but there are various things that would break if
> that assumption doesn't hold).
> What board and BSP are you using?
>
> --Elad
Hello Elad,
thank you for your answer,
I assumed ClockCycles counters were not synchronized between cores due to the documentation at:
http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.lib_ref/topic/c/clockcycles.html
But if they are always synchronized that solves my issue..
I am using an AArch64-based board (Renesas Car-M3 Starter Kit Pro) with the QNX bsp package from the Software Center.
|
|
|
Elad Lahav
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Elad Lahav
05/18/2018 9:51 AM
post118827
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
As odd as it may sound, both the documentation and what I said are
correct ;-)
In *principle* it is true that the ClockCycle() callout (implemented
for each BSP separately) does not have to return a synchronized value.
In *practice* all aarch64 BSPs I know of will use a single clock
source. x86_64 BSPs use the rdtsc call which, again, is not guaranteed
to be synchronized in principle but seems to be in practice (at least
on the boards we tested, and that's quite a few).
There are certain features in 7.0 (specifically HRTs) that will not
function properly if ClockCycles() does not return a synchronized
value.
The bottom line is that you should not observe a problem with combining
traces from different cores in any of the official BSPs. If you do,
please let me know.
--Elad
On Fri, 2018-05-18 at 02:28 -0400, Claudio Fontana wrote:
> >
> > ClockCycles() is assumed to be synchronized across cores (in theory
> > it
> > doesn't have to be, but there are various things that would break
> > if
> > that assumption doesn't hold).
> > What board and BSP are you using?
> >
> > --Elad
> Hello Elad,
>
> thank you for your answer,
> I assumed ClockCycles counters were not synchronized between cores
> due to the documentation at:
>
> http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.lib_re
> f/topic/c/clockcycles.html
>
> But if they are always synchronized that solves my issue..
>
> I am using an AArch64-based board (Renesas Car-M3 Starter Kit Pro)
> with the QNX bsp package from the Software Center.
>
>
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118826
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
|
|
|
Claudio Fontana(deleted)
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/18/2018 9:59 AM
post118828
|
Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
thank you very much for your clarification, super-helpful!
Ciao,
Claudio
|
|
|
John Kearney
|
RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
John Kearney
05/18/2018 10:01 AM
post118829
|
RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
If you want to be on the safe side you can verify this in the syspage.
https://www.qnx.com/developers/docs/7.0.0/com.qnx.doc.neutrino.building/topic/syspage/qtime.html
qtime->flags&QTIME_FLAG_GLOBAL_CLOCKCYCLES
cheers
________________________________________
From: Elad Lahav [community-noreply@qnx.com]
Sent: Friday, May 18, 2018 3:33 PM
To: ostech-core_os@community.qnx.com
Subject: Re: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
As odd as it may sound, both the documentation and what I said are
correct ;-)
In *principle* it is true that the ClockCycle() callout (implemented
for each BSP separately) does not have to return a synchronized value.
In *practice* all aarch64 BSPs I know of will use a single clock
source. x86_64 BSPs use the rdtsc call which, again, is not guaranteed
to be synchronized in principle but seems to be in practice (at least
on the boards we tested, and that's quite a few).
There are certain features in 7.0 (specifically HRTs) that will not
function properly if ClockCycles() does not return a synchronized
value.
The bottom line is that you should not observe a problem with combining
traces from different cores in any of the official BSPs. If you do,
please let me know.
--Elad
On Fri, 2018-05-18 at 02:28 -0400, Claudio Fontana wrote:
> >
> > ClockCycles() is assumed to be synchronized across cores (in theory
> > it
> > doesn't have to be, but there are various things that would break
> > if
> > that assumption doesn't hold).
> > What board and BSP are you using?
> >
> > --Elad
> Hello Elad,
>
> thank you for your answer,
> I assumed ClockCycles counters were not synchronized between cores
> due to the documentation at:
>
> http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.lib_re
> f/topic/c/clockcycles.html
>
> But if they are always synchronized that solves my issue..
>
> I am using an AArch64-based board (Renesas Car-M3 Starter Kit Pro)
> with the QNX bsp package from the Software Center.
>
>
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118826
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
_______________________________________________
OSTech
http://community.qnx.com/sf/go/post118827
To cancel your subscription to this discussion, please e-mail ostech-core_os-unsubscribe@community.qnx.com
|
|
|
Claudio Fontana(deleted)
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/25/2018 2:10 AM
post118844
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
> If you want to be on the safe side you can verify this in the syspage.
> https://www.qnx.com/developers/docs/7.0.0/com.qnx.doc.neutrino.building/topic/
> syspage/qtime.html
>
> qtime->flags&QTIME_FLAG_GLOBAL_CLOCKCYCLES
>
> cheers
Thank you John,
I checked the value of qtime->flags, and it is 0x3.
Should I conclude that ClockCycle is not synchronized across cores?
#define QTIME_FLAG_TIMER_ON_CPU0 0x00000001u
#define QTIME_FLAG_CHECK_STABLE 0x00000002u
#define QTIME_FLAG_TICKLESS 0x00000004u
#define QTIME_FLAG_GLOBAL_CLOCKCYCLES 0x00000008u
What is QTIME_FLAG_TIMER_ON_CPU0, does it help my case?
Thank you again,
Claudio
|
|
|
Elad Lahav
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Elad Lahav
05/25/2018 10:07 AM
post118847
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
I don't think that the QTIME_FLAG_GLOBAL_CLOCKCYCLES flag is actually
set by any BSP, which doesn't mean that the value of ClockCycles() is
not synchronized.
What board are you using?
--Elad
On Fri, 2018-05-25 at 02:10 -0400, Claudio Fontana wrote:
> >
> > If you want to be on the safe side you can verify this in the
> > syspage.
> > https://www.qnx.com/developers/docs/7.0.0/com.qnx.doc.neutrino.buil
> > ding/topic/
> > syspage/qtime.html
> >
> > qtime->flags&QTIME_FLAG_GLOBAL_CLOCKCYCLES
> >
> > cheers
> Thank you John,
>
> I checked the value of qtime->flags, and it is 0x3.
> Should I conclude that ClockCycle is not synchronized across cores?
>
> #define QTIME_FLAG_TIMER_ON_CPU0 0x00000001u
> #define QTIME_FLAG_CHECK_STABLE 0x00000002u
> #define QTIME_FLAG_TICKLESS 0x00000004u
> #define QTIME_FLAG_GLOBAL_CLOCKCYCLES 0x00000008u
>
> What is QTIME_FLAG_TIMER_ON_CPU0, does it help my case?
>
> Thank you again,
>
> Claudio
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118844
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
|
|
|
Claudio Fontana(deleted)
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/28/2018 11:01 AM
post118853
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
> I don't think that the QTIME_FLAG_GLOBAL_CLOCKCYCLES flag is actually
> set by any BSP, which doesn't mean that the value of ClockCycles() is
> not synchronized.
>
> What board are you using?
>
> --Elad
Hi Elad,
I am using an AArch64-based board (Renesas Car-M3 Starter Kit Pro)
with the QNX bsp package from the Software Center.
Ciao,
Claudio
|
|
|
Elad Lahav
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Elad Lahav
05/28/2018 11:15 AM
post118854
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
The implementation of ClockCycles() on aarch64 reads CNTVCT_EL0. As far
as I know reading this register should yield the same value regardless
of the core, so long as you don't use virtualization.
--Elad
On Mon, 2018-05-28 at 11:01 -0400, Claudio Fontana wrote:
> >
> > I don't think that the QTIME_FLAG_GLOBAL_CLOCKCYCLES flag is
> > actually
> > set by any BSP, which doesn't mean that the value of ClockCycles()
> > is
> > not synchronized.
> >
> > What board are you using?
> >
> > --Elad
> Hi Elad,
>
> I am using an AArch64-based board (Renesas Car-M3 Starter Kit Pro)
> with the QNX bsp package from the Software Center.
>
> Ciao,
>
> Claudio
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118853
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
|
|
|
Claudio Fontana(deleted)
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
|
Claudio Fontana(deleted)
05/28/2018 11:23 AM
post118855
|
Re: RE: cross-cpu synchronization of events captured with TraceEvent (ClockCycles issue)
> The implementation of ClockCycles() on aarch64 reads CNTVCT_EL0. As far
> as I know reading this register should yield the same value regardless
> of the core, so long as you don't use virtualization.
>
> --Elad
Thanks a lot Elad, I will proceed with this.
Regarding virtualization, it might be in scope for the future,
I should be fine anyway for what concerns VCPUs inside the same VM right?
To be more clear,
assuming we are running inside a VM, and we are using TraceEvent only inside this VM to track the VCPUs in this VM, the
EL2 Counter offset should be identical right?
Thanks a lot,
Claudio
|
|
|
|